/* ==========================================================================
   Nirmal Jewels — Premium SaaS Theme Layer
   Loaded after bootstrap.min.css / app.css. Overrides colors, typography,
   shadows and shared components only — does not touch layout mechanics
   (widths/positions) so existing pages keep working unmodified.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Fraunces:ital,opsz,wght@0,9..144,500;1,9..144,500&display=swap');

:root {
    /* Brand palette — deep ink + brushed gold, warm ivory surfaces */
    --nj-ink: #14161f;
    --nj-ink-soft: #1d2130;
    --nj-ink-softer: #262b3d;
    --nj-gold: #b3894a;
    --nj-gold-light: #d8b479;
    --nj-gold-dark: #8f6c37;
    --nj-ivory: #f7f4ee;
    --nj-surface: #ffffff;
    --nj-border: #e7e1d3;
    --nj-text: #23242b;
    --nj-text-muted: #767a86;

    /* Sidebar-only palette — deep emerald + champagne gold. Kept separate
       from --nj-gold above so this reskin stays scoped to the sidebar and
       doesn't recolor buttons/badges/links across the rest of the app. */
    --nj-sb-bg: #0D1F17;
    --nj-sb-bg-soft: #12281E;
    --nj-sb-bg-deep: #081209;
    --nj-sb-gold: #D4AF37;
    --nj-sb-gold-light: #E8CE74;
    --nj-sb-gold-dark: #9C7A22;
    --nj-sb-text: #E0E6E3;
    --nj-sb-text-muted: #fff;
    --nj-sb-border: rgba(212, 175, 55, .16);
    --nj-sb-active-text: #1B2A1B;

    /* Re-point Bootstrap's own variables so every component that already
       reads var(--bs-primary) / var(--bs-primary-rgb) picks up the brand */
    --bs-primary: var(--nj-gold);
    --bs-primary-rgb: 179, 137, 74;
    --bs-body-font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
    --bs-body-color: var(--nj-text);
    --bs-body-bg: var(--nj-ivory);
    --bs-border-radius: .65rem;
    --bs-border-radius-sm: .5rem;
    --bs-border-radius-lg: .85rem;
    --bs-link-color: var(--nj-gold-dark);
    --bs-link-hover-color: var(--nj-ink);
}

html,
body {
    background-color: #fefffe;
    color: var(--nj-text);
    font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    font-weight: 700;
    color: var(--nj-ink);
    letter-spacing: -.01em;
}

a {
    color: var(--bs-link-color);
}

a:hover {
    color: var(--bs-link-hover-color);
}

/* ---- scrollbar ---- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #24321e;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--nj-gold);
}

/* ---- topbar ---- */
.topbar {
    background: var(--nj-surface);
    border-bottom: 1px solid var(--nj-border);
    box-shadow: 0 2px 14px rgba(20, 22, 31, .04);
}

.topbar .navbar .toggle-icon,
.topbar .mobile-toggle-menu {
    color: var(--nj-ink);
}

.user-box .user-info .user-name {
    color: var(--nj-ink);
    font-weight: 600;
}

/* ---- sidebar (deep emerald + champagne gold) ---- */
.sidebar-wrapper {
    background:
        radial-gradient(120% 45% at 12% 0%, rgba(212, 175, 55, .12) 0%, rgba(212, 175, 55, 0) 55%),
        linear-gradient(180deg, var(--nj-sb-bg) 0%, var(--nj-sb-bg-soft) 60%, var(--nj-sb-bg-deep) 100%);
    border-right: none;
    box-shadow: 6px 0 30px rgba(4, 10, 7, .35);
}

.sidebar-wrapper .sidebar-header {
    background: #11251c;
    border-bottom: 1px solid var(--nj-sb-border);
}

.sidebar-wrapper .sidebar-header .toggle-icon {
    color: var(--nj-sb-gold-light);
}

/* brand lockup — logo + two-line "AURUM & DIAMOND / MANAGEMENT" wordmark.
   Markup ships with no styling of its own, so without this the two lines
   run together as unstyled inline text next to the logo. */
.sidebar-wrapper .sidebar-header>div {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    overflow: hidden;
}

