/* 
 * DYNAMIC BEAUTIFUL DUAL THEME UI SYSTEM 
 * Upgraded dynamically matching header shadows.
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #F4F6F9;
    --card-bg: #FFFFFF;
    --text-dark: #121212;
    --text-gray: #6B7280;
    --border-color: #E2E8F0;
    --header-h: 110px; 
    --footer-h: 65px;
    --anim-speed: 0.3s cubic-bezier(0.2, 0, 0, 1);
}

/* ================= THEME 1: WHOLESALE (ORANGE) ================= */
/* User Request: Wholesale uses Orange, Header uses Dark Orange variants */
body.theme-wholesale {
    --hdr-color-1: #9A3300; /* Deep Dark Orange / Rust */
    --hdr-color-2: #E65C00; /* Vibrant Dark Orange */
    
    --accent-color: #FF5E00; /* Bright energetic Orange for buttons/links */
    --accent-light: #FFF0E5;
    
    --btn-text: #FFFFFF;
}

/* ================= THEME 2: AUCTION (CYAN/BLUE) ================= */
/* User Request: Auction uses Cyan, Header uses Dark Cyan variants */
body.theme-auction {
    --hdr-color-1: #003B5C; /* Deep Dark Teal/Cyan */
    --hdr-color-2: #007399; /* Vibrant Ocean Cyan */
    
    --accent-color: #00B4D8; /* Electric Cyan for buttons/links */
    --accent-light: #E0F9FC;
    
    --btn-text: #FFFFFF;
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(var(--footer-h) + env(safe-area-inset-bottom, 20px) + 30px);
}

/* ================= CONDENSED DYNAMIC HEADER ================= */
.app-header {
    position: fixed;
    top: 0; left: 0; width: 100%;
    /* Dynamic Dark Header matching the active theme */
    background: linear-gradient(135deg, var(--hdr-color-1), var(--hdr-color-2));
    padding: calc(env(safe-area-inset-top, 10px) + 10px) 20px 20px 20px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transition: background var(--anim-speed);
}

.header-container {
    max-width: 600px; margin: 0 auto;
    display: flex; flex-direction: column; gap: 14px;
}

.header-top { display: flex; justify-content: space-between; align-items: center; }

/* Profile */
.profile-area { display: flex; align-items: center; gap: 10px; }
.profile-area img {
    width: 38px; height: 38px; 
    border-radius: 50%; object-fit: cover;
    border: 2px solid rgba(255,255,255,0.8);
}
.profile-text { display: flex; flex-direction: column; justify-content: center; }
.profile-text .user-greet { font-size: 0.75rem; color: rgba(255,255,255,0.8); line-height: 1.1; font-weight: 300;}
.profile-text .user-name { font-size: 1.1rem; color: #FFFFFF; font-weight: 600; line-height: 1; margin-top: 3px;}

.header-icons .icon-btn {
    background: transparent; border: none;
    color: #FFFFFF; font-size: 1.25rem;
    position: relative; cursor: pointer;
}
.header-icons .dot {
    position: absolute; top: -1px; right: -2px;
    width: 8px; height: 8px; 
    background: var(--card-bg); /* Clean white dot */
    border-radius: 50%;
}

/* Search Box */
.adv-search-box {
    background-color: #FFFFFF;
    height: 44px;
    border-radius: 10px; 
    display: flex; align-items: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.25);
    overflow: hidden; 
}
.search-main { flex: 1; display: flex; align-items: center; padding-left: 14px; }
.search-main i.search-ic { color: var(--text-gray); font-size: 0.95rem; }
.search-main input {
    flex: 1; border: none; outline: none; background: transparent;
    padding: 0 10px; font-family: inherit; font-size: 0.9rem; color: var(--text-dark);
    font-weight: 500;
}
.search-main input::placeholder { color: #A0ABC0; font-weight: 400;}

.search-tools { display: flex; align-items: center; padding-right: 6px; }
.divider { width: 1px; height: 20px; background: var(--border-color); margin: 0 8px; }

.filter-btn, .mic-btn-top {
    background: var(--bg-main); width: 32px; height: 32px;
    border-radius: 8px; border: none;
    color: var(--hdr-color-1); font-size: 0.95rem; 
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; transition: color var(--anim-speed);
}
.filter-btn:hover, .mic-btn-top:hover { color: var(--accent-color); }

/* ================= MAIN CONTENT ================= */
.main-area {
    max-width: 600px;
    margin: 0 auto;
    padding: 6px 4px;
}

/* ================= DESKTOP/LAPTOP RESPONSIVE DESIGN ================= */
@media (min-width: 1024px) {
    body {
        padding-bottom: 40px !important;
    }
    .app-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
        border-radius: 0 0 16px 16px;
        padding: 12px 24px 16px 24px;
    }
    .header-container {
        max-width: 1280px !important;
        margin: 0 auto;
        width: 100%;
    }
    .main-area, .container {
        max-width: 1280px !important;
        margin: 0 auto;
        width: 100%;
        padding: 24px 20px;
    }
    .app-footer {
        display: none !important;
    }
    .card-list, .products-grid, .wholesale-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
        gap: 24px !important;
    }
    
    .nav-grid {
        max-width: 1200px;
    }
    
    /* Grid layout for cards on desktop */
    .card-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 20px;
    }
    
    /* Categories bar for desktop */
    .categories-bar {
        flex-wrap: wrap;
        gap: 12px;
        padding-bottom: 10px;
    }
    
    .cat-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    /* Tab container for desktop */
    .tab-container {
        max-width: 400px;
        margin: 0 auto 30px;
    }
    
    /* Section headers for desktop */
    .sec-header h2 {
        font-size: 1.3rem;
    }
    
    .sec-header a {
        font-size: 0.9rem;
    }
    
    /* Item cards for desktop */
    .item-card {
        padding: 16px;
        gap: 18px;
    }
    
    .item-img {
        width: 120px;
        height: 120px;
    }
    
    .item-info h3 {
        font-size: 1.05rem;
    }
    
    .item-info p.details {
        font-size: 0.85rem;
    }
    
    .price-box .price {
        font-size: 1.2rem;
    }
    
    .action-sm {
        padding: 9px 18px;
        font-size: 0.85rem;
    }
}

