/* Custom Styles for Affiliate Store */

:root {
    /* Color Palette */
    --color-primary: #000000;
    --color-secondary: #ffffff;
    --color-bg: #f5f5f5;
    --color-border: #e0e0e0;
    --color-text: #333333;
    --color-text-secondary: #666666;
    --color-accent: #f0f0f0;
    
    /* Typography */
    --font-base: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-heading: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    
    /* Spacing */
    --space-unit: 8px;
    --space-xs: calc(var(--space-unit) * 0.5);
    --space-sm: var(--space-unit);
    --space-md: calc(var(--space-unit) * 2);
    --space-lg: calc(var(--space-unit) * 3);
    --space-xl: calc(var(--space-unit) * 4);
    
    /* Border Radius */
    --radius-none: 0;
    --radius-sm: 2px;
    --radius-md: 4px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

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

body {
    font-family: var(--font-base);
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-text);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: var(--space-md);
    color: var(--color-text);
}

h1 {
    font-size: 2.5rem;
    font-weight: 300;
}

h2 {
    font-size: 2rem;
    margin-bottom: var(--space-lg);
}

h3 {
    font-size: 1.5rem;
    margin-bottom: var(--space-md);
}

p {
    margin-bottom: var(--space-md);
}

/* Container System */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
    width: 100%;
}

.container-fluid {
    width: 100%;
    padding: 0 var(--space-md);
}

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 calc(-1 * var(--space-sm));
}

[class*="col-"] {
    padding: 0 var(--space-sm);
    margin-bottom: var(--space-md);
}

.col { flex: 1; }
.col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

/* Header & Navigation */
.header {
    background-color: var(--color-secondary);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-sm) 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--space-lg);
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-sm) 0;
    position: relative;
    transition: color var(--transition-fast);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-primary);
    transition: width var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-xs);
}

/* Cart & User Icons */
.nav-icons {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.nav-icon {
    color: var(--color-text);
    font-size: 1.25rem;
    transition: color var(--transition-fast);
    position: relative;
}

.nav-icon:hover {
    color: var(--color-primary);
}

.cart-count {
    position: absolute;
    top: -6px;
    right: -8px;
    background-color: var(--color-primary);
    color: var(--color-secondary);
    font-size: 0.65rem;
    font-weight: 600;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}



/* Filter Section */
.filters {
    background: var(--color-secondary);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-xl);
}

.filter-row {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 180px;
}

.filter-group label {
    font-weight: 500;
    color: var(--color-text);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-none);
    background: var(--color-secondary);
    font-size: 0.95rem;
    color: var(--color-text);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Product Grid */
.products-section {
    padding: var(--space-xl) 0;
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.section-title {
    font-size: 2rem;
    font-weight: 300;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.section-subtitle {
    color: var(--color-text-secondary);
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin: 0 auto;
    max-width: 1400px;
    padding: 0 var(--space-md);
}

.product-card {
    background: var(--color-secondary);
    border: 1px solid var(--color-border);
    overflow: hidden;
    transition: all var(--transition-normal);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 380px; /* Fixed height */
    max-height: 380px; /* Ensure it doesn't exceed 380px */
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.product-image {
    position: relative;
    overflow: hidden;
    padding-top: 100%;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: var(--space-lg);
    transition: transform var(--transition-normal);
}

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

.product-badge {
    position: absolute;
    top: var(--space-sm);
    right: -30px;
    background: var(--color-primary);
    color: var(--color-secondary);
    padding: var(--space-xs) 30px;
    font-size: 0.75rem;
    font-weight: 600;
    transform: rotate(45deg);
    transform-origin: 50% 50%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 120px;
    text-align: center;
    right: -30px;
}

.product-info {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    text-align: center;
    overflow: hidden; /* Prevent content from overflowing */
}

.product-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Limit to 3 lines */
    line-clamp: 3; /* Standard property for future compatibility */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 4.5em; /* Approx 3 lines of text (1.5em per line) */
    line-height: 1.5;
    min-height: 4.5em; /* Ensure minimum height for consistency */
}

.product-description {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 2.5em; /* Approx 2 lines of text */
}

.product-price {
    font-weight: 600;
    color: var(--color-primary);
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

/* Product Card Content */
.product-category {
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-xs);
}

.product-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
    margin: 0 0 var(--space-sm);
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-grow: 1;
}

.product-description {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: var(--space-md);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price-wrapper {
    margin: var(--space-sm) 0;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-primary);
    display: block;
}

.product-original-price {
    text-decoration: line-through;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin-left: var(--space-xs);
}

.product-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    margin: var(--space-sm) 0;
}

