/**
 * AI-FRIENDLY STYLES
 * 
 * This CSS file is organized for easy AI assistant modifications.
 * All visual elements are clearly documented and grouped by functionality.
 * 
 * INSTRUCTIONS FOR AI ASSISTANTS:
 * - Each section is clearly labeled and self-contained
 * - CSS custom properties (variables) are used for easy modifications
 * - Classes follow BEM methodology for consistency
 * - Comments explain the purpose of each style block
 */

/* ==============================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   Modify these to change the entire site appearance
   ============================================== */

:root {
    /* Brand Colors - Change these to update site colors */
    --color-primary: #e74c3c;
    --color-secondary: #2c3e50;
    --color-accent: #f39c12;
    --color-background: #ffffff;
    --color-surface: #f8f9fa;
    
    /* Text Colors */
    --color-text-primary: #2c3e50;
    --color-text-secondary: #7f8c8d;
    --color-text-light: #bdc3c7;
    
    /* Spacing Scale - Consistent spacing throughout site */
    --spacing-xs: 0.5rem;    /* 8px */
    --spacing-sm: 1rem;      /* 16px */
    --spacing-md: 1.5rem;    /* 24px */
    --spacing-lg: 2rem;      /* 32px */
    --spacing-xl: 3rem;      /* 48px */
    --spacing-xxl: 4rem;     /* 64px */
    
    /* Border Radius */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    
    /* Shadows */
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 8px 24px rgba(0, 0, 0, 0.2);
    
    /* Animation */
    --animation-duration: 0.3s;
    --animation-easing: ease-out;
    
    /* Layout */
    --container-max-width: 1200px;
    --grid-gap: var(--spacing-md);
}

/* ==============================================
   PRODUCT GRID LAYOUT
   Controls how products are arranged on the page
   ============================================== */

.shop-grid {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: var(--spacing-lg);
}

.product-category {
    margin-bottom: var(--spacing-xxl);
}

.category-title {
    font-size: 2rem;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--grid-gap);
    justify-items: center;
}

/* Responsive grid adjustments */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: var(--spacing-sm);
    }
}

@media (max-width: 576px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-xs);
    }
}

/* ==============================================
   PRODUCT CARD STYLES
   Individual product appearance and layout
   ============================================== */

.product-card {
    background: var(--color-surface);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-light);
    overflow: hidden;
    transition: all var(--animation-duration) var(--animation-easing);
    max-width: 320px;
    width: 100%;
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

/* Product Image Container */
.product-image-container {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--color-background);
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--animation-duration) var(--animation-easing);
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* Out of Stock Overlay */
.out-of-stock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.out-of-stock-text {
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Product Information */
.product-info {
    padding: var(--spacing-md);
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-sm);
    line-height: 1.4;
    min-height: 2.8rem; /* Ensures consistent card heights */
}

.product-description {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin-bottom: var(--spacing-sm);
}

.product-price {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: var(--spacing-sm);
}

/* Stock Warning */
.stock-warning {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: var(--spacing-sm);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* ==============================================
   SIZE SELECTOR STYLES
   Dropdown for product variants/sizes
   ============================================== */

.size-selector-container {
    margin-bottom: var(--spacing-md);
}

.size-label {
    display: block;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-xs);
    font-size: 0.9rem;
}

.size-select {
    width: 100%;
    padding: var(--spacing-sm);
    border: 2px solid #ddd;
    border-radius: var(--border-radius-sm);
    background: white;
    font-size: 0.9rem;
    transition: border-color var(--animation-duration) var(--animation-easing);
}

.size-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* ==============================================
   BUTTON STYLES
   Add to cart and action buttons
   ============================================== */

.product-actions {
    padding: var(--spacing-md);
    padding-top: 0;
}

.add-to-cart-btn,
.buy-button {
    width: 100%;
    background: var(--color-primary);
    color: white;
    border: none;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--animation-duration) var(--animation-easing);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.add-to-cart-btn:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.add-to-cart-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.out-of-stock-btn {
    width: 100%;
    background: #95a5a6;
    color: white;
    border: none;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: not-allowed;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.button-icon {
    font-size: 1.2rem;
}

/* ==============================================
   LOADING AND ERROR STATES
   Visual feedback during async operations
   ============================================== */

.loading-container {
    text-align: center;
    padding: var(--spacing-xxl);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto var(--spacing-md);
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
}

.error-container {
    text-align: center;
    padding: var(--spacing-xxl);
    background: #fff5f5;
    border-radius: var(--border-radius-md);
    border: 1px solid #fed7d7;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
}

.error-message {
    color: #e53e3e;
    font-size: 1.1rem;
    margin-bottom: var(--spacing-lg);
}

.retry-button {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: background var(--animation-duration) var(--animation-easing);
}

.retry-button:hover {
    background: #c0392b;
}

/* ==============================================
   CART NOTIFICATION STYLES
   Feedback when items are added to cart
   ============================================== */

.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--color-primary);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-medium);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-icon {
    font-size: 1.2rem;
}

.notification-message {
    font-weight: 600;
}

/* ==============================================
   RESPONSIVE DESIGN
   Mobile and tablet optimizations
   ============================================== */

@media (max-width: 768px) {
    :root {
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
        --spacing-xxl: 2.5rem;
    }
    
    .shop-grid {
        padding: var(--spacing-md);
    }
    
    .category-title {
        font-size: 1.5rem;
    }
    
    .product-name {
        font-size: 1rem;
    }
    
    .cart-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        right: 10px;
    }
}

/* ==============================================
   UTILITY CLASSES
   Common visual modifications
   ============================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.hidden { display: none; }
.visible { display: block; }

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/**
 * COMMON AI MODIFICATION PATTERNS:
 * 
 * To change colors:
 * - Modify CSS custom properties in :root section
 * 
 * To change layout:
 * - Adjust .products-grid display properties
 * - Modify .product-card dimensions
 * 
 * To change spacing:
 * - Update --spacing-* variables
 * 
 * To modify animations:
 * - Change transition properties and keyframes
 * 
 * To update responsive behavior:
 * - Modify @media queries and breakpoints
 */