:root {
    --premium-bg: #f5f5f7;
    --premium-card-bg: #ffffff;
    --premium-text: #1d1d1f;
    --premium-text-secondary: #515154;
    --premium-primary: #0d6efd;
    --premium-border: #d2d2d7;
    --premium-danger: #dc3545;
    --premium-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --skeleton-color: #e9e9ed;
}

/* --- Base Styles --- */

body#page-index-premium {
    background-color: var(--premium-bg);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
}

.premium-main {
    padding-top: 2rem;
}

.premium-section {
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--premium-text);
    text-align: center;
    margin-bottom: 2rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ==========================================================================
   Premium Header Styles - COMPLETE REDESIGN
   ========================================================================== */

.premium-header {
    background-color: #ffffff;
    padding: 1rem 0;
    border-bottom: 1px solid var(--premium-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.premium-header .logo {
    flex-shrink: 0;
}

.premium-header .logo img {
    height: 40px;
    display: block;
}

.premium-search-container {
    display: flex;
    align-items: center;
    flex-grow: 1;
    max-width: 600px;
    background-color: var(--premium-bg);
    border-radius: 999px;
    border: 1px solid transparent;
    transition: all 0.2s ease-in-out;
    position: relative; /* ✅ ADDED: This is crucial for positioning the dropdown */
}

.premium-search-container:focus-within {
    border-color: var(--premium-primary);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.2);
}

.premium-search-container .search-icon {
    padding-left: 1.2rem;
    color: var(--premium-text-secondary);
}

.premium-search-container input {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
}

.premium-nav-icons {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.premium-nav-icons .nav-icon {
    position: relative;
    font-size: 1.3rem;
    color: var(--premium-text);
    text-decoration: none;
    transition: color 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.premium-nav-icons .nav-icon:hover {
    color: var(--premium-primary);
}

.nav-icon-label {
    display: none;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--premium-text);
}

.nav-icon[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: -35px;
    transform: translateX(-50%);
    background-color: var(--premium-text);
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.nav-icon[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

.premium-nav-icons .cart-icon #cartCount {
    position: absolute;
    top: -8px;
    right: -10px;
    background-color: var(--premium-danger);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid #fff;
}

/* --- Hero Section --- */

.hero-section {
    width: 95%;
    max-width: 1400px;
    margin: 1rem auto;
    height: 400px;
    position: relative;
    overflow: hidden;
    background-color: var(--skeleton-color);
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.hero-carousel-slide {
    width: 100%;
    height: 100%;
    position: absolute;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.hero-carousel-slide.active {
    opacity: 1;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.1) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 0 10%;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    max-width: 500px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.hero-subtitle {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.9);
    max-width: 500px;
    margin-top: 0.5rem;
}

/* --- Visual Categories --- */

.visual-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 2rem;
}

.visual-category-item {
    text-align: center;
    text-decoration: none;
    color: var(--premium-text);
    transition: transform 0.2s ease;
}

.visual-category-item:hover {
    transform: translateY(-5px);
}

.visual-category-image-wrapper {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 1rem auto;
    background-color: var(--premium-card-bg);
    box-shadow: var(--premium-shadow);
    border: 1px solid var(--premium-border);
}

.visual-category-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.visual-category-name {
    font-weight: 600;
}

/* --- Product Grid & Cards --- */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.premium-product-card {
    background-color: var(--premium-card-bg);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    box-shadow: var(--premium-shadow);
    border: 1px solid transparent;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
}

.premium-product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
    border-color: var(--premium-primary);
}

.product-image-container {
    aspect-ratio: 1 / 1;
    background-color: #f9f9f9;
    padding: 1rem;
    position: relative;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-info-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--premium-text);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price-container {
    margin-top: auto;
    align-items: baseline;
    gap: 0.001rem;
    flex-wrap: wrap;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--premium-primary);
}

.product-old-price {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--premium-text-secondary);
    text-decoration: line-through;
}

.discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--premium-danger);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 1;
}

/* --- View More Button --- */

.view-more-container {
    text-align: center;
    margin-top: 2rem;
}

.btn-view-more {
    display: inline-block;
    background-color: var(--premium-primary);
    color: #fff;
    padding: 0.875rem 2.5rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.25);
}

.btn-view-more:hover {
    background-color: #0b5ed7;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(13, 110, 253, 0.35);
}

/* --- Local Shop Card --- */

.local-shop-card {
    display: block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    text-decoration: none;
    color: #fff;
    margin-bottom: 3rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.local-shop-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
}

.local-shop-card-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.local-shop-card-content p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    opacity: 0.95;
}

.local-shop-card .btn {
    background-color: #fff;
    color: #667eea;
    padding: 0.875rem 2.5rem;
    border-radius: 999px;
    font-weight: 600;
    display: inline-block;
    transition: all 0.3s ease;
}

.local-shop-card .btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3);
}

/* --- Footer --- */

footer {
    background-color: var(--premium-text);
    color: #fff;
    padding: 2rem 0;
    text-align: center;
}

footer p {
    margin: 0.5rem 0;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #fff;
}

/* --- Skeleton Loaders --- */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .5;
    }
}

.skeleton-hero {
    width: 100%;
    height: 100%;
    background-color: var(--skeleton-color);
    animation: pulse 1.5s infinite;
}

