/* ==========================================================================
   NUSAVERSE — Digital Cultural Discovery & Commerce Ecosystem
   Design System (Bootstrap 5 companion stylesheet)

   TABLE OF CONTENTS
   1.  Design tokens (colour, type scale, spacing, layout)
   2.  Dark-mode token overrides
   3.  Base & typography (Bootstrap overrides on the type scale)
   4.  Buttons
   5.  Badges
   6.  Forms, tables, dropdowns, modals, misc Bootstrap components
   7.  Cards, stat cards, breadcrumb
   8.  HEADER SYSTEM — top bar + main navigation
   9.  App shell (dashboard sidebar) + admin/artisan sidebar
   10. Hero, map, scan HUD, AR, chat, trail, toast
   11. Mobile bottom navigation
   12. Compatibility utilities (classes used in markup, previously undefined)
   13. Responsive rules
   ========================================================================== */


/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root {
    /* Brand palette: Emerald, Gold, Cream, Navy */
    --nusa-primary: #047857;
    --nusa-primary-dark: #064e3b;
    --nusa-primary-deep: #022c22;
    --nusa-primary-light: #10b981;
    --nusa-primary-subtle: #ecfdf5;

    --nusa-gold: #d97706;
    --nusa-gold-hover: #b45309;
    --nusa-gold-light: #fef3c7;
    --nusa-gold-accent: #f59e0b;

    --nusa-navy: #0f172a;
    --nusa-dark: #1e293b;
    --nusa-gray: #64748b;
    --nusa-gray-light: #f1f5f9;
    --nusa-cream: #fdfbf7;
    --nusa-white: #ffffff;

    /* Surfaces */
    --body-bg: #f8fafc;
    --body-color: #1e293b;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --sidebar-bg: #ffffff;
    --sidebar-color: #334155;
    --header-bg: #ffffff;
    --modal-bg: #ffffff;
    --border-color: #e2e8f0;

    /* Typography — one family, one scale.
       Scale: 12 / 14 / 16 / 18 / 20 / 24 / 32 / 40 / 48 px */
    --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --fs-xs: 0.75rem;     /* 12  caption, meta, badge, tiny label          */
    --fs-sm: 0.875rem;    /* 14  navigation, buttons, table, secondary text */
    --fs-md: 1rem;        /* 16  body                                       */
    --fs-lg: 1.125rem;    /* 18  card title, lead                           */
    --fs-xl: 1.25rem;     /* 20  sub-heading, logo                          */
    --fs-2xl: 1.5rem;     /* 24  section sub-title                          */
    --fs-3xl: 2rem;       /* 32  section title                              */
    --fs-4xl: 2.5rem;     /* 40  page heading                               */
    --fs-5xl: 3rem;       /* 48  hero heading                               */

    --lh-tight: 1.2;
    --lh-snug: 1.4;
    --lh-base: 1.6;
    --lh-relaxed: 1.75;   /* long-form reading text */

    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;
    --fw-extrabold: 800;

    /* Spacing scale (4px base) */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;

    /* Control sizes */
    --control-h-sm: 34px;
    --control-h: 40px;
    --control-h-lg: 48px;
    --icon-box: 1.25rem;   /* fixed icon column so labels align */

    /* Layout */
    --gutter: 1.5rem;
    --topbar-h: 44px;
    --header-h: 72px;
    --header-max: 1440px;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 14px -2px rgba(6, 78, 59, 0.08);
    --shadow-lg: 0 12px 28px -4px rgba(6, 78, 59, 0.12);
    --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.25);
    --shadow-gold: 0 0 20px rgba(245, 158, 11, 0.3);

    --transition-fast: 0.2s ease;
    --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);

    /* Point Bootstrap at the same tokens */
    --bs-body-font-family: var(--font-body);
    --bs-body-font-size: 1rem;
    --bs-body-line-height: var(--lh-base);
}


/* ==========================================================================
   2. DARK MODE
   ========================================================================== */
body.dark-mode {
    --body-bg: #090e17;
    --body-color: #e2e8f0;
    --card-bg: #111827;
    --card-border: #1f2937;
    --sidebar-bg: #0f172a;
    --sidebar-color: #cbd5e1;
    --header-bg: #0f172a;
    --modal-bg: #111827;
    --border-color: #1e293b;
    --nusa-cream: #0f172a;
    --nusa-primary-subtle: rgba(16, 185, 129, 0.12);
    --nusa-gold-light: rgba(217, 119, 6, 0.15);
    --shadow-md: 0 4px 14px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.5);
    --nusa-gray: #94a3b8;

    /* Map Bootstrap's own theme variables onto the NusaVerse dark palette so cards,
       tables, forms, dropdowns and .text-muted all follow the theme consistently. */
    color-scheme: dark;
    --bs-body-color: #e2e8f0;
    --bs-body-bg: #090e17;
    --bs-emphasis-color: #f8fafc;
    --bs-secondary-color: #94a3b8;
    --bs-secondary-bg: #1e293b;
    --bs-tertiary-color: #64748b;
    --bs-tertiary-bg: #111827;
    --bs-border-color: #1f2937;
    --bs-border-color-translucent: rgba(255, 255, 255, 0.1);
    --bs-heading-color: inherit;
    --bs-primary-bg-subtle: #031633;
    --bs-secondary-bg-subtle: #1e293b;
    --bs-success-bg-subtle: #052e22;
    --bs-info-bg-subtle: #032830;
    --bs-warning-bg-subtle: #332701;
    --bs-danger-bg-subtle: #2c0b0e;
    --bs-light-bg-subtle: #1e293b;
    --bs-primary-text-emphasis: #6ea8fe;
    --bs-secondary-text-emphasis: #a7acb1;
    --bs-success-text-emphasis: #75b798;
    --bs-info-text-emphasis: #6edff6;
    --bs-warning-text-emphasis: #ffda6a;
    --bs-danger-text-emphasis: #ea868f;
    --bs-light-text-emphasis: #f8f9fa;
    --bs-dark-text-emphasis: #dee2e6;
}

