/* ==========================================================================
   Crystal Retail Suite - Common Header, Profile Dropdown, Topbar & Auth CSS
   ========================================================================== */

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

:root {
    --header-ink: #0f2425;
    --header-muted: #5c7273;
    --header-deep: #0c2d30;
    --header-deep-2: #071e20;
    --header-teal: #196766;
    --header-teal-light: #e6f3f2;
    --header-teal-accent: #2ab5ab;
    --header-line: rgba(15, 36, 37, 0.1);
    --header-white: #ffffff;
    --header-shadow-sm: 0 4px 16px rgba(12, 45, 48, 0.06);
    --header-shadow-md: 0 14px 36px rgba(12, 45, 48, 0.11);
    --header-shadow-lg: 0 24px 64px rgba(7, 30, 32, 0.18);
    --header-max-width: 1400px;
}

/* ── Topbar ── */
.topbar {
    background: var(--header-deep-2);
    color: #d6f0ec;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 2001;
}

.topbar-inner {
    max-width: var(--header-max-width);
    margin: 0 auto;
    padding: 0 24px;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.topbar strong {
    color: #f5cf88;
}

.topbar a {
    color: #87d6cd;
    text-decoration: underline;
}

/* ── Main Sticky Header ── */
.header {
    position: sticky;
    top: 0;
    z-index: 2000;
    background: rgba(252, 251, 250, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--header-line);
    transition: all 0.25s ease;
}

    .header .nav {
        max-width: var(--header-max-width);
        margin: 0 auto;
        padding: 0 24px;
        min-height: 74px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 20px;
    }

/* ── Brand Logo & Text ── */
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--header-ink);
}

    .brand img {
        width: 46px;
        height: 46px;
        object-fit: contain;
        border: 1px solid var(--header-line);
        border-radius: 14px;
        background: #ffffff;
        padding: 4px;
        box-shadow: var(--header-shadow-sm);
        flex-shrink: 0;
    }

    .brand span {
        display: flex;
        flex-direction: column;
    }

    .brand #brandName { 
        color: var(--header-deep); 
        display: block;
        font-family: "Kalam", "Segoe Print", cursive;
        font-size: 18px;
        letter-spacing: .2px;
        font-weight: 400;
    }

    .brand small,
    .brand #brandSub {
        display: block;
        color: var(--header-muted);
        font-weight: 700;
        font-size: 11px;
        letter-spacing: 0.5px;
        text-transform: uppercase;
    }

/* ── Navigation Links ── */
.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

    .nav-links a {
        padding: 8px 14px;
        color: #355354;
        font-size: 14px;
        font-weight: 700;
        border-radius: 12px;
        text-decoration: none;
        transition: all 0.2s ease;
    }

        .nav-links a:hover,
        .nav-links a.active {
            background: var(--header-teal-light);
            color: var(--header-teal);
        }

/* ── Header Actions ── */
.actions,
.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ghost-btn {
    padding: 0 16px;
    min-height: 38px;
    border-radius: 12px;
    background: var(--header-teal-light);
    color: var(--header-teal);
    font-weight: 800;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

    .ghost-btn:hover {
        background: #d3ebe7;
        color: var(--header-deep);
    }

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--header-deep);
    background: var(--header-teal-light);
    display: grid;
    place-items: center;
    position: relative;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

    .icon-btn:hover {
        background: #d3ebe7;
    }

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 99px;
    background: #c85a4a;
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(200, 90, 74, 0.4);
}

/* ==========================================================================
   User Profile Badge & Dropdown Component
   ========================================================================== */
.user-profile-wrapper {
    position: relative;
    z-index: 2005;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    font-family: inherit;
    outline: none;
}

.user-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid rgba(25, 103, 102, 0.22);
    border-radius: 40px;
    padding: 4px 12px 4px 5px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 8px rgba(15, 36, 37, 0.06);
    outline: none;
    user-select: none;
    text-decoration: none;
    color: var(--header-ink);
    height: 38px;
}

    .user-profile-btn:hover,
    .user-profile-btn:focus-visible,
    .user-profile-wrapper.open .user-profile-btn,
    .user-profile-wrapper:focus-within .user-profile-btn {
        background: #ffffff;
        border-color: var(--header-teal);
        box-shadow: 0 4px 14px rgba(25, 103, 102, 0.15);
    }

.user-avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--header-teal) 0%, #0d4645 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(25, 103, 102, 0.25);
}

.user-name-text {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1;
}

.dropdown-caret {
    font-size: 11px;
    color: #64748b;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 2px;
}

.user-profile-wrapper.open .dropdown-caret,
.user-profile-wrapper:focus-within .dropdown-caret {
    transform: rotate(180deg);
    color: var(--header-teal);
}

