@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    overflow-x: hidden;
}

.gradient-text {
    background: linear-gradient(90deg, #3B82F6, #F97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-bg {
    background: linear-gradient(135deg, #3B82F6, #F97316);
}

.category-tab {
    transition: all 0.3s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

.category-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.dark .category-tab:not(.gradient-bg) {
    background-color: #1f2937;
    color: #d1d5db;
    border-color: #374151;
}

/* IMPROVED PRODUCT CARD - Mobile First */
.product-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background-color: #ffffff;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dark .product-card {
    border-color: #374151;
    background-color: #1f2937;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.product-card:active {
    transform: scale(0.98);
}

/* Product Image Container - Fixed aspect ratio */
.product-image-wrapper {
    overflow: hidden;
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1; /* Square for mobile */
    background: #f3f4f6;
}

.dark .product-image-wrapper {
    background: #111827;
}

.product-image {
    transition: transform 0.4s ease;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Changed from cover to contain */
    padding: 8px;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* Brand & Discount Badges */
.brand-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    color: white;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.discount-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #F97316, #EA580C);
    color: white;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.4);
    z-index: 10;
}

/* Card Content Section */
.product-card .p-5 {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 8px;
}

.deal-timestamp {
    font-size: 10px;
    font-weight: 500;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dark .deal-timestamp {
    color: #6B7280;
}

/* Title - 2 lines with ellipsis */
.product-card h4 {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: #1F2937;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 36px;
    margin: 0;
}

.dark .product-card h4 {
    color: #F9FAFB;
}

/* Price & Button Container */
.product-card .mt-auto {
    margin-top: auto;
    padding-top: 8px;
}

.product-card .text-xl {
    font-size: 16px;
    font-weight: 700;
    color: #059669;
}

.dark .product-card .text-xl {
    color: #10B981;
}

/* Buy Button - More prominent */
.product-card a {
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.live-indicator {
    width: 10px;
    height: 10px;
    background-color: #EF4444;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* Animations */
@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.telegram-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #38a1f3, #0088cc);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 16px rgba(0, 136, 204, 0.4);
    z-index: 1000;
    transition: all 0.3s ease;
}

.telegram-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(0, 136, 204, 0.5);
}

/* Mobile Grid Optimization */
#deals-container {
    gap: 12px;
}

/* Responsive Breakpoints */
@media (min-width: 640px) {
    #deals-container {
        gap: 16px;
    }
    
    .product-card h4 {
        font-size: 14px;
    }
    
    .brand-tag {
        font-size: 11px;
        padding: 5px 10px;
    }
    
    .discount-badge {
        font-size: 12px;
        padding: 5px 10px;
    }
}

@media (min-width: 768px) {
    body {
        font-size: 16px;
    }
    
    .container {
        max-width: 1024px;
        margin-left: auto;
        margin-right: auto;
    }
    
    #deals-container {
        gap: 20px;
    }
    
    .product-image-wrapper {
        aspect-ratio: 4 / 3;
    }
    
    .product-card .p-5 {
        padding: 16px;
        gap: 10px;
    }
    
    .product-card h4 {
        font-size: 15px;
        min-height: 42px;
    }
    
    .product-card .text-xl {
        font-size: 18px;
    }
    
    .product-card a {
        font-size: 14px;
        padding: 10px 20px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1280px;
    }
    
    #deals-container {
        gap: 24px;
        max-width: 1280px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .product-image-wrapper {
        aspect-ratio: 1 / 1;
    }
    
    .product-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    }
    
    .dark .product-card:hover {
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    }
    
    header .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    .category-tab {
        font-size: 15px;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1400px;
    }
    
    #deals-container {
        max-width: 1400px;
        gap: 28px;
    }
}

@media (min-width: 1536px) {
    .container {
        max-width: 1536px;
    }
    
    #deals-container {
        max-width: 1536px;
    }
}

/* Ensure images never break layout */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

#deals-container > * {
    min-width: 0;
    max-width: 100%;
}

html {
    scroll-behavior: smooth;
}

.dark .telegram-fab {
    background: linear-gradient(135deg, #38a1f3, #0088cc);
    box-shadow: 0 4px 16px rgba(56, 161, 243, 0.5);
}

/* Smooth transitions */
* {
    transition-property: background-color, border-color, color;
    transition-duration: 200ms;
    transition-timing-function: ease-in-out;
}