/* Dark mode: brand accents lighten, outline buttons follow the theme */
body.dark-mode .text-emerald,
body.dark-mode .badge-nusa-green {
    color: #34d399 !important;
}

body.dark-mode .badge-nusa-gold {
    color: #fbbf24;
}

body.dark-mode .btn-outline-dark {
    --bs-btn-color: #e2e8f0;
    --bs-btn-border-color: #475569;
    --bs-btn-hover-color: #0f172a;
    --bs-btn-hover-bg: #e2e8f0;
    --bs-btn-hover-border-color: #e2e8f0;
    --bs-btn-active-color: #0f172a;
    --bs-btn-active-bg: #e2e8f0;
    --bs-btn-active-border-color: #e2e8f0;
}

body.dark-mode .btn-outline-secondary {
    --bs-btn-color: #cbd5e1;
    --bs-btn-border-color: #475569;
    --bs-btn-hover-bg: #334155;
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-border-color: #475569;
}

/* Neutral utility surfaces follow the theme. Translucent overlays (bg-opacity-*) are left alone. */
body.dark-mode.bg-light {
    background-color: var(--body-bg) !important;
}

body.dark-mode .bg-white:not([class*="bg-opacity"]) {
    background-color: var(--card-bg) !important;
}

body.dark-mode .bg-light:not(body):not([class*="bg-opacity"]) {
    background-color: var(--nusa-cream) !important;
}

/* .text-dark means "dark on a light surface": lift it unless it sits on a coloured chip/button/alert */
body.dark-mode .text-dark:not(.bg-warning):not(.bg-info):not(.btn-warning):not(.btn-info):not(.btn-light):not(:is(.bg-warning, .bg-info) *) {
    color: var(--body-color) !important;
}

body.dark-mode .card-ci,
body.dark-mode .stat-card,
body.dark-mode .ai-chat-window {
    color: var(--body-color);
}


/* ==========================================================================
   3. BASE & TYPOGRAPHY
   ========================================================================== */
* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: var(--fs-md);
    font-weight: var(--fw-regular);
    background-color: var(--body-bg);
    color: var(--body-color);
    margin: 0;
    padding: 0;
    line-height: var(--lh-base);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

/* Headings: clear, stepped hierarchy */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-body);
    font-weight: var(--fw-bold);
    line-height: var(--lh-tight);
    color: inherit;
    letter-spacing: -0.01em;
}

h1, .h1 { font-size: var(--fs-3xl); letter-spacing: -0.02em; }   /* 32 → 40 on desktop */
h2, .h2 { font-size: var(--fs-2xl); letter-spacing: -0.02em; }   /* 24 → 32 on desktop */
h3, .h3 { font-size: var(--fs-2xl); line-height: var(--lh-snug); }/* 24 */
h4, .h4 { font-size: var(--fs-xl);  line-height: var(--lh-snug); }/* 20 */
h5, .h5 { font-size: var(--fs-lg);  line-height: var(--lh-snug); letter-spacing: 0; } /* 18 */
h6, .h6 { font-size: var(--fs-md);  line-height: var(--lh-snug); letter-spacing: 0; } /* 16 */

@media (min-width: 768px) {
    h1, .h1 { font-size: var(--fs-4xl); }
    h2, .h2 { font-size: var(--fs-3xl); }
}

/* Bootstrap "display" and "fs-*" utilities snapped to the scale (no fluid calc()) */
.display-1, .display-2, .display-3 { font-size: var(--fs-5xl); font-weight: var(--fw-bold); line-height: var(--lh-tight); }
.display-4 { font-size: var(--fs-4xl); font-weight: var(--fw-bold); line-height: var(--lh-tight); }
.display-5, .display-6 { font-size: var(--fs-3xl); font-weight: var(--fw-bold); line-height: var(--lh-tight); }

.fs-1 { font-size: var(--fs-4xl) !important; }
.fs-2 { font-size: var(--fs-3xl) !important; }
.fs-3 { font-size: var(--fs-2xl) !important; }
.fs-4 { font-size: var(--fs-2xl) !important; }
.fs-5 { font-size: var(--fs-xl) !important; }
.fs-6 { font-size: var(--fs-md) !important; }

@media (max-width: 767.98px) {
    .display-3 { font-size: var(--fs-4xl); }
    .display-4 { font-size: var(--fs-3xl); }
}

p { margin-top: 0; }

/* grid/flex children may shrink below their content width instead of forcing sideways scroll */
.d-grid > *,
.row > * {
    min-width: 0;
}

.lead { font-size: var(--fs-lg); font-weight: var(--fw-regular); }

/* Absolute (not em-relative) so nested <small> never compounds below 12px */
small, .small { font-size: var(--fs-sm); }

.text-uppercase { letter-spacing: 0.04em; }

a {
    color: var(--nusa-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--nusa-primary-dark);
}

:focus-visible {
    outline: 2px solid var(--nusa-primary-light);
    outline-offset: 2px;
}

/* Inline colours written as var(--nusa-primary-dark) are unreadable on dark surfaces */
body.dark-mode [style*="color: var(--nusa-primary-dark)"] {
    color: #6ee7b7 !important;
}

body.dark-mode .btn-nusa-outline {
    color: #34d399 !important;
    border-color: #34d399;
}

body.dark-mode .btn-nusa-outline:hover {
    background: #34d399;
    color: #052e22 !important;
}

