/**
 * UNIMART AFRICA — Design tokens (source: base.html preloader + logo)
 * Use these variables for all new 2040 UI (Snap to Sell, /me/, Tour, etc.)
 */
:root {
    /* Official UNIMART palette — orange · slate grey · white only */
    --unimart-orange: #f68b1e;
    --unimart-orange-deep: #e96703;
    --unimart-slate: #2c3e50;
    --unimart-navy: #2c3e50; /* legacy alias → brand dark grey */

    /* Semantic aliases */
    --unimart-primary: var(--unimart-orange);
    --unimart-primary-hover: var(--unimart-orange-deep);
    --unimart-secondary: var(--unimart-slate);
    --unimart-accent: var(--unimart-slate);

    /* Surfaces */
    --unimart-bg: #ffffff;
    --unimart-bg-muted: #f5f6f8;
    --unimart-border: #e8e8e8;
    --unimart-text: #1a1a2e;
    --unimart-text-muted: #6b7280;

    /* Status */
    --unimart-success: #198754;
    --unimart-danger: #dc3545;
    --unimart-warning: #ffc107;

    /* Layout */
    --unimart-radius: 12px;
    --unimart-radius-sm: 8px;
    --unimart-shadow: 0 4px 14px rgba(44, 62, 80, 0.08);
    --unimart-nav-height: 56px;

    /* Content shells — phone-first; responsive-2040.css scales these up */
    --um-shell-phone: 720px;
    --um-shell-tablet: 960px;
    --um-shell-laptop: 1120px;
    --um-shell-desktop: 1200px;
    --um-shell-wide: 1320px;
    --um-shell-max: 1400px;
    --um-pad-x: 1rem;
    --um-pad-x-md: 1.35rem;
    --um-pad-x-lg: 1.5rem;
    --um-pad-x-xl: 1.75rem;

    /* Typography — Manrope (UI) + Fraunces (headlines) */
    --unimart-font-sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --unimart-font-display: "Fraunces", Georgia, "Times New Roman", serif;
    /* Legacy aliases used by layer/home CSS */
    --um-font: var(--unimart-font-sans);
    --um-font-display: var(--unimart-font-display);

    /* Consolidation Wave 2 — domain pack aliases (do not delete; remap only) */
    --jj-orange: var(--unimart-orange);
    --jj-orange-deep: var(--unimart-orange-deep);
    --jj-slate: var(--unimart-slate);
    --ul-orange: var(--unimart-orange);
    --ul-orange-deep: var(--unimart-orange-deep);
    --ul-slate: var(--unimart-slate);
    --ul-text: var(--unimart-text);
    --ul-muted: var(--unimart-text-muted);
    --ul-bg: var(--unimart-bg);
    --uz-accent: var(--unimart-orange);
    --sp-orange: var(--unimart-orange);
    --sp-orange-dark: var(--unimart-orange-deep);
    --opp-orange: var(--unimart-orange);
    --opp-orange-dark: var(--unimart-orange-deep);
    --biz-accent: var(--unimart-orange);
    --biz-slate: var(--unimart-slate);
    --pdp-accent: var(--unimart-orange);
    --commerce-orange: var(--unimart-orange);
    --primary: var(--unimart-orange);
    --primary-dark: var(--unimart-orange-deep);
}

/* Shared breadcrumb (Wave 3) */
.um-breadcrumb {
    padding: 0.65rem 0 0.25rem;
    margin: 0;
}
.um-breadcrumb__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.78rem;
    color: var(--unimart-text-muted);
}
.um-breadcrumb__item:not(:last-child)::after {
    content: "›";
    margin-left: 0.35rem;
    color: var(--unimart-border);
}
.um-breadcrumb__item a {
    color: var(--unimart-orange);
    text-decoration: none;
    font-weight: 600;
}
.um-breadcrumb__item a:hover { text-decoration: underline; }
.um-breadcrumb__item.is-current span {
    color: var(--unimart-text);
    font-weight: 600;
}

/* Product redesign layer — see unimart-product.css (loaded from base.html) */

/* Utility classes for sprint UI */
.unimart-btn-primary {
    background: linear-gradient(135deg, var(--unimart-orange), var(--unimart-orange-deep));
    color: #fff;
    border: none;
    border-radius: var(--unimart-radius-sm);
    font-weight: 600;
    padding: 0.75rem 1.25rem;
}