.sidebar-wrapper .sidebar-header .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-wrapper .sidebar-header .brand-text .line1 {
    display: block;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--nj-sb-text);
}

.sidebar-wrapper .sidebar-header .brand-text .line2 {
    display: block;
    font-size: 7px;
    font-weight: 600;
    letter-spacing: .1em;
    color: var(--nj-sb-gold-light);
}

.sidebar-wrapper .metismenu a {
    color: var(--nj-sb-text-muted);
    font-weight: 500;
    border-radius: .55rem;
    margin: 0 .5rem;
    border: none;
    box-shadow: inset 0 0 0 rgba(212, 175, 55, 0);
    transition: background .3s ease, box-shadow .3s ease, color .3s ease;
}

.sidebar-wrapper .metismenu>li {
    padding: 0 0 .15rem 0;
}

.sidebar-wrapper .metismenu a .parent-icon {
    color: inherit;
    transition: color .3s ease;
}

/* hover — soft translucent gold overlay + gold left-accent border */
.sidebar-wrapper .metismenu a:hover,
.sidebar-wrapper .metismenu a:focus,
.sidebar-wrapper .metismenu a:active {
    color: #fff;
    background: rgba(212, 175, 55, .10);
    box-shadow: inset 3px 0 0 var(--nj-sb-gold);
}

.sidebar-wrapper .metismenu a:hover .parent-icon,
.sidebar-wrapper .metismenu a:focus .parent-icon,
.sidebar-wrapper .metismenu a:active .parent-icon {
    color: var(--nj-sb-gold-light);
}

/* active/selected — same soft translucent gold overlay + gold left-accent border as hover (no full gradient) */
.sidebar-wrapper .metismenu .mm-active>a {
    color: #fff;
    font-weight: 700;
    background: rgba(212, 175, 55, .10);
    box-shadow: inset 3px 0 0 var(--nj-sb-gold);
}

.sidebar-wrapper .metismenu .mm-active>a .parent-icon {
    color: var(--nj-sb-gold-light);
}

.sidebar-wrapper .metismenu ul {
    background: rgba(255, 255, 255, 0);
    border: none;
    border-radius: .5rem;
}

.sidebar-wrapper .metismenu ul a {
    color: var(--nj-sb-text-muted);
    border: none;
    background: transparent !important;
    box-shadow: none !important;
    animation: none !important;
}

/* Inside submenus (any depth), leave everything untouched except the
   actual selected page link — parent/toggle items that are only
   "mm-active" because a descendant is open (has-arrow) are excluded,
   so only the real active leaf link gets highlighted, and only its
   text color changes. Non-active items and hover get no styling at all. */
.sidebar-wrapper .metismenu ul li.mm-active>a:not(.has-arrow) {
    color: var(--nj-sb-gold-light);
    font-weight: 600;
}

/* leave room at the bottom of the scrollable nav for the fixed footer below */
.sidebar-wrapper .metismenu {
    padding-bottom: 84px;
}

/* ---- sidebar footer (user widget + collapse toggle, pinned to the
   bottom of the sidebar — same fixed-band technique as .sidebar-header
   above it, so it works whether or not SimpleBar's scroll area scrolls) ---- */
.sidebar-footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 12;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem .8rem;
    background: #11251c;
    border-top: 1px solid var(--nj-sb-border);
    transition: width .2s ease-out, left .2s ease-out;
}

.sidebar-user-widget {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex: 1 1 auto;
    min-width: 0;
    padding: .3rem;
    border-radius: .6rem;
    text-decoration: none;
    transition: background .2s ease;
}

.sidebar-user-widget:hover {
    background: rgba(212, 175, 55, .1);
}

.sidebar-user-avatar,
.sidebar-user-avatar-img {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(212, 175, 55, .4);
}

.sidebar-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--nj-sb-gold), var(--nj-sb-gold-dark));
    color: var(--nj-sb-active-text);
    font-weight: 700;
    font-size: .85rem;
}

.sidebar-user-avatar-img {
    object-fit: cover;
}

.sidebar-user-meta {
    min-width: 0;
    overflow: hidden;
    line-height: 1.25;
}