/* Cultural gradient accent line */
.nusa-gradient-bar {
    height: 4px;
    background: linear-gradient(90deg, #047857 0%, #10b981 35%, #f59e0b 70%, #d97706 100%);
}


/* ==========================================================================
   4. BUTTONS
   One size system: sm 34px / default 40px / lg 48px. Text 14px (16px on lg).
   ========================================================================== */
.btn,
.btn-nusa-primary,
.btn-nusa-gold,
.btn-nusa-outline,
.btn-demo-mode {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: var(--control-h);
    padding: 0.5rem 1.125rem;
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    line-height: 1.25;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-sm,
.btn-group-sm > .btn {
    min-height: var(--control-h-sm);
    padding: 0.375rem 0.875rem;
    font-size: var(--fs-sm);
    border-radius: 12px;
    gap: 0.4rem;
}

.btn-lg,
.btn-group-lg > .btn {
    min-height: var(--control-h-lg);
    padding: 0.625rem 1.5rem;
    font-size: var(--fs-md);
    border-radius: var(--radius-md);
}

.btn-link {
    min-height: 0;
    padding: 0.25rem 0.5rem;
}

/* Round icon buttons are sized inline by their markup */
.btn.rounded-circle {
    min-height: 0;
    padding: 0;
}

/* Icons inside buttons: fixed metrics, gap replaces the me-* margin so spacing never doubles */
.btn > i,
.btn-nusa-primary > i,
.btn-nusa-gold > i,
.btn-nusa-outline > i,
.btn-demo-mode > i {
    font-size: 0.95em;
    line-height: 1;
    flex-shrink: 0;
}

.btn > i[class*="me-"],
.btn-nusa-primary > i[class*="me-"],
.btn-nusa-gold > i[class*="me-"],
.btn-nusa-outline > i[class*="me-"],
.btn-demo-mode > i[class*="me-"] {
    margin-right: 0 !important;
}

.btn-nusa-primary {
    background: linear-gradient(135deg, var(--nusa-primary) 0%, var(--nusa-primary-dark) 100%);
    color: #ffffff !important;
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn-nusa-primary:hover {
    background: linear-gradient(135deg, #059669 0%, var(--nusa-primary) 100%);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.btn-nusa-gold {
    background: linear-gradient(135deg, var(--nusa-gold-accent) 0%, var(--nusa-gold) 100%);
    color: #ffffff !important;
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn-nusa-gold:hover {
    box-shadow: var(--shadow-gold);
    transform: translateY(-2px);
    color: #ffffff;
}

.btn-nusa-outline {
    background: transparent;
    color: var(--nusa-primary) !important;
    border: 1.5px solid var(--nusa-primary);
}

.btn-nusa-outline:hover {
    background: var(--nusa-primary);
    color: #ffffff !important;
    transform: translateY(-2px);
}

.btn-demo-mode {
    background: #fef3c7;
    color: #b45309 !important;
    border: 1px solid #fcd34d;
}

.btn-demo-mode:hover {
    background: #fde68a;
    transform: translateY(-1px);
}

.btn-close-sm {
    padding: 0.5rem;
    width: 0.75em;
    height: 0.75em;
}


/* ==========================================================================
   5. BADGES
   ========================================================================== */
.badge {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    line-height: 1.25;
    letter-spacing: 0.01em;
}

.badge-nusa-green,
.badge-nusa-gold,
.badge-nusa-verified {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    line-height: 1.25;
}

.badge-nusa-green {
    background-color: var(--nusa-primary-subtle);
    color: var(--nusa-primary);
    padding: 0.4rem 0.75rem;
    border-radius: 30px;
    border: 1px solid rgba(4, 120, 87, 0.2);
}

.badge-nusa-gold {
    background-color: var(--nusa-gold-light);
    color: #b45309;
    padding: 0.4rem 0.75rem;
    border-radius: 30px;
    border: 1px solid rgba(217, 119, 6, 0.25);
}

.badge-nusa-verified {
    background: linear-gradient(135deg, #047857 0%, #064e3b 100%);
    color: #ffffff;
    letter-spacing: 0.04em;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
}


/* ==========================================================================
   6. FORMS, TABLES, DROPDOWNS, MODALS
   ========================================================================== */
.form-label {
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    margin-bottom: 0.375rem;
}

.form-control,
.form-select {
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    min-height: var(--control-h);
    padding: 0.5rem 0.875rem;
    border-radius: 12px;
}

textarea.form-control {
    min-height: 0;
}

.form-control-sm,
.form-select-sm {
    font-size: var(--fs-sm);
    min-height: var(--control-h-sm);
    padding: 0.375rem 0.75rem;
}

.form-control-lg,
.form-select-lg {
    font-size: var(--fs-md);
    min-height: var(--control-h-lg);
}

.form-text,
.invalid-feedback,
.valid-feedback {
    font-size: var(--fs-xs);
}

.form-check-label {
    font-size: var(--fs-sm);
}

.input-group-text {
    font-size: var(--fs-sm);
}

.table {
    font-size: var(--fs-sm);
    line-height: var(--lh-snug);
}

.table > :not(caption) > * > * {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.table thead th {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    white-space: nowrap;
}

.dropdown-menu {
    font-size: var(--fs-sm);
    border-radius: var(--radius-md);
}

.dropdown-item {
    font-size: var(--fs-sm);
    padding: 0.5rem 1rem;
}

.modal-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
}

.nav-tabs .nav-link,
.nav-pills .nav-link {
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
}

.list-group-item {
    padding: 0.875rem 1rem;
}

.pagination {
    font-size: var(--fs-sm);
}

.tooltip {
    font-size: var(--fs-xs);
}

.popover {
    font-size: var(--fs-sm);
}

.accordion-button {
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
}

.progress {
    height: 0.5rem;
}

/* Leaflet: match site type */
.leaflet-container {
    font-family: var(--font-body);
}

.leaflet-popup-content {
    font-size: var(--fs-sm);
    line-height: var(--lh-snug);
    margin: 0.75rem 1rem;
}


/* ==========================================================================
   7. CARDS, STAT CARDS, BREADCRUMB
   ========================================================================== */
.card-ci {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
    overflow: hidden;
}

.card-ci:hover {
    box-shadow: var(--shadow-md);
}

.card-ci-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: var(--sp-4) var(--sp-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
}

.card-ci-body {
    padding: var(--sp-6);
}

.stat-card {
    height: 100%;   /* equal heights when a label wraps in a row of cards */
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: var(--sp-5) var(--sp-6);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--nusa-primary);
}

.stat-card.gold::before { background: var(--nusa-gold); }
.stat-card.blue::before { background: #2563eb; }
.stat-card.purple::before { background: #9333ea; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-xl);
    background: var(--nusa-primary-subtle);
    color: var(--nusa-primary);
}

.stat-card.gold .stat-icon { background: var(--nusa-gold-light); color: var(--nusa-gold); }
.stat-card.blue .stat-icon { background: #dbeafe; color: #2563eb; }
.stat-card.purple .stat-icon { background: #f3e8ff; color: #9333ea; }

.breadcrumb-ci {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--sp-2);
    font-size: var(--fs-sm);
    line-height: var(--lh-snug);
    color: var(--nusa-gray);
    margin-bottom: var(--sp-5);
}

.breadcrumb-ci a {
    color: var(--nusa-gray);
}

.breadcrumb-ci a:hover {
    color: var(--nusa-primary);
}

.breadcrumb-ci .active {
    color: var(--nusa-primary);
    font-weight: var(--fw-semibold);
}


/* ==========================================================================
   8. HEADER SYSTEM
   Structure (all public pages share the same markup):

     .nusa-gradient-bar        4px brand accent
     .nusa-topbar              slim utility strip: tagline + demo tools
     nav.nusa-navbar           sticky main bar, fixed height
        .brand-logo            logo + wordmark
        .nusa-nav              primary navigation (single-line, no wrapping)
        .nav-actions           theme / cart / dashboard
   ========================================================================== */

/* ---- 8.1 Top utility bar -------------------------------------------------- */
.nusa-topbar {
    background: var(--nusa-primary-deep);
    color: #a7f3d0;
    font-size: var(--fs-xs);
}

.nusa-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    max-width: var(--header-max);
    min-height: var(--topbar-h);
    margin: 0 auto;
    padding: var(--sp-1) var(--gutter);
}

.nusa-topbar-tagline {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    letter-spacing: 0.02em;
    line-height: 1.3;
    white-space: nowrap;
}

.nusa-topbar-tagline i {
    color: var(--nusa-gold-accent);
}

.nusa-topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-left: auto;
}

.topbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 32px;
    padding: 0 var(--sp-4);
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    line-height: 1;
    white-space: nowrap;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.topbar-btn i {
    font-size: 0.9em;
    line-height: 1;
}

.topbar-btn-gold {
    background: #fbbf24;
    color: #2b1a00;
}

.topbar-btn-gold:hover {
    background: #fcd34d;
    color: #2b1a00;
    transform: translateY(-1px);
}

.topbar-btn-ghost {
    background: transparent;
    color: #ecfdf5;
    border-color: rgba(255, 255, 255, 0.28);
}

.topbar-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.45);
    color: #ffffff;
}

#nav-scan-quota {
    display: inline-flex;
    align-items: center;
}

#nav-scan-quota .badge {
    font-size: var(--fs-xs);
}

/* ---- 8.2 Main navigation bar ---------------------------------------------- */
.nusa-navbar {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1030;
    padding: 0;
    min-height: var(--header-h);
    backdrop-filter: blur(12px);
}

.nusa-navbar > .container-fluid {
    max-width: var(--header-max);
    min-height: var(--header-h);
    padding-left: var(--gutter);
    padding-right: var(--gutter);
    column-gap: var(--sp-4);
}

/* Brand */
.brand-logo,
.navbar-brand.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin: 0;
    padding: 0;
    font-size: var(--fs-xl);
    font-weight: var(--fw-extrabold);
    line-height: 1;
    letter-spacing: 0.01em;
    white-space: nowrap;
    color: var(--nusa-primary-dark) !important;
}

