/**
 * MV Styles Interior Furniture - Premium E-Commerce Styles
 * Modern, mobile-first furniture store design
 * 
 * Features:
 * - CSS Variables for easy customization
 * - Mobile-first responsive design
 * - Smooth animations and transitions
 * - Product cards with badges and hover effects
 * - Category cards
 * - Premium typography and spacing
 */

/* ==========================================
   CSS VARIABLES
   ========================================== */

:root {
    /* Brand Colors - Luxury Neutral Palette */
    --color-primary: #2C2826;
    --color-primary-light: #4A4644;
    --color-primary-dark: #1A1816;
    --color-secondary: #8B8680;
    --color-accent: #D4A574;            /* Warm gold */
    
    /* UI Colors */
    --color-success: #4A7C59;
    --color-warning: #D4A574;
    --color-danger: #C84B3B;
    --color-info: #8B8680;
    
    /* Neutral Colors */
    --color-white: #FFFFFF;
    --color-light-gray: #F5F1ED;
    --color-gray: #A39E9A;
    --color-dark-gray: #6B6662;
    --color-black: #2C2826;
    
    /* Text Colors */
    --color-text: #2C2826;
    --color-text-light: #6B6662;
    --color-text-dark: #1A1816;
    
    /* Background Colors */
    --color-bg: #FFFFFF;
    --color-bg-light: #F5F1ED;
    --color-bg-dark: #E8E4DF;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
    --shadow-xl: 0 12px 24px rgba(0,0,0,0.2);
    
    /* Spacing */
    --spacing-xs: 0.25rem;    /* 4px */
    --spacing-sm: 0.5rem;     /* 8px */
    --spacing-md: 1rem;       /* 16px */
    --spacing-lg: 1.5rem;     /* 24px */
    --spacing-xl: 2rem;       /* 32px */
    --spacing-2xl: 3rem;      /* 48px */
    --spacing-3xl: 4rem;      /* 64px */
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 50px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 0.75rem;   /* 12px */
    --font-size-sm: 0.875rem;  /* 14px */
    --font-size-base: 1rem;    /* 16px */
    --font-size-lg: 1.125rem;  /* 18px */
    --font-size-xl: 1.25rem;   /* 20px */
    --font-size-2xl: 1.5rem;   /* 24px */
    --font-size-3xl: 1.875rem; /* 30px */
    --font-size-4xl: 2.25rem;  /* 36px */
    
    /* Container Widths */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
}


/* ==========================================
   GLOBAL STYLES
   ========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary);
}


/* ==========================================
   CONTAINER & LAYOUT
   ========================================== */

.container {
    width: 100%;
    max-width: var(--container-xl);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.section {
    padding: var(--spacing-xl) 0;
}

.section-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--color-text-dark);
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.section-subtitle {
    font-size: var(--font-size-lg);
    color: var(--color-text-light);
    margin-bottom: var(--spacing-2xl);
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}


/* ==========================================
   PRODUCT GRID - REFINED MINIMAL DESIGN
   Desktop: 4 columns | Tablet: 3 columns | Mobile: 2 columns
   ========================================== */

/* Mobile default (< 480px) - 2 columns */
.grid,
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
    padding: 0;
}

/* Category grid - 1 column on mobile */
.grid.categories-grid {
    grid-template-columns: 1fr;
}

/* Larger phones (480px+) - 3 columns */
@media (min-width: 480px) {
    .grid,
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }
    
    .grid.categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablets (768px+) - 3 columns with better spacing */
@media (min-width: 768px) {
    .grid,
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
    
    .grid.categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Desktop (1024px+) - 4 columns */
@media (min-width: 1024px) {
    .grid,
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 22px;
    }
    
    .grid.categories-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}


/* ==========================================
   REFINED PRODUCT CARD - PREMIUM DESIGN
   ========================================== */

.product-card {
    display: block;
    background: var(--color-background);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(44, 40, 38, 0.08);
    transition: all var(--transition-base);
    text-decoration: none;
    color: inherit;
    height: 100%; /* Equal height cards */
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: 0 4px 12px rgba(44, 40, 38, 0.15);
    transform: translateY(-3px);
}

/* Image Container - Optimized Aspect Ratio */
.product-card__image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 square - clean and consistent */
    min-height: 200px; /* Fallback for older browsers */
    background: var(--color-surface);
    overflow: hidden;
}

.product-card__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform var(--transition-slow);
    display: block;
    background-color: #f5f5f5;
}

.product-card:hover .product-card__image {
    transform: scale(1.06);
}

/* Badge - Top Right Corner */
.product-card__badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
}

.badge {
    display: inline-block;
    padding: 5px 11px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    line-height: 1.2;
    box-shadow: var(--shadow-sm);
}

.badge--sale {
    background: var(--color-error);
    color: var(--color-background);
}