.sidebar-user-name {
    display: block;
    font-size: .82rem;
    font-weight: 700;
    color: var(--nj-sb-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    display: block;
    font-size: .7rem;
    color: var(--nj-sb-gold-light);
    white-space: nowrap;
}

.sidebar-footer .toggle-icon {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--nj-sb-border);
    color: var(--nj-sb-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background .2s ease, color .2s ease;
}

.sidebar-footer .toggle-icon:hover {
    background: var(--nj-sb-gold);
    color: var(--nj-sb-active-text);
}

.sidebar-footer .toggle-icon i {
    transition: transform .3s ease;
}

.wrapper.toggled:not(.sidebar-hovered) .sidebar-footer .toggle-icon i {
    transform: rotate(180deg);
}

/* icon-only collapsed state — mirrors the sidebar-header/metismenu collapse
   rules in app.css so the footer shrinks to match */
@media screen and (min-width: 1025px) {
    .wrapper.toggled:not(.sidebar-hovered) .sidebar-footer {
        width: 70px;
        justify-content: center;
        padding: .65rem;
    }

    .wrapper.toggled:not(.sidebar-hovered) .sidebar-user-widget {
        display: none;
    }
}

/* mobile off-canvas — footer slides with the sidebar and stays hidden
   until the drawer is opened; the desktop collapse button is redundant
   with the topbar hamburger there, so it's hidden like aurum's footer toggle */
@media screen and (max-width: 1024px) {
    .sidebar-footer {
        left: -300px;
    }

    .wrapper.toggled .sidebar-footer {
        left: 0;
    }

    .sidebar-footer .sidebar-collapse-btn {
        display: none;
    }
}

/* ---- cards ---- */
.card {
    background: var(--nj-surface);
    border: 1px solid var(--nj-border);
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(20, 22, 31, .04);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--nj-border);
    font-weight: 700;
    color: var(--nj-ink);
}

.card.radius-10 {
    border-radius: 1rem;
}

/* card top-accent border — every element with the `card` class gets this
   top border color, regardless of border-top/border-primary utility
   classes; plain .border-primary usage on non-card elements (buttons,
   badges, etc.) keeps the normal gold brand color */
.card {
    /* border-top: 3px solid #17291757 !important; */
}

.border-primary {
    border-color: #415f34 !important;
}

/* dashboard stat widgets */
.widgets-icons {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: .8rem;
    font-size: 20px;
}

.text-olive {
    color: #11251c;
}

.bg-light-olive {
    background-color: rgb(17 38 28 / 14%) !important;
}

/* ---- buttons ---- */
.btn {
    border-radius: .6rem;
    font-weight: 600;
    letter-spacing: .01em;
}

.btn-primary {
    --bs-btn-bg: var(--nj-gold);
    --bs-btn-border-color: var(--nj-gold);
    --bs-btn-hover-bg: var(--nj-gold-dark);
    --bs-btn-hover-border-color: var(--nj-gold-dark);
    --bs-btn-active-bg: var(--nj-gold-dark);
    --bs-btn-active-border-color: var(--nj-gold-dark);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    box-shadow: 0 4px 10px rgba(179, 137, 74, .25);
}

.btn-outline-primary {
    --bs-btn-color: var(--nj-gold-dark);
    --bs-btn-border-color: var(--nj-gold);
    --bs-btn-hover-bg: var(--nj-gold);
    --bs-btn-hover-border-color: var(--nj-gold);
}

.btn-dark {
    background: var(--nj-ink);
    border-color: var(--nj-ink);
}

/* ---- forms ---- */
.form-control,
.form-select {
    border-radius: .55rem;
    border-color: var(--nj-border);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--nj-gold);
    box-shadow: 0 0 0 .2rem rgba(179, 137, 74, .18);
}

.form-label {
    font-weight: 600;
    color: var(--nj-ink);
    font-size: .875rem;
}

.select2-container--bootstrap4 .select2-selection {
    border-radius: .55rem !important;
    border-color: var(--nj-border) !important;
}

/* ---- badges / status pills ---- */
.badge {
    font-weight: 600;
    border-radius: 50px;
    padding: .4em .75em;
}