.brand-logo > span {
    display: block;
    line-height: 1;
}

body.dark-mode .brand-logo {
    color: #34d399 !important;
}

.brand-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #047857 0%, #10b981 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: var(--fs-lg);
    box-shadow: 0 4px 10px rgba(4, 120, 87, 0.3);
}

/* Primary navigation.
   Space budget is tuned per breakpoint via --nav-pad-x (see 8.3) so the
   bar stays on ONE row without shrinking the type. */
.nusa-nav {
    --nav-pad-x: 0.5rem;
    --bs-navbar-nav-link-padding-x: var(--nav-pad-x);   /* Bootstrap wins on specificity otherwise */
    display: flex;
    align-items: center;
    gap: 0.125rem;
    margin: 0 auto 0 0;
    padding: 0;
    list-style: none;
}

.nusa-nav .nav-item {
    display: flex;
    align-items: center;
}

.nusa-nav .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: var(--control-h);
    padding: 0 var(--nav-pad-x);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    line-height: 1;
    white-space: nowrap;
    color: var(--sidebar-color);
    border-radius: 10px;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.nusa-nav .nav-link > i {
    width: 1rem;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.9375rem;
    line-height: 1;
    color: var(--nusa-gray);
    transition: color var(--transition-fast);
}

/* neutralise legacy per-icon margin/colour utilities inside the nav */
.nusa-nav .nav-link > i[class*="me-"] {
    margin-right: 0 !important;
}

.nusa-nav .nav-link:hover,
.nusa-nav .nav-link:focus-visible,
.nusa-nav .show > .nav-link {
    background: var(--nusa-primary-subtle);
    color: var(--nusa-primary);
}

.nusa-nav .nav-link:hover > i,
.nusa-nav .show > .nav-link > i {
    color: var(--nusa-primary);
}

.nusa-nav .nav-link.active {
    background: var(--nusa-primary-subtle);
    color: var(--nusa-primary-dark);
    box-shadow: inset 0 -2px 0 var(--nusa-primary);
}

.nusa-nav .nav-link.active > i {
    color: var(--nusa-primary);
}

body.dark-mode .nusa-nav .nav-link.active,
body.dark-mode .nusa-nav .nav-link:hover {
    color: #6ee7b7;
}

/* "More" dropdown */
.nusa-nav .dropdown-toggle::after {
    margin: 0 0 0 0.125rem;
    border-width: 0.3em 0.3em 0;
    vertical-align: 0.05em;
}