.badge--featured {
    background: var(--color-warning);
    color: var(--color-text);
}

.badge--sold-out {
    background: rgba(44, 40, 38, 0.85);
    color: var(--color-background);
}

/* Wishlist Heart Button - Always Visible */
.wishlist-heart-btn {
    transition: all 0.3s ease;
}

.wishlist-heart-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3) !important;
    border-color: #e74c3c !important;
}

.wishlist-heart-btn:active {
    transform: scale(0.95) !important;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.2); }
    50% { transform: scale(1.1); }
    75% { transform: scale(1.15); }
}

/* Product Info Section - Precise Spacing */
.product-card__info {
    padding: 14px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (min-width: 768px) {
    .product-card__info {
        padding: 16px;
        gap: 10px;
    }
}

@media (min-width: 1024px) {
    .product-card__info {
        padding: 18px;
        gap: 12px;
    }
}

/* Product Name - Typography Refinement */
.product-card__name {
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-tight);
    color: var(--color-text);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.5em; /* Reserve space for 2 lines */
}

@media (min-width: 768px) {
    .product-card__name {
        font-size: 15px;
        min-height: 2.5em;
    }
}

@media (min-width: 1024px) {
    .product-card__name {
        font-size: 15px;
    }
}

/* Price Section - Brand Color */
.product-card__price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto; /* Push to bottom */
}

.product-card__price--current {
    font-family: var(--font-primary);
    font-size: 17px;
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    letter-spacing: -0.02em;
}

@media (min-width: 768px) {
    .product-card__price--current {
        font-size: 18px;
    }
}

@media (min-width: 1024px) {
    .product-card__price--current {
        font-size: 19px;
    }
}

.product-card__price--old {
    font-size: 13px;
    font-weight: var(--font-weight-normal);
    color: var(--color-text-lighter);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

@media (min-width: 768px) {
    .product-card__price--old {
        font-size: 14px;
    }
}


/* ==========================================
   LAZY LOADING OPTIMIZATION
   ========================================== */

/* Placeholder while image loads */
.product-card__image[loading="lazy"] {
    background: linear-gradient(
        90deg,
        var(--color-surface) 0%,
        var(--color-surface-alt) 50%,
        var(--color-surface) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Prevent layout shift during loading */
.product-card__image-wrapper::before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-surface);
    z-index: 0;
}

.product-card__image {
    z-index: 1;
}


.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn--primary {
    background: var(--color-primary);
    color: var(--color-white);
}

.btn--primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn--secondary {
    background: var(--color-white);
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn--secondary:hover {
    background: var(--color-primary);
    color: var(--color-white);
}

.btn--block {
    width: 100%;
}


/* ==========================================
   CATEGORY CARD
   ========================================== */

.category-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 10px 20px rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    text-decoration: none;
    display: block;
    transform: perspective(1000px) translateZ(0);
    transform-style: preserve-3d;
}

.category-card:hover {
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.12), 0 20px 40px rgba(0, 0, 0, 0.08);
    transform: perspective(1000px) translateY(-10px) translateZ(30px) scale(1.02);
}

.category-card__icon {.category-card__icon {
    font-size: var(--font-size-4xl);
    margin-bottom: var(--spacing-md);
}

.category-card__title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-text-dark);
    margin-bottom: var(--spacing-sm);
}

.category-card__description {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    margin-bottom: var(--spacing-md);
}

.category-card__link {
    display: inline-flex;
    align-items: center;
    font-size: var(--font-size-sm);
    color: var(--color-accent);
    font-weight: 600;
}

.category-card__link::after {
    content: '→';
    margin-left: var(--spacing-sm);
    transition: transform var(--transition-fast);
}

.category-card:hover .category-card__link::after {
    transform: translateX(4px);
}


/* ==========================================
   HERO SECTION
   ========================================== */

.hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: var(--color-white);
    padding: var(--spacing-3xl) 0;
    text-align: center;
}

.hero__title {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    margin-bottom: var(--spacing-md);
}

.hero__subtitle {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-xl);
    opacity: 0.9;
}

.hero__cta {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-lg) var(--spacing-2xl);
    background: var(--color-secondary);
    color: var(--color-white);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-lg);
    font-weight: 600;
    cursor: pointer;
    position: relative;
    z-index: 10;
    pointer-events: auto;
    transition: all var(--transition-base);
}

.hero__cta:hover {
    background: #d35400;
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}


/* ==========================================
   FILTERS & SEARCH
   ========================================== */

.filters {
    background: var(--color-white);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
}

.filters__row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box__input {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--color-bg-dark);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    transition: border-color var(--transition-fast);
}

.search-box__input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.filter-select {
    padding: var(--spacing-md);
    border: 2px solid var(--color-bg-dark);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    background: var(--color-white);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.filter-select:focus {
    outline: none;
    border-color: var(--color-accent);
}


/* ==========================================
   BREADCRUMB
   ========================================== */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
}

