/*
 * eBay‑Style Header – E‑FLOUR (mobile inline search, hamburger, dark mode)
 */
.eflour-above-header {
    background: #f5f5f5;
    border-bottom: 1px solid #e5e5e5;
    font-size: 0.75rem;
    padding: 6px 0;
}
.above-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #333;
}
.above-header-left, .above-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}
.above-header-left a, .above-header-right a {
    color: #333;
    text-decoration: none;
}
.above-header-left a:hover, .above-header-right a:hover {
    color: #c59b27;
    text-decoration: underline;
}
.welcome-text a { font-weight: 600; }

/* Theme toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #333;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.theme-toggle .fa-sun { display: none; }

/* ---------- Main Header ---------- */
.eflour-main-header {
    background: #fff;
    padding: 12px 0;
    border-bottom: 1px solid #e5e5e5;
}
.main-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.site-logo img { max-height: 40px; width: auto; }

/* Desktop search */
.header-search.desktop-search {
    flex: 1;
    max-width: 750px;
    margin: 0 30px;
}
.header-search form {
    display: flex;
    border: 2px solid #c59b27;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}
.search-category-select select {
    border: none;
    padding: 10px 12px;
    background: #f8f8f8;
    color: #555;
    font-size: 0.85rem;
    border-right: 1px solid #ccc;
    outline: none;
    min-width: 140px;
    cursor: pointer;
}
.header-search input[type="search"] {
    flex: 1;
    border: none;
    padding: 10px 15px;
    font-size: 0.95rem;
    outline: none;
    min-width: 150px;
}
.header-search button {
    background: #c59b27;
    color: #fff;
    border: none;
    padding: 0 25px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.2s;
}
.header-search button:hover { background: #a6821f; }

/* User icons */
.header-icons {
    display: flex;
    align-items: center;
    gap: 16px;
}
.icon-link {
    color: #333;
    font-size: 1.4rem;
    position: relative;
    text-decoration: none;
    transition: color 0.2s;
}
.icon-link:hover { color: #c59b27; }
.cart-count {
    position: absolute;
    top: -8px; right: -12px;
    background: #dd1e31;
    color: #fff;
    border-radius: 50%;
    width: 20px; height: 20px;
    font-size: 0.7rem;
    text-align: center;
    line-height: 20px;
    font-weight: 700;
}

/* Mobile toggles/hamburger */
.mobile-menu-toggle {
    background: none;
    border: none;
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 4px;
    cursor: pointer;
}
.mobile-menu-toggle .toggle-bar {
    width: 22px;
    height: 2px;
    background: #333;
    border-radius: 2px;
}

/* Mobile inline search */
.mobile-search-inline {
    display: none;
    flex: 1;
    max-width: 60%;
}
.mobile-search-inline form {
    display: flex;
    border: 1px solid #c59b27;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}
.mobile-search-inline input {
    flex: 1;
    border: none;
    padding: 8px 10px;
    font-size: 0.85rem;
    outline: none;
}
.mobile-search-inline button {
    background: #c59b27;
    color: #fff;
    border: none;
    padding: 0 12px;
    cursor: pointer;
}

/* ---------- Below Header ---------- */
.eflour-below-header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
}
.desktop-categories { display: block; }
.categories-menu {
    display: flex;
    list-style: none;
    margin: 0; padding: 0;
    justify-content: space-between;
    overflow-x: auto;
}
.categories-menu li a {
    display: block;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}
.categories-menu li a:hover {
    color: #c59b27;
    border-bottom-color: #c59b27;
}

/* Mobile bottom nav */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; width: 100%;
    background: #fff;
    border-top: 1px solid #e5e5e5;
    justify-content: space-around;
    padding: 6px 0 8px;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #777;
    text-decoration: none;
    font-size: 0.68rem;
    position: relative;
}
.mobile-bottom-nav .nav-item.active { color: #c59b27; }
.mobile-bottom-nav .nav-item i { font-size: 1.3rem; margin-bottom: 2px; }
.cart-nav-item .cart-count-mobile {
    position: absolute;
    top: -6px; right: -8px;
    background: #dd1e31;
    color: #fff;
    border-radius: 50%;
    width: 18px; height: 18px;
    font-size: 0.6rem;
    text-align: center;
    line-height: 18px;
    font-weight: 700;
}

.mobile-category-dropdown {
    position: fixed;
    bottom: 60px; left: 0; width: 100%;
    background: #fff;
    padding: 15px 20px;
    border-top: 1px solid #eee;
    z-index: 999;
    max-height: 50vh;
    overflow-y: auto;
}
.mobile-cat-list { list-style: none; margin: 0; padding: 0; }
.mobile-cat-list li a {
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    text-decoration: none;
    font-size: 0.95rem;
}
.mobile-cat-list li a:hover { color: #c59b27; }

/* Admin modal */
.admin-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.admin-modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); }
.admin-modal-content {
    position: relative;
    background: #fff;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    z-index: 2;
    font-family: 'Poppins', sans-serif;
}
.admin-modal-content h3 { margin: 0 0 20px; font-size: 1.5rem; color: #1b3022; }
.admin-modal-content label { display: block; font-weight: 600; margin: 15px 0 5px; color: #333; }
.admin-modal-content input, .admin-modal-content select { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 1rem; box-sizing: border-box; }
.admin-modal-buttons { display: flex; gap: 12px; justify-content: flex-end; margin-top: 25px; }
.btn-save { background: #4caf50; color: #fff; border: none; padding: 12px 24px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.btn-save:hover { background: #388e3c; }
.btn-cancel { background: #eee; color: #333; border: none; padding: 12px 24px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.btn-cancel:hover { background: #ddd; }

/* ---------- Responsive ---------- */
@media (min-width: 992px) {
    .desktop-only { display: inline-block; }
    .mobile-only { display: none !important; }
    .mobile-search-inline, .mobile-menu-toggle, .mobile-bottom-nav, .mobile-category-dropdown { display: none !important; }
}

@media (max-width: 991px) {
    .eflour-above-header { font-size: 0.65rem; padding: 4px 0; }
    .above-header-inner { gap: 10px; }
    .site-logo img { max-height: 32px; }
    .header-search.desktop-search { max-width: 400px; margin: 0 15px; }
    .search-category-select select { padding: 8px 10px; font-size: 0.8rem; min-width: 110px; }
    .header-search input[type="search"] { padding: 8px 12px; font-size: 0.85rem; }
    .header-search button { padding: 0 20px; font-size: 1rem; }
    .header-icons { gap: 12px; }
    .icon-link { font-size: 1.2rem; }
    .categories-menu li a { padding: 8px 12px; font-size: 0.78rem; }
}

@media (max-width: 767px) {
    .eflour-above-header { font-size: 0.6rem; padding: 3px 0; }
    .above-header-inner { gap: 5px; }
    .desktop-only { display: none !important; }
    .site-logo { display: none; }
    .header-search.desktop-search { display: none; }

    /* Show mobile hamburger and inline search */
    .mobile-menu-toggle { display: flex; }
    .mobile-search-inline { display: block; flex: 1; max-width: 65%; }

    .main-header-inner {
        flex-wrap: nowrap;
        gap: 8px;
    }
    .header-icons { gap: 10px; }
    .icon-link { font-size: 1.2rem; }
    .cart-count { width: 16px; height: 16px; font-size: 0.6rem; line-height: 16px; top: -4px; right: -6px; }

    .mobile-bottom-nav { display: flex; }
    body { padding-bottom: 70px; }

    .mobile-category-dropdown.active { display: block; }
}

/* ---------- Dark mode overrides ---------- */
body.dark-mode .eflour-above-header,
body.dark-mode .eflour-main-header,
body.dark-mode .eflour-below-header,
body.dark-mode .mobile-bottom-nav {
    background: #1a1a1a;
    color: #eee;
    border-color: #333;
}
body.dark-mode .above-header-inner a,
body.dark-mode .categories-menu li a,
body.dark-mode .icon-link {
    color: #eee;
}
body.dark-mode .above-header-inner a:hover,
body.dark-mode .categories-menu li a:hover,
body.dark-mode .icon-link:hover {
    color: #c59b27;
}
body.dark-mode .mobile-menu-toggle .toggle-bar {
    background: #eee;
}
body.dark-mode .header-search form,
body.dark-mode .mobile-search-inline form {
    border-color: #c59b27;
    background: #2a2a2a;
}
body.dark-mode .header-search input,
body.dark-mode .mobile-search-inline input {
    background: #2a2a2a;
    color: #eee;
}
body.dark-mode .site-logo img { filter: brightness(0) invert(1); }
body.dark-mode .theme-toggle { color: #eee; }
body.dark-mode .theme-toggle .fa-moon { display: none; }
body.dark-mode .theme-toggle .fa-sun { display: inline; }