.nusa-nav .dropdown-menu {
    min-width: 232px;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.nusa-nav .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    line-height: 1.3;
    color: var(--body-color);
    border-radius: 8px;
}

.nusa-nav .dropdown-item > i {
    width: var(--icon-box);
    text-align: center;
    color: var(--nusa-gray);
}

.nusa-nav .dropdown-item:hover,
.nusa-nav .dropdown-item.active {
    background: var(--nusa-primary-subtle);
    color: var(--nusa-primary-dark);
}

body.dark-mode .nusa-nav .dropdown-item:hover,
body.dark-mode .nusa-nav .dropdown-item.active {
    color: #6ee7b7;
}

.nusa-nav .dropdown-item:hover > i,
.nusa-nav .dropdown-item.active > i {
    color: var(--nusa-primary);
}

/* Action cluster: theme / cart / dashboard */
.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-shrink: 0;
}

.nav-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--control-h);
    height: var(--control-h);
    padding: 0;
    flex-shrink: 0;
    font-size: var(--fs-md);
    line-height: 1;
    color: var(--sidebar-color);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.nav-icon-btn > i {
    font-size: 1rem;
    line-height: 1;
}

.nav-icon-btn:hover {
    background: var(--nusa-primary-subtle);
    border-color: var(--nusa-primary-light);
    color: var(--nusa-primary);
}

.nav-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    line-height: 20px;
    text-align: center;
    color: #ffffff;
    background: #dc2626;
    border: 2px solid var(--header-bg);
    border-radius: 999px;
}

.nav-cta {
    padding-left: 1.125rem;
    padding-right: 1.125rem;
    white-space: nowrap;
}

/* Mobile toggler (Bootstrap hides it from the xl breakpoint up; only show below) */
.nusa-navbar .navbar-toggler {
    align-items: center;
    justify-content: center;
    width: var(--control-h);
    height: var(--control-h);
    padding: 0;
    color: var(--nusa-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: none;
}

.nusa-navbar .navbar-toggler:focus-visible {
    outline: 2px solid var(--nusa-primary-light);
    outline-offset: 2px;
}

.nusa-navbar .navbar-toggler > i {
    font-size: var(--fs-xl);
    line-height: 1;
    color: inherit;
}

/* Desktop: keep the expanded bar on ONE row */
@media (min-width: 1200px) {
    .nusa-navbar .navbar-collapse {
        display: flex !important;
        align-items: center;
        flex-wrap: nowrap;
        flex-grow: 1;
        min-width: 0;
    }
}

/* 8.3 Space budget by breakpoint (desktop, expanded bar). Measured widths:
   nav with icons = 931px, nav labels-only = 752px, brand = 172px,
   actions = 237px (full Dashboard) / 136px (icon Dashboard).
   >= 1500    icons + labels, full "Dashboard" button
   1360-1499  icons + labels, Dashboard as icon button
   1280-1359  labels only, full Dashboard button
   1200-1279  labels only, Dashboard as icon button                          */
@media (min-width: 1200px) and (max-width: 1499.98px) {
    .nav-cta {
        width: var(--control-h);
        padding: 0;
    }

    .nav-cta .nav-cta-label {
        display: none;
    }
}

@media (min-width: 1200px) and (max-width: 1359.98px) {
    .nusa-nav .nav-link > i {
        display: none;
    }
}

@media (min-width: 1280px) and (max-width: 1359.98px) {
    .nav-cta {
        width: auto;
        padding: 0 1.125rem;
    }

    .nav-cta .nav-cta-label {
        display: inline;
    }
}

/* Collapsed (tablet / mobile) */
@media (max-width: 1199.98px) {
    .nusa-navbar > .container-fluid {
        row-gap: 0;
    }

    .nusa-navbar .navbar-toggler {
        display: inline-flex;
    }

    .nusa-navbar .navbar-collapse {
        flex-basis: 100%;
        width: 100%;
        max-height: calc(100vh - var(--header-h));
        overflow-y: auto;
        padding: var(--sp-3) 0 var(--sp-5);
        border-top: 1px solid var(--border-color);
    }

    .nusa-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        margin: 0 0 var(--sp-4);
    }

    .nusa-nav .nav-item {
        display: block;
    }

    .nusa-nav .nav-link {
        width: 100%;
        height: 46px;
        padding: 0 var(--sp-4);
    }

    .nusa-nav .dropdown-menu {
        position: static;
        margin: 0.25rem 0 0;
        box-shadow: none;
        background: transparent;
        border: 0;
        border-left: 2px solid var(--border-color);
        border-radius: 0;
        padding: 0 0 0 var(--sp-2);
        margin-left: var(--sp-4);
    }

    .nav-actions {
        flex-wrap: wrap;
        padding-top: var(--sp-4);
        border-top: 1px solid var(--border-color);
    }

    .nav-actions .nav-cta {
        flex: 1 1 auto;
        width: auto;
        padding: 0 1.125rem;
    }

    .nav-actions .nav-cta .nav-cta-label {
        display: inline;
    }
}

/* Dashboard + legacy in-navbar demo buttons share the same visual weight as the topbar */
.nusa-navbar .btn-demo-mode,
.nusa-navbar .btn-nusa-gold {
    min-height: var(--control-h-sm);
    padding: 0.375rem 0.875rem;
    border-radius: 999px;
}

.nusa-navbar .btn-demo-mode {
    white-space: nowrap;
}


/* ==========================================================================
   9. APP SHELL — dashboard sidebar, admin/artisan sidebar
   ========================================================================== */
.app-wrapper {
    display: flex;
    min-height: calc(100vh - var(--header-h));
}

.app-sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    padding: var(--sp-5) 0.875rem;
    transition: all var(--transition-fast);
}

.app-sidebar.collapsed {
    width: 75px;
}

.sidebar-header {
    padding: var(--sp-2) 0.875rem var(--sp-5);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--sp-4);
}