/* ================= TABLET RESPONSIVE DESIGN ================= */
@media (min-width: 768px) and (max-width: 1023px) {
    .app-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
        border-radius: 0 0 14px 14px;
        padding: 10px 18px 14px 18px;
    }
    .header-container {
        max-width: 960px !important;
        margin: 0 auto;
        width: 100%;
    }
    .main-area, .container {
        max-width: 960px !important;
        margin: 0 auto;
        width: 100%;
        padding: 16px;
    }
    .card-list, .products-grid, .wholesale-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 18px !important;
    }
    
    .nav-grid {
        max-width: 900px;
    }
    
    .card-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 18px;
    }
    
    .categories-bar {
        flex-wrap: wrap;
        gap: 11px;
    }
    
    .cat-btn {
        padding: 9px 18px;
        font-size: 0.875rem;
    }
}

/* Flat Tabs */
.tab-container {
    display: flex; position: relative;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 25px;
}
.tab-btn {
    flex: 1; background: none; border: none;
    padding: 12px 0; font-family: inherit; font-size: 1rem; font-weight: 600;
    color: var(--text-gray); cursor: pointer;
    transition: color var(--anim-speed);
}
.tab-btn.active { color: var(--accent-color); }

.tab-indicator {
    position: absolute; bottom: -2px; left: 0;
    width: 50%; height: 3px; background: var(--accent-color); 
    border-radius: 3px 3px 0 0;
    transition: transform var(--anim-speed), background var(--anim-speed);
}
.tab-indicator.move-right { transform: translateX(100%); }

.view-section { display: none; opacity: 0; animation: gentleFade 0.3s forwards;}
.view-section.active { display: block; }
@keyframes gentleFade { to { opacity: 1; transform: translateY(0); } }

/* ================= WELCOME SECTION ================= */
.welcome-section {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
}

.welcome-section h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.welcome-section p {
    font-size: 1.1rem;
    color: var(--text-gray);
    font-weight: 400;
}

/* ================= BACK BUTTON ================= */
.back-btn {
    background: var(--bg-main);
    color: var(--text-gray);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 20px;
    font-weight: 600;
    transition: all var(--anim-speed);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
}

.back-btn:hover {
    background: var(--accent-color);
    color: var(--btn-text);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.back-btn i {
    font-size: 0.9rem;
}

/* ================= CATEGORIES (WHOLESALE ONLY) ================= */
.categories-bar {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 5px; 
    margin-bottom: 20px;
}
.categories-bar::-webkit-scrollbar { display: none; }

.cat-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-gray);
    font-size: 0.85rem; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: all var(--anim-speed);
    display: flex; align-items: center; gap: 6px;
}

.cat-btn i {
    font-size: 0.9rem;
    transition: transform var(--anim-speed);
}

.cat-btn:hover i {
    transform: scale(1.1);
}
.cat-btn.active {
    background: var(--accent-color);
    color: var(--btn-text);
    border-color: var(--accent-color);
}


