/* Header Styles */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 12px 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

body.dark-mode .header {
    background: rgba(28, 28, 30, 0.85) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

/* Location Button Styles - iOS Style with Blur */
.b_e271 {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.b_e271:hover {
    background: rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.b_e271::before {
    content: '\f3c5';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    color: #007AFF;
    /* Blue location icon */
    font-size: 16px;
}

/* Location Text */
.ZXYPR_HW {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1.4;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Dark Mode Overrides for Location */
body.dark-mode .b_e271 {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .ZXYPR_HW {
    color: #ffffff;
}

/* Header Logo Text */
.header-logo {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

body.dark-mode .header-logo {
    color: #ffffff;
}

.header-logo i {
    color: #007AFF;
    font-size: 22px;
}

.header-cart {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.05);
    /* Light grey bg */
}

.header-cart:hover {
    background: rgba(0, 0, 0, 0.08);
}

.header-cart i {
    font-size: 18px;
    color: #1a1a1a;
    /* Dark icon */
}

body.dark-mode .header-cart i {
    color: #ffffff;
}

body.dark-mode .header-cart {
    background: rgba(255, 255, 255, 0.1);
}

/* Dark Mode Toggle Icon */
.dark-mode-toggle {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: #1a1a1a;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.dark-mode-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
}

body.dark-mode .dark-mode-toggle {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Profile Button - Modern */
.profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    padding: 6px 14px;
    text-decoration: none;
    color: #1a1a1a !important;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.profile-btn i {
    font-size: 16px;
    color: #007AFF !important;
}

.profile-btn span {
    font-size: 14px;
    color: #1a1a1a !important;
}

.profile-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

body.dark-mode .profile-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
    color: white !important;
}

body.dark-mode .profile-btn i,
body.dark-mode .profile-btn span {
    color: white !important;
}


/* Profile Avatar - Circular Picture */
.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-primary, #0a2e5a), var(--brand-secondary, #000035));
}

.profile-avatar:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-initials {
    font-size: 15px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
}

/* Dark mode */
body.dark-mode .profile-avatar {
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .profile-avatar:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 10px 12px;
    }

    .ZXYPR_HW {
        font-size: 13px;
        max-width: 140px;
    }

    .b_e271 {
        padding: 6px 10px;
    }

    .header-cart i {
        font-size: 18px;
    }
}

/* Global Search Bar Styles (Unified from index.php) */
.search-row {
    padding: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
    z-index: 100;
    background: var(--bg-color, #fff);
    /* max-width removed to match index.php full width behavior if needed, or keep it */
    /* index.php didn't have max-width, but it's good practice. I'll keep it but larger? No, keep it. */
    max-width: 1200px;
    margin: 0 auto;
}

.search-wrapper {
    flex: 1;
    background: #F3F4F6;
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1001;
}

.search-wrapper input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 15px;
    color: #111827;
}

.filter-btn-square {
    width: 52px;
    height: 52px;
    background: #F3F4F6;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
}

/* Voice Mic Icon */
.voice-mic {
    color: #8e8e93;
    cursor: pointer;
    transition: color 0.2s;
}

.voice-mic:hover {
    color: #007aff;
}

.voice-mic.recording {
    color: #ff3b30;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    display: none;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s;
}

.search-overlay.active {
    display: block;
}

/* Dark Mode Support for Search */
body.dark-mode .search-row {
    background: transparent;
}

body.dark-mode .search-wrapper,
body.dark-mode .filter-btn-square {
    background: #1C1C1E;
    color: white;
}

body.dark-mode .search-wrapper input {
    color: white;
}

body.dark-mode .filter-btn-square i {
    color: white;

    /* --- Inline Header Styles from index.php --- */
    .app-header {
        padding: 12px 20px 0;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        background: var(--bg-color, #fff);
    }

    .header-left h1 {
        font-size: 20px;
        font-weight: 700;
        margin: 0 0 4px;
    }

    .header-subtitle {
        font-size: 14px;
        margin: 0 0 12px;
    }

    .location-selector {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 14px;
        color: #0066FF;
        font-weight: 500;
        cursor: pointer;
    }

    .header-icon-btn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: #fff;
        border: 1px solid #f0f0f0;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #111827;
        font-size: 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
        cursor: pointer;
    }

    /* .search-row styles are largely duplicate but contained inline specific tweaks so keeping them for safety until deeper cleanup */
    .search-row {
        padding: 20px;
        display: flex;
        gap: 12px;
        align-items: center;
        position: relative;
        z-index: 100;
        background: var(--bg-color, #fff);
    }

    .search-wrapper {
        flex: 1;
        background: #F3F4F6;
        border-radius: 14px;
        padding: 14px 16px;
        display: flex;
        align-items: center;
        gap: 12px;
        position: relative;
        z-index: 1001;
    }

    .search-wrapper input {
        border: none;
        background: transparent;
        outline: none;
        width: 100%;
        font-size: 15px;
        color: #111827;
    }

    .filter-btn-square {
        width: 52px;
        height: 52px;
        background: #F3F4F6;
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        cursor: pointer;
    }

    /* Overlay - merging with existing if possible but appending for now */
    .search-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        display: none;
        backdrop-filter: blur(2px);
        transition: opacity 0.3s;
    }

    .search-overlay.active {
        display: block;
    }

    /* Dark Mode for Header Icons */
    body.dark-mode .header-icon-btn {
        background: #1C1C1E;
        border-color: #38383A;
        color: #fff;
    }