.sidebar-header h6 {
    margin: 0;
    font-size: var(--fs-md);
    font-weight: var(--fw-bold);
    color: var(--nusa-primary-dark);
}

body.dark-mode .sidebar-header h6 {
    color: #34d399;
}

.sidebar-header p {
    margin: 0;
    font-size: var(--fs-xs);
    color: var(--nusa-gray);
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    color: var(--nusa-gray);
    letter-spacing: 0.06em;
    padding: var(--sp-4) 0.875rem var(--sp-2);
}

.sidebar-item {
    margin-bottom: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.875rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-color);
    font-weight: var(--fw-medium);
    font-size: var(--fs-sm);
    line-height: 1.3;
    transition: all var(--transition-fast);
}

.sidebar-link i {
    width: var(--icon-box);
    flex-shrink: 0;
    text-align: center;
    font-size: var(--fs-md);
    color: var(--nusa-gray);
    transition: color var(--transition-fast);
}

.sidebar-link:hover {
    background: var(--nusa-primary-subtle);
    color: var(--nusa-primary);
}

.sidebar-link:hover i {
    color: var(--nusa-primary);
}

.sidebar-link.active {
    background: linear-gradient(135deg, var(--nusa-primary) 0%, var(--nusa-primary-dark) 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(4, 120, 87, 0.25);
}

.sidebar-link.active i {
    color: #ffffff;
}

.app-main {
    flex-grow: 1;
    min-width: 0;
    padding: var(--sp-8) 2.2rem 5rem;
    max-width: 100%;
    overflow-x: hidden;
}

/* Admin / Artisan sidebar (dark) */
.sidebar-ci3 {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
    font-size: var(--fs-sm);
}

.sidebar-ci3 .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.875rem;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    line-height: 1.3;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.sidebar-ci3 .nav-link > i {
    width: var(--icon-box);
    flex-shrink: 0;
    text-align: center;
    font-size: var(--fs-md);
    margin: 0 !important;
}

.sidebar-ci3 .nav-link:not(.active):hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Mobile navigation for admin / artisan (the sidebar is hidden below lg) */
.admin-mobile-nav {
    margin: calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4)) var(--sp-4);
    padding: var(--sp-3) var(--sp-4) 0;
    background: var(--nusa-navy);
    color: #ffffff;
}

.admin-mobile-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding-bottom: var(--sp-3);
    font-size: var(--fs-md);
    font-weight: var(--fw-bold);
    line-height: 1;
    color: #ffffff;
}

.admin-mobile-brand:hover {
    color: #ffffff;
}

.admin-mobile-brand > .badge:last-child:not(:first-child) {
    margin-left: auto;
}

.admin-mobile-scroll {
    display: flex;
    gap: var(--sp-2);
    overflow-x: auto;
    padding-bottom: var(--sp-3);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.admin-mobile-scroll::-webkit-scrollbar {
    display: none;
}

.admin-mobile-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    height: var(--control-h-sm);
    padding: 0 var(--sp-3);
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    line-height: 1;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid transparent;
    border-radius: 999px;
}

.admin-mobile-pill:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.16);
}

.admin-mobile-pill.active {
    color: #ffffff;
    background: var(--nusa-primary);
}

.admin-mobile-pill.is-role {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.5);
    background: transparent;
}


/* ==========================================================================
   10. HERO, MAP, SCAN HUD, AR, CHAT, TRAIL, TOAST
   ========================================================================== */
.hero-section {
    background: radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 20% 80%, rgba(245, 158, 11, 0.1) 0%, transparent 40%),
                linear-gradient(180deg, var(--body-bg) 0%, var(--nusa-cream) 100%);
    padding: 5rem 0 4rem;
    position: relative;
    overflow: hidden;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 0.4rem var(--sp-4);
    background: #ffffff;
    border: 1px solid rgba(4, 120, 87, 0.2);
    border-radius: 30px;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    line-height: 1.4;
    color: var(--nusa-primary-dark);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--sp-6);
}

body.dark-mode .hero-badge {
    background: #1e293b;
    color: #6ee7b7;
    border-color: #334155;
}

.hero-title {
    font-size: var(--fs-5xl);
    font-weight: var(--fw-extrabold);
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: var(--sp-4);
    background: linear-gradient(135deg, #064e3b 0%, #047857 50%, #d97706 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark-mode .hero-title {
    background: linear-gradient(135deg, #ffffff 0%, #34d399 50%, #fbbf24 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: var(--fs-lg);
    line-height: 1.7;
    color: var(--nusa-gray);
    margin-bottom: var(--sp-8);
    max-width: 620px;
}

/* Interactive map hero graphic */
.indonesia-map-visual {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    min-height: 380px;
}

.map-marker-pulse {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: marker-pulse 2s infinite;
}

.map-marker-pulse.gold {
    background: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    animation: marker-pulse-gold 2s infinite;
}

@keyframes marker-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes marker-pulse-gold {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 12px rgba(245, 158, 11, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* NUSA SCAN viewport & HUD */
.scan-camera-frame {
    position: relative;
    background: #000000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
}

.camera-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.85;
    transition: opacity var(--transition-smooth);
}

.scan-hud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5;
}

.scan-reticle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 260px;
    height: 260px;
    max-width: 80%;
    border: 2px dashed rgba(52, 211, 153, 0.5);
    border-radius: 20px;
}

.scan-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border-color: #34d399;
    border-style: solid;
    border-width: 0;
}

.scan-corner.tl { top: -2px; left: -2px; border-top-width: 4px; border-left-width: 4px; border-top-left-radius: 12px; }
.scan-corner.tr { top: -2px; right: -2px; border-top-width: 4px; border-right-width: 4px; border-top-right-radius: 12px; }
.scan-corner.bl { bottom: -2px; left: -2px; border-bottom-width: 4px; border-left-width: 4px; border-bottom-left-radius: 12px; }
.scan-corner.br { bottom: -2px; right: -2px; border-bottom-width: 4px; border-right-width: 4px; border-bottom-right-radius: 12px; }

