/* ==========================================================================
   Millat Mart - Header Stylesheet
   File: /assets/css/header.css
   Loaded on every page via includes/header.php (and admin uses its own
   admin.css, unaffected by this file).

   Contents:
     1. Global theme variables & base reset      (site-wide, defined once
        here because header.php is the first thing every page loads)
     2. Global Bootstrap-component overrides      (site-wide, used by many
        pages: buttons, cards, form focus states, container width)
     3. Header component styles                   (top bar, main header,
        search, nav actions, cart/wishlist badges, sub-nav, mobile drawer)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Global Theme Variables & Base Reset
   -------------------------------------------------------------------------- */
:root {
    --primary-color: #14532d;       /* Deep Forest Green - Header */
    --secondary-color: #1a6b3c;     /* Sub-header Green */
    --footer-bottom-bg: #052e16;    /* Deep Green Footer */
    --accent-yellow: #22c55e;      /* Primary Green Accent */
    --noon-yellow: #4ade80;        /* Bright Green Highlight */
    --text-light: #ffffff;
    --text-muted: #bcd9c8;
    --body-bg: #f5faf6;            /* Soft White / Green-tinted Background */
    --text-color: #132119;         /* High Contrast Dark Text */
    --border-color: #1f4a30;       /* Divider Color (on dark green panels) */
    --card-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

body {
    background-color: var(--body-bg);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* iOS Safari's address/toolbar auto-hides on scroll, which keeps
       recalculating the classic `100vh` unit and is the #1 cause of the
       footer/floating-buttons "jump" glitch on iPhone. `100dvh` (dynamic
       viewport height) tracks the actual visible viewport instead, so
       modern browsers (iOS 16+) get a stable layout with no flicker. */
    min-height: 100dvh;
}

main {
    flex: 1;
}

/* --------------------------------------------------------------------------
   2. Global Bootstrap-Component Overrides (used across many pages)
   -------------------------------------------------------------------------- */
.container {
    max-width: 1200px;
}

.card.shadow-sm {
    border-radius: 10px;
}

.btn-warning {
    background-color: #22c55e;
    border-color: #16a34a;
}

.btn-warning:hover {
    background-color: #15803d;
    border-color: #166534;
}

.form-control:focus,
.form-check-input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

/* NOTE: the original style.css had a second, unscoped `body { ... }` rule
   under a "Custom Product Page Styles" comment. Because it was a bare
   `body` selector (not `.some-product-page-class body`), it actually
   overrode the base body styles above on EVERY page, not just the product
   page - so it's kept here, global, to preserve the site's current look
   exactly. If that override was only ever meant for product.php, move it
   into pages/product.css and scope it to a wrapper class instead. */
body {
    background-color: #f5faf6;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --------------------------------------------------------------------------
   3. Header Component Styles
   -------------------------------------------------------------------------- */

/* Sticky wrapper around the whole header (top bar + main header + sub-nav) */
.site-header-wrapper {
    position: sticky;
    top: 0;
    z-index: 1030; /* Keeps header above all content */
    background-color: #ffffff; /* Prevents transparency issues */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Top Utility Header Bar */
.header-top-bar {
    background-color: #052e16;
    color: var(--text-muted);
    font-size: 12px;
    padding: 4px 0;
    border-bottom: 1px solid #222;
}

.header-top-bar a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

.header-top-bar a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.main-header {
    background-color: var(--primary-color);
    padding: 10px 0;
    color: var(--text-light);
}

/* Logo Styling */
.navbar-brand-text {
    font-size: 22px;
    font-weight: 800;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: -0.5px;
    display: inline-flex;
    align-items: center;
}

.navbar-brand-text span {
    color: var(--noon-yellow);
}

/* Logo image (replaces the old "Millat Mart" text wordmark) */
.site-logo-img {
    height: 42px;
    width: auto;
    display: block;
}

@media (max-width: 767.98px) {
    .site-logo-img {
        height: 40px;
    }
}

/* Amazon / Noon Style Search Bar */
.header-search-form {
    display: flex;
    width: 100%;
}

.header-search-form .category-select {
    max-width: 150px;
    background-color: #f3f3f3;
    border: none;
    border-radius: 4px 0 0 4px;
    font-size: 13px;
    padding-left: 8px;
    cursor: pointer;
}

.header-search-form .search-input {
    border: none;
    border-radius: 0;
    font-size: 14px;
    padding: 8px 12px;
}

.header-search-form .search-input:focus {
    box-shadow: none;
    outline: none;
}

.header-search-form .search-btn {
    background-color: var(--accent-yellow);
    border: none;
    border-radius: 0 4px 4px 0;
    color: #14211a;
    padding: 0 18px;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.header-search-form .search-btn:hover {
    background-color: #16a34a;
}

/* Navigation Links & Action Items */
.header-action-item {
    color: #ffffff;
    text-decoration: none;
    padding: 6px 10px;
    border: 1px solid transparent; /* Keeps layout stable */
    border-radius: 3px;
    display: inline-block;
    transition: border-color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}
.header-action-item:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.header-action-item .action-sub {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    line-height: 1.1;
}

.header-action-item .action-main {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

/* Cart Badge */
.cart-icon-container {
    position: relative;
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: 8px;
    background-color: var(--noon-yellow);
    color: #000000;
    font-weight: 800;
    font-size: 11px;
    border-radius: 50%;
    padding: 2px 6px;
    line-height: 1;
}

/* Wishlist Badge (Header icon, count bubble) */
.wishlist-icon-container {
    position: relative;
}

.wishlist-badge {
    position: absolute;
    top: -4px;
    right: 4px;
    background-color: #dc3545;
    color: #ffffff;
    font-weight: 800;
    font-size: 11px;
    border-radius: 50%;
    padding: 2px 6px;
    line-height: 1;
}

/* Sub Navigation Bar */
.sub-header-nav {
    background-color: var(--secondary-color);
    color: #ffffff;
    padding: 6px 0;
    font-size: 13px;
}

.sub-header-nav a {
    color: #ffffff;
    text-decoration: none;
    margin-right: 18px;
    font-weight: 500;
    padding: 4px 6px;
    border-radius: 2px;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.sub-header-nav a:hover {
    color: var(--noon-yellow);
    background-color: rgba(255, 255, 255, 0.08);
}

/* Mobile Offcanvas Drawer */
.mobile-nav-header {
    background-color: var(--primary-color);
    color: #ffffff;
}