/* ---- tables (chrome only — no font-size/padding changes so PDF/print
   templates that rely on precise cell sizing are unaffected) ---- */
.table> :not(caption)>*>* {
    border-bottom-color: var(--nj-border);
}

.table thead th,
.table .thead-light th,
.table .table-light {
    background-color: #f0dba99e !important;
    color: #000000;
    font-weight: 700;
    border-bottom: 1px solid #000000;
}

.table-hover>tbody>tr:hover>* {
    background-color: rgba(179, 137, 74, .06);
}

/* ---- pagination ---- */
.page-link {
    color: var(--nj-ink);
    border-color: var(--nj-border);
}

.page-item.active .page-link {
    background-color: #23321e99;
    border-color: #24321e;
}

/* ---- modals / dropdowns ---- */
.modal-content {
    border-radius: 1rem;
    border: none;
    box-shadow: 0 20px 60px rgba(20, 22, 31, .18);
}

.modal-header {
    border-bottom: 1px solid var(--nj-border);
}

/* legacy BS4-style `.close` button (markup ships as a bare button + ×
   span, which BS5's CSS no longer styles) — turn it into a proper round
   icon button instead of an unstyled oversized × glyph */
.modal-header .close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    margin: 0 0 0 auto;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--nj-ivory);
    color: var(--nj-text-muted);
    font-weight: 400;
    line-height: 1;
    opacity: 1;
    transition: background .2s ease, color .2s ease;
}

.modal-header .close span {
    display: block;
    transform: translateY(-1px);
}

.modal-header .close:hover {
    background: var(--nj-gold);
    color: #fff;
}

.modal-header .close:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(179, 137, 74, .25);
}

/* crystal/frosted-glass backdrop — blurs whatever is behind the modal
   instead of Bootstrap's flat dark overlay. rgba background (not opacity)
   so the blur itself stays fully visible while the backdrop fades in. */
.modal-backdrop {
    background-color: rgba(20, 22, 31, .35);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
}

.modal-backdrop.show {
    opacity: 1;
}

.dropdown-menu {
    border-radius: .75rem;
    border: 1px solid var(--nj-border);
    box-shadow: 0 12px 32px rgba(20, 22, 31, .12);
}

/* ---- alerts / flash messages ---- */
.alert {
    border-radius: .75rem;
    border: 1px solid transparent;
}

/* ---- breadcrumb / page title ---- */
.breadcrumb-title {
    color: var(--nj-ink);
    font-weight: 700;
}

/* ---- auth / login — split panel matching the sidebar's deep emerald +
   champagne gold treatment, so login is the same visual language as the
   rest of the app instead of a generic Bootstrap card ---- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    background: var(--nj-ivory);
}

.auth-brand-panel {
    position: relative;
    flex: 0 0 44%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    overflow: hidden;
    background:
        radial-gradient(120% 45% at 12% 0%, rgba(212, 175, 55, .16) 0%, rgba(212, 175, 55, 0) 55%),
        linear-gradient(180deg, var(--nj-sb-bg) 0%, var(--nj-sb-bg-soft) 60%, var(--nj-sb-bg-deep) 100%);
}

.auth-brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(212, 175, 55, .06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 175, 55, .06) 1px, transparent 1px);
    background-size: 42px 42px;
    -webkit-mask-image: radial-gradient(120% 80% at 50% 40%, #000 40%, transparent 90%);
    mask-image: radial-gradient(120% 80% at 50% 40%, #000 40%, transparent 90%);
    pointer-events: none;
}

.auth-brand-panel .auth-logo {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(212, 175, 55, .4);
    position: relative;
    z-index: 1;
}

.auth-brand-panel .auth-brand-name {
    position: relative;
    z-index: 1;
    margin-top: 1.5rem;
    font-family: 'Fraunces', serif;
    font-size: 1.9rem;
    font-weight: 500;
    color: var(--nj-sb-text);
    text-align: center;
    letter-spacing: .01em;
}

.auth-brand-panel .auth-brand-tagline {
    position: relative;
    z-index: 1;
    margin-top: .4rem;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--nj-sb-gold-light);
}

.auth-brand-panel .auth-brand-quote {
    position: relative;
    z-index: 1;
    max-width: 320px;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--nj-sb-border);
    text-align: center;
    font-size: .85rem;
    line-height: 1.6;
    color: var(--nj-sb-text-muted);
    opacity: .75;
}

.auth-form-panel {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-card h3 {
    font-weight: 700;
    color: var(--nj-ink);
}

.auth-card .auth-subtitle {
    color: var(--nj-text-muted);
    font-size: .9rem;
    margin-top: -.5rem;
}

.auth-card .card {
    box-shadow: 0 20px 60px rgba(20, 22, 31, .1);
}

.auth-card .form-check-input:checked {
    background-color: var(--nj-gold);
    border-color: var(--nj-gold);
}

/* login button — a clearly visible emerald green (brand family, but
   brighter than the near-black #10241b card border), scoped to the auth
   card only; .btn-primary stays gold everywhere else */