.scan-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, #34d399 50%, transparent 100%);
    box-shadow: 0 0 15px #34d399;
    animation: scanline-move 2.5s ease-in-out infinite alternate;
}

@keyframes scanline-move {
    0% { top: 10%; }
    100% { top: 90%; }
}

/* AR simulation hologram overlay */
.ar-hologram-container {
    perspective: 1000px;
    width: 100%;
    min-height: 420px;
    position: relative;
    background: radial-gradient(circle, rgba(6, 78, 59, 0.3) 0%, rgba(15, 23, 42, 0.95) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #ffffff;
}

.ar-grid-floor {
    position: absolute;
    bottom: -50px;
    width: 200%;
    height: 200px;
    background-image: linear-gradient(rgba(52, 211, 153, 0.2) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(52, 211, 153, 0.2) 1px, transparent 1px);
    background-size: 30px 30px;
    transform: rotateX(75deg);
}

.ar-object-model {
    width: 240px;
    height: 240px;
    position: relative;
    transform-style: preserve-3d;
    animation: ar-float-rotate 12s linear infinite;
}

@keyframes ar-float-rotate {
    0% { transform: translateY(0px) rotateY(0deg); }
    50% { transform: translateY(-15px) rotateY(180deg); }
    100% { transform: translateY(0px) rotateY(360deg); }
}

.ar-controls-bar {
    position: absolute;
    bottom: 20px;
    display: flex;
    gap: var(--sp-3);
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    padding: var(--sp-2) var(--sp-4);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 10;
}

/* Chatbot NUSA AI */
.ai-chat-window {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    height: 560px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.ai-chat-messages {
    flex-grow: 1;
    padding: var(--sp-6);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.chat-bubble {
    max-width: 80%;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: var(--fs-md);
    line-height: var(--lh-snug);
    overflow-wrap: anywhere;
}

.chat-bubble.ai {
    align-self: flex-start;
    background: var(--nusa-primary-subtle);
    color: var(--nusa-primary-dark);
    border: 1px solid rgba(4, 120, 87, 0.15);
    border-bottom-left-radius: 4px;
}

body.dark-mode .chat-bubble.ai {
    background: rgba(4, 120, 87, 0.25);
    color: #e2e8f0;
    border-color: rgba(52, 211, 153, 0.2);
}

.chat-bubble.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--nusa-primary) 0%, var(--nusa-primary-dark) 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-sm);
}

/* Toast notifications */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    pointer-events: none;
}

.nusa-toast {
    pointer-events: auto;
    background: var(--card-bg);
    color: var(--body-color);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--nusa-primary);
    border-radius: var(--radius-md);
    padding: 0.875rem var(--sp-5);
    min-width: 300px;
    max-width: 420px;
    font-size: var(--fs-sm);
    line-height: var(--lh-snug);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    animation: slide-in-toast 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.nusa-toast.gold {
    border-left-color: var(--nusa-gold);
}

@keyframes slide-in-toast {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Cultural trail step list */
.trail-step-list {
    position: relative;
    padding-left: var(--sp-8);
}

.trail-step-list::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: var(--nusa-primary);
    opacity: 0.3;
}

.trail-step-item {
    position: relative;
    margin-bottom: var(--sp-6);
}

.trail-step-bullet {
    position: absolute;
    left: -2rem;
    top: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--nusa-primary);
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 2px var(--nusa-primary);
}


/* ==========================================================================
   11. MOBILE BOTTOM NAVIGATION
   ========================================================================== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 68px;
    background: var(--header-bg);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    z-index: 1040;
    padding: 0 var(--sp-4) env(safe-area-inset-bottom, 0);
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--nusa-gray);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    line-height: 1.2;
    text-decoration: none;
    flex: 1;
    height: 100%;
    gap: 4px;
    transition: color var(--transition-fast);
}

.mobile-nav-item i {
    font-size: var(--fs-xl);
    line-height: 1;
}

.mobile-nav-item.active {
    color: var(--nusa-primary);
    font-weight: var(--fw-semibold);
}

/* Elevated floating centre scan button */
.mobile-scan-center {
    position: relative;
    top: -18px;
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, #047857 0%, #10b981 100%);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(4, 120, 87, 0.4);
    border: 3px solid var(--header-bg);
    transition: transform var(--transition-fast);
}

.mobile-scan-center:hover {
    transform: scale(1.08);
}

.mobile-scan-center i {
    font-size: var(--fs-2xl);
    line-height: 1;
}


/* ==========================================================================
   12. COMPATIBILITY UTILITIES
   Classes that exist in the markup but had no definition in the stylesheet.
   Defining them restores the intended look (e.g. white hero text on a dark
   emerald gradient, which was previously white-on-white and unreadable).
   ========================================================================== */