/* Dropdown Menu Card */
.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: #ffffff;
    border: 1px solid rgba(15, 36, 37, 0.08);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 12px 32px rgba(12, 45, 48, 0.14), 0 4px 12px rgba(12, 45, 48, 0.04);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transform-origin: top right;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 100000;
}

.user-profile-wrapper.open .profile-dropdown-menu,
.user-profile-wrapper:focus-within .profile-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

@media (hover: hover) {
    .user-profile-wrapper:hover .profile-dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }

    .user-profile-wrapper:hover .dropdown-caret {
        transform: rotate(180deg);
        color: var(--header-teal);
    }

    .user-profile-wrapper:hover .user-profile-btn {
        border-color: var(--header-teal);
        box-shadow: 0 4px 14px rgba(25, 103, 102, 0.15);
    }
}

.dropdown-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 4px;
}

.dropdown-user-avatar {
    font-size: 24px;
    color: var(--header-teal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropdown-user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dropdown-user-title {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.dropdown-user-subtitle {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-divider {
    height: 1px;
    background-color: #f1f5f9;
    margin: 4px 0;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}

    .profile-dropdown-item i {
        font-size: 15px;
        color: #64748b;
        transition: color 0.15s ease;
    }

    .profile-dropdown-item:hover {
        background-color: #f0fdf4;
        color: var(--header-teal);
    }

        .profile-dropdown-item:hover i {
            color: var(--header-teal);
        }

    .profile-dropdown-item.logout-item:hover {
        background-color: #fef2f2;
        color: #dc2626;
    }

        .profile-dropdown-item.logout-item:hover i {
            color: #dc2626;
        }

/* ==========================================================================
   Auth Modal & Select2 Shared Styling
   ========================================================================== */
#authModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 30, 32, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 16px;
}

    #authModal .select2-container .select2-selection--single {
        height: 42px !important;
        border: 1px solid #dee2e6 !important;
        border-radius: 10px !important;
        background: #ffffff !important;
    }

        #authModal .select2-container .select2-selection--single .select2-selection__rendered {
            line-height: 40px !important;
            color: var(--header-deep) !important;
            font-weight: 600 !important;
            font-size: 13.5px !important;
            padding-left: 10px !important;
        }

        #authModal .select2-container .select2-selection--single .select2-selection__arrow {
            height: 40px !important;
        }

    #authModal input:focus {
        border-color: var(--header-deep) !important;
        box-shadow: 0 0 0 3px rgba(12, 45, 48, 0.12) !important;
    }

    #authModal #sendOtpBtn:hover,
    #authModal #verifyOtpBtn:hover {
        background: #196766 !important;
        transform: translateY(-1px);
    }

    #authModal #sendOtpBtn:active,
    #authModal #verifyOtpBtn:active {
        transform: translateY(0);
    }

/* Mobile Responsiveness */
@media (max-width: 767px) {
    .header .nav {
        padding: 0 16px;
        min-height: 64px;
    }

    #headerUserName {
        display: none !important;
    }

    .user-profile-btn {
        padding: 4px;
    }
}

/* ── Universal Footer Payment Methods ── */
.supported-brands-container {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    margin-top: 10px;
    padding: 0;
    background: transparent;
}

.payment-brand {
    width: 44px;
    height: 28px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    padding: 3px 5px;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

    .payment-brand:hover {
        transform: translateY(-2px);
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.22);
    }

.visa-brand {
    background-image: url('../img/supported-brand-visa-5VGWDZXF.svg');
}

.mastercard-brand {
    background-image: url('../img/supported-brand-mastercard-5RRG52PH.svg');
}

.amex-brand {
    background-image: url('../img/express_logo-4ZHMI6WK.png');
}

.omannet-brand {
    background-image: url('../img/oman_net-OJGRVNW5.svg');
}

.applepay-brand {
    background-image: url('../img/supported-brand-applepay-5VOXRCUD.svg');
}

.googlepay-brand {
    background-image: url('../img/GPay_Acceptance_Mark_800-DV65H7QK.png');
}

.maal-brand {
    background-image: url('../img/maal-LR5GVS3I.svg');
}

@media screen and (max-width: 480px) {
    .supported-brands-container {
        gap: 5px;
    }

    .payment-brand {
        width: 40px;
        height: 25px;
        padding: 2px 4px;
        border-radius: 4px;
    }
}

/* ── Universal Footer Styles ── */
.footer {
    background: #0c2d30;
    color: rgba(255, 255, 255, 0.8);
    padding: 48px 0 24px;
    margin-top: 60px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
}

@media (max-width: 991px) {
    .footer-inner {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 576px) {
    .footer-inner {
        grid-template-columns: 1fr;
    }
}

.footer-col h4 {
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 13.5px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #2ab5ab;
}

.footer-bottom {
    max-width: 1320px;
    margin: 32px auto 0;
    padding: 24px 20px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.7);
}

.footer-bottom a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
}

.footer-bottom a:hover {
    color: #2ab5ab;
}