.auth-btn {
    --bs-btn-bg: #1b7a4d !important;
    --bs-btn-border-color: #1b7a4d !important;
    --bs-btn-hover-bg: #146039 !important;
    --bs-btn-hover-border-color: #146039 !important;
    --bs-btn-active-bg: #146039 !important;
    --bs-btn-active-border-color: #146039 !important;
    box-shadow: 0 4px 10px rgba(27, 122, 77, .35) !important;
    background-color: #00361f;
    color: #fefffe;
}

.auth-btn:hover {
    color: #a6a7a8;
}


@media (max-width: 991.98px) {
    .auth-brand-panel {
        display: none;
    }

    .auth-form-panel {
        flex: 1 1 100%;
    }
}

/* ---- admin dashboard — visual/layout polish only, scoped to .dash-*
   classes so nothing here leaks onto other pages that reuse .page-wrapper
   / .card / .widgets-icons ---- */
.dash-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.dash-header .dash-title {
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-size: 1.6rem;
    color: var(--nj-ink);
    margin: 0;
}

.dash-header .dash-subtitle {
    color: var(--nj-text-muted);
    font-size: .88rem;
    margin: .2rem 0 0;
}

.dash-section-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    color: var(--nj-ink);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.dash-section-title i {
    color: var(--nj-gold-dark);
    font-size: 1.15rem;
}

/* stat cards */
.dash-stat-card {
    height: 100%;
    transition: transform .18s ease, box-shadow .18s ease;
}

.dash-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 32px rgba(20, 22, 31, .1);
}

.dash-stat-card .card-body {
    padding: 1.25rem 1.4rem;
}

.dash-stat-label {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--nj-text-muted);
    margin-bottom: .35rem;
}

.dash-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--nj-ink);
    margin: 0;
    line-height: 1.2;
}

.dash-stat-meta {
    display: block;
    font-size: .74rem;
    color: var(--nj-text-muted);
    margin-top: .2rem;
}

.dash-stat-icon {
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.bg-light-gold {
    background-color: rgba(179, 137, 74, .14) !important;
}

.text-gold {
    color: var(--nj-gold-dark);
}

.bg-light-emerald {
    background-color: rgba(27, 122, 77, .12) !important;
}

.text-emerald {
    color: #1b7a4d;
}

/* chart / table cards */
.dash-card {
    height: 100%;
}

.dash-card .card-header {
    display: flex;
    align-items: center;
    gap: .55rem;
    background: transparent;
    border-bottom: 1px solid var(--nj-border);
    padding: 1.1rem 1.4rem;
    font-weight: 700;
    color: var(--nj-ink);
}

.dash-card .card-header i {
    width: 32px;
    height: 32px;
    border-radius: .6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(179, 137, 74, .14);
    color: var(--nj-gold-dark);
    font-size: 16px;
}

.dash-card .card-body {
    padding: 1.4rem;
}

/* stock summary — lighten the nested-card look (card-in-card reads heavy) */
.dash-stock-metric {
    border: 1px solid var(--nj-border);
    border-radius: .75rem;
    box-shadow: none;
}

.dash-stock-metric+.dash-stock-metric {
    margin-top: 1rem;
}

.dash-card .table thead th {
    font-size: .74rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.dash-card tfoot tr {
    background-color: var(--nj-ink) !important;
    color: #fff;
}