/* type helpers */
.text-xs { font-size: var(--fs-xs) !important; }
.text-sm { font-size: var(--fs-sm) !important; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.font-serif { font-family: var(--font-body); }   /* single family site-wide */

/* emerald palette */
.text-emerald { color: var(--nusa-primary) !important; }
.text-emerald-light { color: #6ee7b7 !important; }
.text-purple { color: #9333ea; }
.bg-emerald { background-color: var(--nusa-primary) !important; }
.bg-emerald-light { background-color: var(--nusa-primary-subtle) !important; }
.border-emerald { border-color: var(--nusa-primary) !important; }

.bg-gradient-emerald {
    background: linear-gradient(135deg, var(--nusa-primary-dark) 0%, var(--nusa-primary) 100%);
    color: #ffffff;
}

.bg-gradient-dark {
    background: linear-gradient(135deg, var(--nusa-navy) 0%, var(--nusa-dark) 100%);
    color: #ffffff;
}

.btn-outline-warning {
    --bs-btn-color: #b45309;
    --bs-btn-border-color: #d97706;
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: #d97706;
    --bs-btn-hover-border-color: #d97706;
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: #b45309;
    --bs-btn-active-border-color: #b45309;
}

/* the same outline button on a dark surface keeps the bright yellow */
.bg-dark .btn-outline-warning,
.sidebar-ci3 .btn-outline-warning,
body.dark-mode .btn-outline-warning {
    --bs-btn-color: #fbbf24;
    --bs-btn-border-color: #fbbf24;
    --bs-btn-hover-color: #2b1a00;
    --bs-btn-hover-bg: #fbbf24;
    --bs-btn-hover-border-color: #fbbf24;
}

/* pale "white-50" caption on a saturated colour is ~2:1; give it real contrast */
.bg-success .text-white-50,
.bg-primary .text-white-50,
.bg-danger .text-white-50,
.bg-emerald .text-white-50,
.bg-gradient-emerald .text-white-50 {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Bootstrap's yellow/cyan text is ~1.6:1 on white. Darken them on light surfaces, keep bright on dark. */
.text-warning { color: #b45309 !important; }
.text-info { color: #0e7490 !important; }

.bg-dark .text-warning,
.bg-gradient-dark .text-warning,
.bg-gradient-emerald .text-warning,
.sidebar-ci3 .text-warning,
.nusa-topbar .text-warning,
.modal-header.bg-dark .text-warning,
body.dark-mode .text-warning {
    color: #fbbf24 !important;
}

.bg-dark .text-info,
.bg-gradient-dark .text-info,
.bg-gradient-emerald .text-info,
.sidebar-ci3 .text-info,
.modal-header.bg-dark .text-info,
body.dark-mode .text-info {
    color: #22d3ee !important;
}

/* on dark surfaces the accent and muted text must lighten to stay readable */
.bg-dark .text-emerald,
.bg-gradient-dark .text-emerald,
.bg-gradient-emerald .text-emerald,
.sidebar-ci3 .text-emerald,
.modal-header.bg-dark .text-emerald {
    color: #34d399 !important;
}

.bg-dark .text-muted,
.bg-gradient-dark .text-muted,
.bg-gradient-emerald .text-muted,
.modal-header.bg-dark .text-muted {
    color: #a8b3c4 !important;
}

.btn-emerald {
    background: var(--nusa-primary);
    border: 1px solid var(--nusa-primary);
    color: #ffffff;
}

.btn-emerald:hover,
.btn-emerald:focus-visible {
    background: var(--nusa-primary-dark);
    border-color: var(--nusa-primary-dark);
    color: #ffffff;
}

.btn-outline-emerald {
    background: transparent;
    border: 1px solid currentColor;
    color: var(--nusa-primary);
}

.btn-outline-emerald:hover,
.btn-outline-emerald:focus-visible {
    background: var(--nusa-primary);
    border-color: var(--nusa-primary);
    color: #ffffff !important;
}

/* small helpers */
.btn-xs {
    min-height: 0;
    padding: 0.125rem 0.5rem;
    font-size: var(--fs-xs);
    border-radius: 8px;
}

.hover-white:hover { color: #ffffff !important; }
.hover-warning:hover { color: #fbbf24 !important; }

.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }

.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.max-w-700 { max-width: 700px; }
.ms-n3 { margin-left: -1rem; }

.blink { animation: nusa-blink 1.2s ease-in-out infinite; }

@keyframes nusa-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
    .blink,
    .map-marker-pulse,
    .scan-line,
    .ar-object-model {
        animation: none;
    }

    .btn-nusa-primary:hover,
    .btn-nusa-gold:hover,
    .btn-nusa-outline:hover,
    .stat-card:hover {
        transform: none;
    }
}


/* ==========================================================================
   13. RESPONSIVE
   ========================================================================== */
@media (max-width: 1199.98px) {
    .nusa-topbar-tagline {
        display: none;
    }

    .nusa-topbar-inner {
        justify-content: flex-end;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: -270px;
        top: var(--header-h);
        bottom: 0;
        z-index: 1030;
        overflow-y: auto;
        box-shadow: var(--shadow-lg);
    }

    .app-sidebar.show-mobile {
        left: 0;
    }

    .app-main {
        padding: var(--sp-6) var(--sp-4) 6rem;
    }

    .hero-title {
        font-size: var(--fs-4xl);
    }
}

@media (max-width: 767.98px) {
    :root {
        --gutter: 1rem;
        --header-h: 64px;
        --topbar-h: 40px;
    }

    .brand-icon {
        width: 36px;
        height: 36px;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    /* keep page content clear of the fixed bottom bar */
    body:has(.mobile-bottom-nav) {
        padding-bottom: 76px;
    }

    .hero-section {
        padding: var(--sp-10) 0 var(--sp-8);
    }

    .hero-title {
        font-size: var(--fs-3xl);
    }

    .hero-subtitle {
        font-size: var(--fs-md);
    }

    .stat-card {
        margin-bottom: var(--sp-4);
    }

    .card-ci-header {
        padding: var(--sp-4);
    }

    .card-ci-body {
        padding: var(--sp-5) var(--sp-4);
    }

    /* 16px inputs stop iOS Safari zooming on focus */
    .form-control,
    .form-select {
        font-size: var(--fs-md);
    }

    #toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
    }

    .nusa-toast {
        min-width: 0;
        max-width: none;
    }

    .chat-bubble {
        max-width: 92%;
    }

    .ai-chat-window {
        height: 70vh;
        min-height: 420px;
    }
}

@media (max-width: 767.98px) {
    /* admin/artisan page header: title block and status badge wrap instead of squeezing */
    main > .d-flex.justify-content-between.border-bottom {
        flex-wrap: wrap;
        gap: var(--sp-3);
    }

    /* g-5 (3rem) gutters exceed the 12px container padding and cause sideways scroll */
    .row.g-5,
    .row.gx-5 {
        --bs-gutter-x: 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .topbar-btn {
        padding: 0 var(--sp-3);
    }

    /* long badges wrap instead of pushing the page wider than the screen */
    .badge {
        white-space: normal;
        text-align: left;
    }

    /* segmented filters wrap instead of overflowing */
    .btn-group {
        flex-wrap: wrap;
        max-width: 100%;
    }
}