/* ================= CARDS ================= */
.sec-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.sec-header h2 { font-size: 1.15rem; font-weight: 700; color: var(--text-dark); }
.sec-header a { font-size: 0.85rem; font-weight: 600; font-family: inherit; color: var(--accent-color); text-decoration: none;}

.card-list { display: flex; flex-direction: column; gap: 16px; }
.item-card {
    background: var(--card-bg); border-radius: 14px;
    display: flex; padding: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.03); gap: 15px;
}
.item-img {
    width: 105px; height: 105px; border-radius: 10px; flex-shrink: 0;
    background: #E2E8F0; position: relative; overflow: hidden;
}
.item-img img { width: 100%; height: 100%; object-fit: cover; }
.status-tag {
    position: absolute; top: 0; left: 0; width: 100%;
    background: rgba(0,0,0,0.65); color: #FFF; font-size: 0.65rem;
    text-align: center; padding: 4px 0; font-weight: 600;
    backdrop-filter: blur(4px);
}
.theme-icon { color: var(--accent-color); }

.item-info { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.item-info h3 { font-size: 0.95rem; font-weight: 600; color: var(--text-dark); margin-bottom: 4px; line-height: 1.3;}
.item-info p.details { font-size: 0.8rem; color: var(--text-gray); margin-bottom: 12px; font-weight: 500;}

.price-box { display: flex; justify-content: space-between; align-items: center; }
.price-box .price { font-size: 1.1rem; font-weight: 700; color: var(--accent-color); } 

.action-sm {
    border: none; padding: 7px 14px;
    border-radius: 8px; font-weight: 600; font-family: inherit; font-size: 0.8rem;
    cursor: pointer; transition: transform 0.1s;
}
.action-sm:active { transform: scale(0.95); }
.action-sm.primary-fill {
    background: var(--accent-color);
    color: var(--btn-text);
}

/* ================= DYNAMIC HIGHLIGHT FOOTERS ================= */
.footer-module { display: none; }
.footer-module.active { display: block; }

.app-footer {
    position: fixed; bottom: 0; left: 0; width: 100%;
    background: #FFFFFF;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.06);
    z-index: 1000; 
    padding-bottom: env(safe-area-inset-bottom, 15px);
    border-top-left-radius: 20px; border-top-right-radius: 20px;
}

.nav-grid {
    display: flex; justify-content: space-between; align-items: center;
    max-width: 600px; margin: 0 auto; height: var(--footer-h);
    padding: 0 10px;
}

.nav-itm {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    flex: 1; color: #9CA3AF; text-decoration: none;
    font-size: 0.7rem; font-weight: 500; gap: 6px; border: none; background: transparent; cursor: pointer;
    transition: color var(--anim-speed);
}
.nav-itm i { font-size: 1.35rem; transition: transform var(--anim-speed); }

.nav-itm.active { color: var(--accent-color); font-weight: 700; }
.nav-itm.active i { transform: translateY(-3px); }

.badge-rel { position: relative; }
.bag-count {
    position: absolute; top: -6px; right: -8px;
    background: var(--accent-color); color: var(--btn-text);
    font-size: 0.6rem; font-weight: 700; border-radius: 10px; padding: 1px 5px;
}

@media (min-width: 601px) and (max-width: 767px) {
    .app-header { left: 50%; transform: translateX(-50%); max-width: 600px; border-radius: 0 0 20px 20px; }
    .app-footer { left: 50%; transform: translateX(-50%); max-width: 600px; }
}

/* ================= DESKTOP NAV BAR STYLING ================= */
.desktop-nav-wrapper {
    display: none !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin-top: 6px;
    width: 100%;
}
@media (min-width: 1024px) {
    .desktop-nav-wrapper {
        display: flex !important;
    }
}
.desktop-brand .brand-link {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}
.desktop-nav-menu {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.desktop-nav-item {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 20px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.desktop-nav-item:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: translateY(-1px);
}
.desktop-nav-item.active {
    background: #ffffff;
    color: var(--accent-color, #ff5e00) !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}


/* ================= RESPONSIVE PAGINATION ================= */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0 2.5rem;
    width: 100%;
}
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.page-link:hover:not(.active):not(.disabled) {
    background: var(--accent-light, #fff0e5);
    color: var(--accent-color, #ff5e00);
    border-color: var(--accent-color, #ff5e00);
    transform: translateY(-1px);
}
.page-link.active {
    background: var(--accent-color, #ff5e00);
    color: #ffffff !important;
    border-color: var(--accent-color, #ff5e00);
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(249, 115, 22, 0.3);
}
.page-link.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    background: #f1f5f9;
}