.stars {
    color: #ffc107;
    font-size: 0.9rem;
    letter-spacing: 2px;
}

.rating-text {
    color: var(--color-text-secondary);
    font-size: 0.8rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    text-decoration: none;
    line-height: 1.5;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-secondary);
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background-color: #333;
    border-color: #333;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-outline {
    background-color: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-border);
}

.btn-outline:hover {
    background-color: var(--color-bg);
    border-color: var(--color-text);
    color: var(--color-text);
}

/* Product Actions */
.product-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: auto;
    padding-top: var(--space-md);
}

.product-actions .btn {
    flex: 1;
    justify-content: center;
}

.wishlist-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    background: var(--color-secondary);
    color: var(--color-text);
    border-radius: 0;
    transition: all var(--transition-fast);
}

.wishlist-btn:hover, 
.wishlist-btn.active {
    color: #ff4444;
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.05);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-xs);
    margin: var(--space-xl) 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-sm);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    line-height: 1;
}

.pagination a:hover {
    background: var(--color-primary);
    color: var(--color-secondary);
    border-color: var(--color-primary);
}

.pagination .current {
    background: var(--color-primary);
    color: var(--color-secondary);
    border-color: var(--color-primary);
    font-weight: 600;
}

.pagination .page-numbers.dots {
    border: none;
    pointer-events: none;
    min-width: auto;
    padding: 0 var(--space-xs);
}

.pagination .prev,
.pagination .next {
    min-width: auto;
    padding: 0 var(--space-md);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* Footer */
.footer {
    background: var(--color-secondary);
    border-top: 1px solid var(--color-border);
    padding: var(--space-xl) 0 var(--space-md);
    margin-top: var(--space-xl);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.footer-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: var(--space-sm);
}

.footer-links a {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--color-primary);
}

.contact-info {
    list-style: none;
    padding: 0;
    margin: 0;
}

.contact-info li {
    display: flex;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.contact-info i {
    margin-right: var(--space-sm);
    color: var(--color-primary);
    min-width: 20px;
    text-align: center;
}

.social-links {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.social-link:hover {
    background: var(--color-primary);
    color: var(--color-secondary);
    border-color: var(--color-primary);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-lg);
    }
}