.breadcrumb__item {
    color: var(--color-text-light);
}

.breadcrumb__item--active {
    color: var(--color-text);
    font-weight: 600;
}

.breadcrumb__separator {
    color: var(--color-gray);
}


/* ==========================================
   RESPONSIVE UTILITIES
   ========================================== */

/* Hide on mobile */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Hide on tablet and up */
@media (min-width: 768px) {
    .hide-tablet-up {
        display: none !important;
    }
}

/* Hide on desktop */
@media (min-width: 1024px) {
    .hide-desktop {
        display: none !important;
    }
}


/* ==========================================
   ANIMATIONS
   ========================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Stagger animation for grid items */
.grid > * {
    animation: fadeIn 0.5s ease-out backwards;
}

.grid > *:nth-child(1) { animation-delay: 0.1s; }
.grid > *:nth-child(2) { animation-delay: 0.2s; }
.grid > *:nth-child(3) { animation-delay: 0.3s; }
.grid > *:nth-child(4) { animation-delay: 0.4s; }


/* ==========================================
   LAZY LOADING
   ========================================== */

.lazy-image {
    opacity: 0;
    transition: opacity var(--transition-base);
}

.lazy-image.loaded {
    opacity: 1;
}


/* ==========================================
   MOBILE OPTIMIZATIONS
   ========================================== */

/* Enhanced mobile product cards - 3 columns on mobile */
@media (max-width: 768px) {
    /* Force 3-column grid on mobile */
    .grid,
    .products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: var(--spacing-sm);
    }
    
    .product-card {
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
    }
    
    .product-card__image-wrapper {
        padding-top: 100%; /* Square ratio for mobile */
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }
    
    .product-card__content {
        padding: var(--spacing-sm);
    }
    
    .product-card__category {
        font-size: 0.65rem;
        margin-bottom: var(--spacing-xs);
    }
    
    .product-card__title {
        font-size: 0.75rem;
        line-height: 1.2;
        -webkit-line-clamp: 2;
        margin-bottom: var(--spacing-xs);
    }
    
    .product-card__title a {
        font-size: 0.75rem;
    }
    
    .product-card__description {
        display: none; /* Hide description on mobile to save space */
    }
    
    .product-card__features {
        display: none; /* Hide features on mobile */
    }
    
    .product-card__price {
        font-size: var(--font-size-sm);
        font-weight: 700;
    }
    
    .product-card__old-price {
        font-size: 0.65rem;
    }
    
    .product-card__savings {
        font-size: 0.65rem;
        margin-top: 2px;
    }
    
    .product-card__price-wrapper {
        margin-bottom: var(--spacing-xs);
    }
    
    /* Make badges smaller on mobile */
    .badge {
        padding: 2px 6px;
        font-size: 0.6rem;
    }
    
    .product-card__badges {
        top: var(--spacing-xs);
        left: var(--spacing-xs);
        right: var(--spacing-xs);
    }
    
    /* Compact buttons for mobile */
    .product-card__actions {
        flex-direction: column;
        gap: 4px;
    }
    
    .product-card__actions .btn {
        font-size: 0.7rem;
        padding: 6px 8px;
        min-height: auto;
        border-radius: var(--radius-sm);
    }
    
    .btn--block {
        width: 100%;
    }
    
    /* Larger tap targets for critical actions */
    .btn--primary {
        min-height: 36px;
        font-weight: 600;
    }
    
    /* Optimize category cards for mobile */
    .category-card {
        padding: var(--spacing-md);
        border-radius: var(--radius-md);
    }
    
    .category-card__icon {
        font-size: 2rem;
    }
    
    /* Hero section mobile */
    .hero {
        padding: var(--spacing-2xl) var(--spacing-md);
    }
    
    .hero__title {
        font-size: var(--font-size-2xl);
    }
    
    /* Section spacing */
    .section {
        padding: var(--spacing-xl) var(--spacing-sm);
    }
}

/* Very small screens - maintain 3 columns but optimize further */
@media (max-width: 480px) {
    .grid,
    .products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 4px;
    }
    
    .product-card__content {
        padding: 6px;
    }
    
    .product-card__title {
        font-size: 0.7rem;
        margin-bottom: 4px;
    }
    
    .product-card__price {
        font-size: 0.75rem;
    }
    
    .product-card__category {
        font-size: 0.6rem;
    }
    
    .product-card__actions .btn {
        font-size: 0.65rem;
        padding: 5px 6px;
    }
    
    .category-card {
        padding: var(--spacing-sm);
    }
}


/* ==========================================
   ========================================== */

@media print {
    .no-print {
        display: none !important;
    }
    
    .product-card {
        box-shadow: none;
        border: 1px solid var(--color-gray);
        break-inside: avoid;
    }
}
