:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --bg-light: #f8fafc;
}

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

body { 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    background-color: var(--bg-light); 
    color: var(--text-dark); 
    line-height: 1.6; 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* Header */
.header {
    background: #fff;
    padding: 15px 0;
    border-bottom: 1px solid #f1f5f9;
    position: relative; /* Changed from sticky to relative */
    z-index: 1000;
    width: 100%; 
}
.nav { display: flex; justify-content: space-between; align-items: center; gap: 30px; }
.logo { font-size: 2.2rem; font-weight: 800; color: var(--text-dark); text-decoration: none; letter-spacing: -1.5px; display: flex; align-items: center; }
.logo img { height: 36px; width: 36px; border-radius: 8px; margin-right: 12px; object-fit: cover; }
.logo span { color: var(--primary); }

.search-bar { 
    flex-grow: 1; 
    max-width: 350px; /* Slightly wider for better look */
    position: relative; 
    display: flex;
    align-items: center;
} 
.search-bar i { 
    position: absolute; 
    left: 16px; 
    color: #94a3b8; 
    font-size: 14px;
}
.search-bar input { 
    width: 100%; 
    padding: 10px 15px 10px 42px; 
    border-radius: 10px; 
    border: 1px solid #e2e8f0; 
    outline: none; 
    background: #f8fafc; 
    transition: all 0.3s ease; 
    font-size: 14px; 
    font-family: inherit;
}
.search-bar input:focus { 
    border-color: var(--primary); 
    background: #fff; 
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); 
}

main { flex: 1; }