.unimart-btn-primary:hover {
    filter: brightness(1.05);
    color: #fff;
}

.unimart-btn-secondary {
    background: var(--unimart-slate);
    color: #fff;
    border: none;
    border-radius: var(--unimart-radius-sm);
    font-weight: 600;
    padding: 0.75rem 1.25rem;
}

.unimart-card {
    background: var(--unimart-bg);
    border: 1px solid var(--unimart-border);
    border-radius: var(--unimart-radius);
    box-shadow: var(--unimart-shadow);
}

.unimart-logo-uni {
    background: var(--unimart-slate);
    color: #fff;
    padding: 2px 6px;
    font-weight: 600;
}

.unimart-logo-africa {
    background: var(--unimart-orange);
    color: #fff;
    padding: 2px 6px;
    font-weight: 700;
}

/* ── Simplified 5-item nav (Sprint 3) ── */
.unimart-nav {
    background: var(--unimart-slate, #2c3e50);
    border-top: 2px solid var(--unimart-orange, #f68b1e);
    padding: 0 0 env(safe-area-inset-bottom, 0px);
    z-index: 1050;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}
.unimart-nav__inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 0.5rem;
}
.unimart-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    transition: color 0.2s;
}
.unimart-nav__item i {
    font-size: 1.15rem;
}
.unimart-nav__item:hover,
.unimart-nav__item.is-active {
    color: #fff;
}
.unimart-nav__item--sell {
    color: var(--unimart-orange, #f68b1e);
}
.unimart-nav__item--sell.is-active,
.unimart-nav__item--sell:hover {
    color: var(--unimart-orange, #f68b1e);
}
.unimart-nav__badge {
    display: inline-block;
    min-width: 1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: var(--unimart-orange, #f68b1e);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1.2;
    vertical-align: top;
}
.unimart-nav--hybrid .unimart-nav__inner {
    max-width: 560px;
}
@media (max-width: 767px) {
    .unimart-nav--hybrid .unimart-nav__item span {
        font-size: 0.58rem;
        letter-spacing: -0.02em;
    }
}
.unimart-nav__item--agent.is-active,
.unimart-nav__item--agent:hover {
    color: var(--unimart-orange, #f68b1e);
}
.unimart-nav__item--spotlight.is-active,
.unimart-nav__item--spotlight:hover {
    color: var(--unimart-orange, #f68b1e);
}

/* ── Mobile eco chips (scroll with category bar) ── */
.mobile-eco-chip {
    gap: 0.35rem !important;
    font-weight: 700 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.12) !important;
    padding: 8px 12px !important;
    min-width: max-content;
}
.mobile-eco-chip i {
    font-size: 0.65rem;
    opacity: 0.9;
}
.mobile-eco-chip--active,
.mobile-eco-chip.mobile-eco-chip--active {
    background: rgba(246, 139, 30, 0.22) !important;
    color: #fff !important;
}
.mobile-eco-divider {
    display: inline-block;
    width: 1px;
    min-width: 1px;
    height: 60%;
    align-self: center;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 2px;
}

body.has-unimart-nav {
    --mobile-bottom-nav-height: calc(60px + env(safe-area-inset-bottom, 0px));
}

body.has-confidence-nav.has-unimart-nav {
    --mobile-bottom-nav-height: calc(64px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 575px) {
    .unimart-nav__item {
        font-size: 0.58rem;
        padding: 0.35rem 0.35rem;
    }
    .unimart-nav__item i {
        font-size: 1.05rem;
    }
    .unimart-nav__inner {
        max-width: 100%;
        padding: 0 0.25rem;
    }
    .account-text {
        display: none;
    }
    #account-dropdown .dropbtn {
        padding: 0.2rem !important;
    }
}

/* Header — three-zone layout: brand | layers (center) | utilities (right) */
.top-nav__brand {
    display: flex;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
}

.top-nav .nav-links--layers {
    flex: 0 1 auto;
    justify-content: center;
    margin: 0;
    gap: 18px;
}

.top-nav__utilities {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 0;
    justify-content: flex-end;
    min-width: 0;
}

.top-nav-orders-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--secondary, var(--unimart-text));
    background: rgba(44, 62, 80, 0.06);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.top-nav-orders-link:hover,
.top-nav-orders-link:focus-visible {
    color: var(--primary, #f68b1e);
    background: rgba(246, 139, 30, 0.12);
}

.top-nav .nav-links--utilities {
    flex: 0 0 auto;
    justify-content: flex-end;
    margin: 0;
    gap: 14px;
}

@media (min-width: 769px) {
    .top-nav .nav-links--layers {
        gap: 20px;
    }

    .top-nav .nav-links--utilities {
        gap: 16px;
    }
}

@media (min-width: 1025px) {
    .top-nav .nav-links--layers {
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .top-nav__brand {
        flex: 0 1 auto;
    }

    .top-nav .nav-links--layers {
        display: none !important;
    }

    .top-nav__utilities {
        flex: 0 0 auto;
        margin-left: auto;
        gap: 6px;
    }

    .top-nav .nav-links--utilities {
        display: none !important;
    }
}

/* Header — profile avatar dropdown (utilities zone, not in layers row) */
.account-avatar-dropdown {
    flex-shrink: 0;
}

.account-avatar-trigger {
    display: inline-flex !important;
    align-items: center;
    gap: 0.45rem;
    padding: 0.2rem 0.35rem 0.2rem 0.2rem !important;
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    border-radius: 999px !important;
    color: #fff !important;
    font-weight: 600 !important;
}

.account-avatar,
.user-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--unimart-slate, #2c3e50);
    border: 2px solid rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.account-avatar__placeholder,
.user-avatar__placeholder {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1;
}

.account-avatar__img,
.user-avatar__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.account-avatar__img.is-broken,
.user-avatar__img.is-broken {
    display: none;
}

.account-avatar--has-photo .account-avatar__placeholder,
.user-avatar--has-photo .user-avatar__placeholder {
    opacity: 0;
}

.user-avatar--lg {
    width: 88px;
    height: 88px;
    min-width: 88px;
    min-height: 88px;
}

.user-avatar--lg .user-avatar__placeholder {
    font-size: 2rem;
}

.account-avatar-trigger__chevron {
    font-size: 0.65rem;
    opacity: 0.85;
}

@media (max-width: 767.98px) {
    .account-avatar-trigger__name {
        display: none !important;
    }

    .account-avatar,
    .user-avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .account-avatar__placeholder,
    .user-avatar__placeholder {
        font-size: 1rem;
    }

    .account-avatar-trigger__chevron {
        font-size: 0.6rem;
        opacity: 0.9;
        color: #fff;
    }

    .account-avatar-trigger {
        padding: 0.15rem 0.25rem 0.15rem 0.15rem !important;
        background: transparent !important;
        border: none !important;
        color: #fff !important;
        gap: 0.25rem !important;
    }

    #account-dropdown .account-avatar-trigger {
        color: #fff !important;
    }

    #account-dropdown .dropdown-content {
        right: 0;
        left: auto;
        min-width: 220px;
    }
}

.account-menu__divider {
    margin: 0.35rem 0;
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.account-menu__logout {
    margin: 0;
}

.account-menu__logout button {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.55rem 1rem;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.account-menu__logout button:hover {
    background: rgba(246, 139, 30, 0.08);
}

/* Profile update — photo upload */
.profile-photo-card__row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.profile-photo-card__preview {
    width: 88px;
    height: 88px;
    min-width: 88px;
    min-height: 88px;
}

.profile-photo-card__preview .user-avatar--lg {
    width: 88px;
    height: 88px;
    min-width: 88px;
    min-height: 88px;
    border-color: var(--unimart-border, #e8e8e8);
    background: var(--unimart-bg-muted, #f5f6f8);
    box-shadow: none;
}

.profile-photo-card__preview .user-avatar--lg .user-avatar__placeholder {
    font-size: 2rem;
    color: var(--unimart-slate, #2c3e50);
}

.profile-photo-card__field {
    flex: 1;
    min-width: 200px;
}

/* ── Page preloader (moved from base.html) ── */
#page-preloader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--unimart-bg, #ffffff);
    transition: opacity .45s ease, visibility .45s ease;
}

#page-preloader.preloader--hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader__logo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    animation: preloaderPulse 1.6s ease-in-out infinite;
    border: 3px solid var(--unimart-slate, #2c3e50);
}

.preloader__brand {
    margin-top: 14px;
    display: flex;
    gap: 0;
    font-family: var(--unimart-font-display);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.3px;
    line-height: 1;
}

.preloader__brand-uni {
    background: var(--unimart-slate, #2c3e50);
    color: #fff;
    padding: 4px 6px;
    border-radius: 3px 0 0 3px;
}

.preloader__brand-africa {
    background: var(--unimart-orange, #f68b1e);
    color: #fff;
    padding: 4px 6px;
    border-radius: 0 3px 3px 0;
}

.preloader__bar-track {
    margin-top: 22px;
    width: 180px;
    height: 4px;
    background: var(--unimart-border, #e8e8e8);
    border-radius: 4px;
    overflow: hidden;
}

.preloader__bar-fill {
    height: 100%;
    width: 40%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--unimart-slate, #2c3e50), var(--unimart-orange-deep, #e96703));
    animation: preloaderSlide 1.2s ease-in-out infinite;
}

.preloader__tagline {
    margin-top: 12px;
    font-family: var(--unimart-font-display);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--unimart-text-muted, var(--gray));
}

.preloader__sub {
    margin: 6px 0 0;
    font-family: var(--unimart-font-display);
    font-size: 0.72rem;
    color: var(--gray);
    letter-spacing: 0.04em;
}

.preloader--hybrid .preloader__brand-africa { display: none; }

.preloader--hybrid .preloader__brand-uni {
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

.preloader--hybrid .preloader__bar-track { display: none; }

@keyframes preloaderPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.06); opacity: .85; }
}

@keyframes preloaderSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

#global-spinner {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(44, 62, 80, 0.55);
    justify-content: center;
    align-items: center;
}

#global-spinner .spinner {
    border: 6px solid rgba(255, 255, 255, .25);
    border-top-color: var(--unimart-orange-deep, #e96703);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: ajaxSpin .75s linear infinite;
}

@keyframes ajaxSpin {
    to { transform: rotate(360deg); }
}

body.nav-loading-active #page-preloader {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.nav-loading-active #page-preloader.preloader--hidden {
    display: flex !important;
}

.unimart-nav__item.is-opening {
    opacity: 0.65;
}

/* ── Header logo (orange bar + slate wordmark) ── */
.unimart-logo {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    color: inherit;
    line-height: 1.2;
    white-space: nowrap;
}

.unimart-logo__mark {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    border: 2px solid var(--unimart-slate, #2c3e50);
    flex-shrink: 0;
}

.unimart-logo__text {
    display: inline-flex;
    align-items: center;
    background: var(--unimart-slate, #2c3e50);
    border-radius: 3px;
    overflow: hidden;
    font-family: var(--unimart-font-display);
    font-weight: 600;
    letter-spacing: -0.5px;
}

.unimart-logo__text--full {
    font-size: 1.5rem;
}

.unimart-logo__text--compact {
    display: none;
    font-size: 1.2rem;
}

.unimart-logo__word {
    padding: 2px 4px;
}

.unimart-logo__word--uni {
    color: #fff;
}

.unimart-logo__word--africa {
    color: var(--unimart-orange, #f68b1e);
}

@media (max-width: 991.98px) {
    .unimart-logo__text--full { display: none; }
    .unimart-logo__text--compact { display: inline-flex; }
}

.hero__avatar--brand-orange { background: linear-gradient(135deg, var(--unimart-orange, #f68b1e), var(--unimart-orange-deep, #e96703)); }
.hero__avatar--brand-slate { background: linear-gradient(135deg, var(--unimart-slate, #2c3e50), var(--unimart-slate-mid, #34495e)); }
.hero__avatar--brand-mix { background: linear-gradient(135deg, var(--unimart-slate, #2c3e50) 0%, var(--unimart-orange, #f68b1e) 100%); }
.hero__avatar--brand-soft { background: linear-gradient(135deg, var(--unimart-orange-deep, #e96703), var(--unimart-orange, #f68b1e)); }

.top-nav .logo,
.top-nav .unimart-logo {
    font-family: var(--unimart-font-display);
    flex-shrink: 0;
}