@media (max-width: 768px) {
    :root {
        --space-unit: 6px;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0;
        padding: var(--space-md) 0;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-link {
        width: 100%;
        padding: var(--space-sm) 0;
    }
    
    .nav-link::after {
        display: none;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
        max-width: 360px;
        margin: 0 auto;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .pagination {
        gap: 4px;
    }
    
    .pagination a,
    .pagination span {
        min-width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }
    
    .pagination .prev,
    .pagination .next {
        font-size: 0.8rem;
        padding: 0 var(--space-sm);
    }
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: #ecf0f1;
}

.footer-section p,
.footer-section a {
    color: #bdc3c7;
    text-decoration: none;
    line-height: 1.6;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #34495e;
    color: #95a5a6;
}

/* Product Detail Page */
.product-detail {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin: 2rem 0;
}

.product-detail-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    padding: 3rem;
}

.product-gallery {
    position: relative;
}

.main-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.thumbnail {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.thumbnail:hover,
.thumbnail.active {
    opacity: 1;
}

.product-details h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #333;
}

.product-meta {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
}

.meta-value {
    font-size: 1rem;
    color: #333;
}

/* Ad Block Styles */
.ad-block {
    margin: 20px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ad-label {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.ad-content {
    margin: 0 auto;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
}

.ad-placeholder {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.ad-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #6c757d;
    font-size: 12px;
}

.ad-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ad-demo {
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

/* Ad Position Specific Styles */
.ad-header {
    margin: 10px 0;
    padding: 10px 0;
}

.ad-sidebar {
    margin: 20px 0;
    position: sticky;
    top: 100px;
}

.ad-content {
    margin: 30px 0;
}

.ad-footer {
    margin: 20px 0;
    padding: 20px 0;
    border-top: 1px solid #e9ecef;
}

.ad-mobile {
    margin: 15px 0;
}

/* Responsive Ad Styles */
.ad-responsive {
    max-width: 100%;
}

.ad-responsive .ad-content {
    max-width: 100%;
    height: auto;
}

.ad-responsive .ad-content > div {
    max-width: 100%;
    height: auto;
}

/* Ad Size Variations */
.ad-leaderboard {
    max-width: 728px;
}

.ad-rectangle {
    max-width: 300px;
}

.ad-square {
    max-width: 250px;
}

.ad-banner {
    max-width: 468px;
}

.ad-skyscraper {
    max-width: 160px;
}

/* Enhanced Responsive Design Improvements */

/* Additional Breakpoints for Better Responsiveness */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 0 30px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 992px) {
    .navbar {
        padding: 1rem 0;
    }
    
    .search-form {
        max-width: 100%;
    }
    
    .filter-row {
        gap: 1rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    /* Enhanced mobile navigation */
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.5rem;
    }
    
    .nav-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        background: rgba(102, 126, 234, 0.95);
        padding: 1rem;
        gap: 1rem;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        border-radius: 0.5rem;
        margin-top: 1rem;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    /* Improved mobile forms */
    .search-input, .filter-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
    
    /* Better mobile product cards */
    .product-card {
        margin-bottom: 1.5rem;
    }
    
    .product-image {
        height: 200px;
    }
    
    /* Mobile-optimized buttons */
    .btn {
        min-height: 44px; /* Touch-friendly size */
        font-size: 1rem;
    }
    
    /* Improved mobile spacing */
    .section {
        padding: 2rem 0;
    }
    
    /* Mobile Ad Adjustments */
    .ad-leaderboard,
    .ad-rectangle,
    .ad-banner {
        max-width: 100%;
    }
    
    .ad-sidebar {
        position: static;
        margin: 15px 0;
    }
    
    .ad-content {
        margin: 20px 0;
    }
    
    /* Hide desktop ads on mobile */
    .ad-desktop-only {
        display: none;
    }
    
    /* Show mobile-specific ads */
    .ad-mobile-only {
        display: block;
    }
}

@media (min-width: 769px) {
    .ad-mobile-only {
        display: none;
    }
    
    .ad-desktop-only {
        display: block;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 15px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .product-detail-content {
        padding: 1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    /* Stack product actions vertically on very small screens */
    .product-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .product-actions .btn {
        width: 100%;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-link, .product-card {
        min-height: 44px;
    }
    
    .product-card:hover {
        transform: none; /* Disable hover effects on touch devices */
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .product-image {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Print styles */
@media print {
    .navbar, .footer, .filter-section, .pagination {
        display: none;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .product-card {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #ffffff;
        --card-bg: #2d2d2d;
        --border-color: #404040;
    }
    
    body {
        background-color: var(--bg-color);
        color: var(--text-color);
    }
    
    .product-card, .card {
        background-color: var(--card-bg);
        border-color: var(--border-color);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .product-detail-content {
        padding: 1.5rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .pagination {
        flex-wrap: wrap;
    }
}

/* Loading States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 2rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}