/* Hero Section */
.hero { padding: 80px 0; background: linear-gradient(135deg, #fff 0%, #eff6ff 100%); border-bottom: 1px solid #f1f5f9; text-align: center; }
.hero h1 { 
    font-size: 52px; 
    font-weight: 800; 
    line-height: 1.2; 
    margin-bottom: 24px; 
    letter-spacing: -1px; 
    color: var(--text-dark);
}
.hero p {
    font-size: 20px;
    color: #4b5563;
    max-width: 800px;
    margin: 0 auto;
}
.badge-pill { display: inline-block; background: #dbeafe; color: #2563eb; padding: 6px 16px; border-radius: 50px; font-size: 13px; font-weight: 700; margin-bottom: 20px; text-transform: uppercase; }

/* HOME PAGE PRODUCT GRID */
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; padding: 40px 0; width: 100%; }
.product-card { background: #fff; border-radius: 20px; border: 1px solid #f1f5f9; overflow: hidden; transition: 0.3s; position: relative; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02); display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-5px); box-shadow: 0 20px 25px -5px rgba(0,0,0,0.05); }

.card-badges { position: absolute; top: 15px; right: 15px; display: flex; gap: 5px; z-index: 10; }
.mini-badge { width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: white; }
.mini-badge.w { background: #0071dc; }
.mini-badge.a { background: #ff9900; }

.product-img { height: 250px; padding: 20px; display: flex; align-items: center; justify-content: center; background: #fff; }
.product-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.product-info { padding: 24px; display: flex; flex-direction: column; height: 100%; }
.product-title { 
    font-size: 1.05rem; 
    font-weight: 700; 
    margin-bottom: 12px; 
    color: var(--text-dark); 
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
    overflow: hidden; 
    min-height: 48px; 
    height: auto;
    line-height: 1.4; 
}
.product-price { font-size: 1.6rem; font-weight: 800; color: var(--primary); margin-bottom: 20px; margin-top: auto; }
.view-btn { display: block; text-align: center; background: #2563eb; color: #fff; padding: 12px; border-radius: 12px; text-decoration: none; font-weight: 700; transition: 0.3s; }
.view-btn:hover { background: #1d4ed8; box-shadow: 0 4px 15px rgba(37, 99, 235, 0.2); }

/* PRODUCT DETAIL PAGE */
.detail-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 40px; padding: 40px 0; align-items: start; }

/* Product Detail Title - Normal readable size */
.detail-content h1 {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-dark);
    margin-bottom: 15px;
    letter-spacing: -0.3px;
}
.gallery-container { display: flex; flex-direction: row-reverse; gap: 20px; align-items: flex-start; }
.thumbnails { display: flex; flex-direction: column; gap: 10px; min-width: 64px; }
.thumb-box { width: 64px; height: 64px; border: 1px solid #e2e8f0; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; background: #fff; padding: 4px; }
.thumb-box.active { border-color: var(--primary); }
.thumb-box img { max-width: 100%; max-height: 100%; object-fit: contain; }

.main-img-box { flex-grow: 1; height: 500px; background: #fff; border: 1px solid #f1f5f9; border-radius: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; cursor: zoom-in; }
.main-img-box img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform 0.1s ease-out; }

/* Show More / Specification System */
.specs-wrapper { position: relative; max-height: 200px; overflow: hidden; transition: max-height 0.5s ease; margin-bottom: 10px; }
.specs-wrapper.expanded { max-height: 2000px; }
.specs-overlay { position: absolute; bottom: 0; left: 0; width: 100%; height: 60px; background: linear-gradient(transparent, #fff); }
.specs-wrapper.expanded .specs-overlay { display: none; }
.expand-btn { background: none; border: none; color: #2563eb; font-weight: 700; cursor: pointer; padding: 5px 0; font-size: 14px; }

.price-badge-container { display: flex; gap: 15px; margin-bottom: 20px; flex-wrap: wrap; }
.price-badge { padding: 8px 16px; border-radius: 8px; display: flex; flex-direction: column; min-width: 120px; }
.price-badge.walmart { background: #dbeafe; border: 1px solid #bfdbfe; }
.price-badge.amazon { background: #ffedd5; border: 1px solid #fed7aa; }
.badge-label { font-size: 11px; font-weight: 800; text-transform: uppercase; margin-bottom: 2px; }
.badge-val { font-size: 1.5rem; font-weight: 800; color: var(--primary); }

.buy-now { display: block; width: 100%; padding: 18px; border-radius: 12px; color: white; text-align: center; text-decoration: none; font-weight: 700; font-size: 1.1rem; transition: 0.3s; margin-top: 15px; }

/* UNIVERSAL SEO ARTICLE STYLING (FIXED WIDTH) */
.seo-article, .home-seo-box, .legal-content, .card-box { 
    background: #fff; 
    padding: 50px; 
    border-radius: 24px; 
    border: 1px solid #e2e8f0; 
    margin: 40px auto; 
    text-align: left; 
    max-width: 800px; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
}
.seo-article h2, .home-seo-box h2, .legal-content h2 { font-size: 1.8rem; font-weight: 800; color: var(--text-dark); margin-bottom: 20px; margin-top: 30px; }
.seo-article p, .home-seo-box p, .legal-content p { color: #475569; line-height: 1.8; margin-bottom: 20px; }

/* SEO PAGE MINI CARD GRID */
.seo-page-container { max-width: 1000px; margin: 40px auto; padding: 0 20px; text-align: center; }
.seo-header { margin-bottom: 40px; }
.seo-header h1 { font-size: 3rem; font-weight: 800; margin-bottom: 15px; letter-spacing: -1.5px; }
.seo-header p { color: var(--text-muted); font-size: 1.1rem; max-width: 700px; margin: 0 auto; line-height: 1.6; }
.page-tag { display: inline-block; background: #f5f3ff; color: #6366f1; padding: 6px 16px; border-radius: 50px; font-size: 11px; font-weight: 800; text-transform: uppercase; margin-bottom: 15px; border: 1px solid #e0e7ff; }

.seo-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin: 40px 0; }
.seo-card-grid.two-col { grid-template-columns: 1fr 1fr; }
.seo-box { background: #fff; padding: 40px; border-radius: 24px; border: 1px solid #f1f5f9; text-align: center; }
.seo-box.full-width { grid-column: 1 / -1; text-align: left; }
.seo-box i { font-size: 2rem; color: var(--primary); margin-bottom: 20px; display: block; }

/* Disclaimer Block */
.affiliate-disclaimer { background: #f1f5f9; padding: 25px; border-radius: 15px; font-size: 12px; color: #64748b; margin: 40px auto; max-width: 800px; text-align: left; border: 1px solid #e2e8f0; line-height: 1.6; }

/* Footer */
footer { background: #0f172a; color: #fff; padding: 60px 0; text-align: center; margin-top: auto; width: 100%; }

/* COMPREHENSIVE MOBILE RESPONSIVENESS */
@media (max-width: 767px) {
    .container { padding: 0 !important; }
    
    .header { padding: 5px 0 !important; }

    .nav {
        flex-direction: row !important;
        justify-content: space-between !important;
        padding: 5px 20px !important;
        gap: 10px !important;
    }

    .header-tools {
        gap: 8px !important;
    }

    .search-bar {
        width: 140px !important;
        height: 32px !important;
        padding: 4px 8px !important;
    }

    .search-bar input { 
        font-size: 11px !important; 
        padding-left: 25px !important; 
    }

    .search-bar i { 
        font-size: 11px !important;
        position: absolute !important;
        left: 10px !important;
    }

    .home-text { display: none !important; } /* Hide text on mobile */
    
    .pill-home-btn {
        padding: 0 !important;
        width: 36px !important;
        height: 36px !important;
        justify-content: center !important;
        border-radius: 50% !important;
        flex-shrink: 0 !important;
    }

    .logo { font-size: 1.1rem !important; }
    .logo img { height: 24px !important; width: 24px !important; margin-right: 6px !important; }

    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        padding: 10px 10px !important;
    }

    .product-card { 
        padding: 6px !important; 
        display: flex !important;
        flex-direction: column !important;
        gap: 2px !important;
        height: auto !important; /* Let card grow naturally */
    }
    
    .product-img { 
        height: 85px !important; 
        padding: 5px !important; 
        margin-top: 15px !important; 
    }
    .product-card img { max-height: 75px !important; }

    .product-card h3, .product-title { 
        font-size: 11px !important; 
        height: 60px !important; /* Increased for 4 lines visibility */
        margin: 4px 0 !important; 
        line-height: 1.3 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 4 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }
    .product-price { 
        font-size: 13px !important; 
        margin-bottom: 8px !important; 
        white-space: nowrap !important;
        margin-top: auto !important;
    }
    .view-btn { 
        padding: 6px !important; 
        font-size: 11px !important; 
        border-radius: 8px !important; 
        white-space: nowrap !important;
        display: block !important;
        text-align: center !important;
    }

    .hero h1 { 
        font-size: 40px !important; 
        line-height: 1.2 !important;
        margin: 15px 0 !important;
    }
    
    .article-container { padding: 1.2rem; border-radius: 12px; }
    .article-container h1 { font-size: 1.6rem !important; }
}

@media (max-width: 767px) {
    .container { padding: 0 15px !important; }
    .detail-layout { grid-template-columns: 1fr !important; gap: 15px; padding: 10px 0; }
    
    .gallery-container { flex-direction: column !important; gap: 10px !important; }
    .main-img-box { height: 350px !important; border-radius: 12px; }
    
    .thumbnails { 
        flex-direction: row !important; 
        overflow-x: auto !important; 
        padding: 5px 0 !important; 
        gap: 8px !important; 
        justify-content: flex-start !important;
        scrollbar-width: none; 
    }
    .thumbnails::-webkit-scrollbar { display: none; }
    .thumb-box { 
        width: 60px !important; 
        height: 60px !important; 
        flex-shrink: 0 !important; 
        border-radius: 8px !important;
    }
    
    .detail-content h1 { 
        font-size: 1.2rem !important; 
        font-weight: 700 !important; 
        line-height: 1.3 !important; 
        margin-bottom: 15px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }
    
    .price-badge-container { gap: 8px !important; margin-bottom: 15px !important; }
    .price-badge { min-width: 100px !important; flex: 1 !important; padding: 10px !important; }
    .badge-val { font-size: 1.2rem !important; }
    
    .specs-wrapper { max-height: 150px; }
    .expand-btn { font-size: 13px; }
    .action-group { gap: 8px !important; }
    .buy-now { padding: 14px !important; font-size: 1rem !important; border-radius: 10px !important; }
}

@media (max-width: 480px) {
    .product-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Reviews section mobile fixes */
@media (max-width: 768px) {
    #reviewsContainer {
        margin-top: 30px !important;
        padding-top: 20px !important;
    }
}