.skeleton-visual-category {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.skeleton-visual-category::before {
    content: '';
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: var(--skeleton-color);
    animation: pulse 1.5s infinite;
    margin-bottom: 1rem;
}

.skeleton-visual-category::after {
    content: '';
    width: 80px;
    height: 20px;
    background-color: var(--skeleton-color);
    animation: pulse 1.5s infinite;
    border-radius: 4px;
}

.skeleton-product-card {
    height: 380px;
    background-color: var(--skeleton-color);
    border-radius: 12px;
    animation: pulse 1.5s infinite;
}

/* --- Responsive Adjustments --- */

@media (max-width: 992px) {
    .premium-search-container {
        max-width: 400px;
    }
    .premium-nav-icons {
        gap: 1rem;
    }
}

@media (max-width: 768px) {

    /* Mobile Header Layout */
    .header-container {
            flex-direction: column;
            gap: 0.75rem;
            /* Space between the top row and the nav icons below */
        }
    
        /* This is the new rule that styles the logo/search bar row */
        .header-top-row {
            display: flex;
            flex-direction: row;
            /* Aligns items horizontally */
            align-items: center;
            /* Vertically centers the logo and search bar */
            gap: 1rem;
            /* Creates space between logo and search bar */
            width: 100%;
            /* Ensures the row takes up the full width */
        }
    
        /* This rule prevents the logo from getting squished */
        .premium-header .logo {
            flex-shrink: 0;
            margin: 0;
        }
    
        /* This rule makes the search bar expand to fill the remaining space */
        .premium-search-container {
            flex-grow: 1;
            margin: 0;
        }
        .premium-nav-icons .nav-icon {
            font-size: 1.2rem;
        }
        .premium-nav-icons {
        width: 100%;
        justify-content: space-around; 
        padding-top: 0.5rem;
        gap: 0.5rem; 
    }
        #clearSearchBtn {
            display: none;
            /* Hidden by default, JS will show it */
            color: var(--premium-text-secondary);
            font-size: 1rem;
            cursor: pointer;
            padding: 0 1rem;
            /* Creates space around the icon */
            transition: color 0.2s ease;
        }
    
        #clearSearchBtn:hover {
            color: var(--premium-text);
        }
    
        /* This class will be added by JS when the input has text */
        .premium-search-container.has-text #clearSearchBtn {
            display: block;
            /* Show the button */
        }
    .nav-icon-label {
        display: block !important;
        font-size: 0.7rem;
        color: var(--premium-text);
    }
    
    .nav-icon[data-tooltip]::after {
        display: none !important;
    }
    
    .premium-nav-icons .cart-icon #cartCount {
        top: -20px;
        right: -21px;
        width: 10px;
        height: 15px;
        font-size: 0.7rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .visual-category-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .visual-category-image-wrapper {
        width: 80px;
        height: 80px;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .local-shop-card {
        padding: 2rem 1rem;
    }
    
    .local-shop-card-content h2 {
        font-size: 1.5rem;
    }
    
    .local-shop-card-content p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .premium-nav-icons .nav-icon {
        font-size: 1.1rem;
    }
    
    .nav-icon-label {
        font-size: 0.65rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}
 
@media (min-width: 769px) {
    /*
     * This "dissolves" the .header-top-row wrapper on PC,
     * allowing the main .header-container's flexbox rules
     * to create the perfect three-column layout.
    */
    .product-old-price {
    font-size: 1.0rem;
    font-weight: 500;
    color: var(--premium-text-secondary);
    text-decoration: line-through;
}
    .premium-product-card .product-name {
        font-size: 1.1rem; /* Increase font size from 1rem to 1.1rem */
        line-height: 1.5;  /* Adjust line height for better spacing */
    }
    #page-index-premium .header-top-row {
        display: contents;
    }
}
/* ======================================================= */
/* ✅ 1. ADDED: PREMIUM PAGE PRELOADER                     */
/* ======================================================= */
.preloader-overlay {
    position: fixed;
    inset: 0;
    background-color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.preloader-overlay .spinner {
    border: 6px solid var(--skeleton-color);
    border-top-color: var(--premium-primary);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    animation: spin 1s ease-in-out infinite;
}

.preloader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ======================================================= */
/* ✅ 2. ADDED: LIVE SEARCH RESULTS DROPDOWN               */
/* ======================================================= */
.live-search-results {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border: 1px solid var(--premium-border);
    max-height: 450px;
    overflow-y: auto;
    z-index: 1100;
}

.live-search-results.show {
    display: block;
}

.live-search-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    border-bottom: 1px solid var(--premium-bg);
    transition: background-color 0.2s ease;
}

.live-search-item:last-child {
    border-bottom: none;
}

.live-search-item:hover {
    background-color: var(--premium-bg);
}

.live-search-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
    background-color: #f9f9f9;
    flex-shrink: 0;
}

.live-search-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.live-search-info .name {
    font-weight: 600;
    color: var(--premium-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-search-info .price {
    font-size: 0.9rem;
    color: var(--premium-primary);
}

.search-no-results {
    padding: 1.5rem;
    text-align: center;
    color: var(--premium-text-secondary);
}