/* ==========================================================================
   Pardava site fixes — overlay dim, text brand, initials avatar, cash chip,
   and general tidiness overrides. Loaded LAST in _Layout.cshtml.
   ========================================================================== */

/* ---------- 1) Sidebar overlay: visible dim + correct stacking ---------- */
.app-sidebar__overlay {
    background: rgba(15, 23, 42, 0) !important;
    opacity: 0;
    transition: opacity .25s ease, visibility .25s ease;
    cursor: pointer;
}

@media (max-width: 991px) {
    .app-sidebar__overlay {
        z-index: 7; /* sidebar (8) above, content below */
    }

    .app.sidenav-toggled .app-sidebar__overlay {
        opacity: 1;
        background: rgba(15, 23, 42, .45) !important;
        visibility: visible;
    }
}

@media (min-width: 992px) {
    /* never show the mobile dim layer on desktop, whatever the state */
    .app-sidebar__overlay {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none;
    }
}

/* ---------- 2) Text brand (always renders — no broken image logos) ---------- */
.brand-text {
    display: inline-block;
    font-weight: 800;
    letter-spacing: .5px;
    color: #4d3a8f;
    background: linear-gradient(135deg, #1e3a8a 0%, #2c4a9e 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.side-header .brand-text-full {
    font-size: 1.55rem;
}

.side-header .brand-text-toggled {
    display: none;
    font-size: 1.5rem;
}

.sidebar-mini.sidenav-toggled .side-header .brand-text-full {
    display: none;
}

.sidebar-mini.sidenav-toggled .side-header .brand-text-toggled {
    display: inline-block;
}

/* collapsed side-header keeps a neat square, no grey blob */
.sidebar-mini.sidenav-toggled .side-header {
    text-align: center;
}

/* header (top bar) brand text */
.logo-horizontal .brand-text-header {
    font-size: 1.5rem;
    vertical-align: middle;
}

/* mobile: the template absolutely positions the brand link full-width —
   center the text brand neatly instead of clipping it */
@media (max-width: 991px) {
    .logo-horizontal {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }

    .logo-horizontal .brand-text-header {
        font-size: 1.2rem;
    }
}

/* ---------- 3) Initials avatar for the current user ---------- */
.user-avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: .5px;
    box-shadow: 0 4px 10px rgba(99, 102, 241, .35);
    user-select: none;
}

/* ---------- 4) Cash snapshot chip in header ---------- */
.cash-chip-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .7rem !important;
    border-radius: 30px;
    background: rgba(40, 199, 111, .12);
    color: #1d8a56 !important;
    font-weight: 700;
    font-size: .85rem;
    white-space: nowrap;
}

.cash-chip-link:hover {
    background: rgba(40, 199, 111, .2);
    text-decoration: none;
}

.cash-chip-value {
    font-size: .85rem;
}

/* ---------- 5) KPI cards: icon chip instead of broken oversized canvases ---------- */
.kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
}

.profile-avatar-lg {
    width: 84px;
    height: 84px;
    min-width: 84px;
    font-size: 1.9rem;
    margin: 0 auto;
}

/* ---------- 6) Small tidy-up ---------- */
.app-header .main-header-center .form-control {
    min-width: 150px;
    max-width: 210px;
    padding-inline: .6rem;
    font-size: .83rem;
}

.header-context-selects .form-select {
    max-width: 148px;
    font-size: .8rem;
    padding-inline: .5rem;
}

.header-context-selects {
    gap: .35rem;
}

/* keep every header icon row item on one line and tight */
.app-header .header-right-icons .nav-link.icon {
    padding-inline: .55rem;
}

/* cash chip: compact, hide the value on narrower desktops */
.cash-chip-value {
    font-size: .78rem;
}

@media (max-width: 1399px) {
    .cash-chip-value {
        display: none;
    }
}

.notifications-menu {
    max-height: 320px;
    overflow-y: auto;
    min-width: 300px;
}

.footer {
    padding-bottom: 1rem;
}

/* dashboard "recent orders" style cards removed — keep any leftover
   flot background from ever showing again */
.flot-background {
    display: none !important;
}

/* world-map leftovers never render again */
.world-map.worldh {
    display: none !important;
}

/* ============================================================
   GLOBAL PRELOADER FIXES (پری لودر)
   - compact centered spinner instead of the giant feather image
   - respects dark mode
   - .done fades it out; the inline script removes it from the DOM
   ============================================================ */
#global-loader {
    position: fixed;
    inset: 0;
    z-index: 50000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: #f6f7fb;
    transition: opacity .45s ease, visibility .45s ease;
}
#global-loader .loader-img {
    position: static;
    inset: auto;
    width: auto;
    height: 92px;
    max-width: 160px;
    object-fit: contain;
    animation: pardavaLoaderPulse 1.6s ease-in-out infinite;
}
#global-loader .loader-ring {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(67, 97, 238, .16);
    border-top-color: #4361ee;
    animation: pardavaLoaderSpin .8s linear infinite;
}
#global-loader .loader-caption {
    font-size: .82rem;
    color: #7c8398;
    letter-spacing: .02em;
}
#global-loader.done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
body.dark-mode #global-loader,
.dark-mode #global-loader {
    background: #131722;
}
body.dark-mode #global-loader .loader-caption,
.dark-mode #global-loader .loader-caption {
    color: #8b93a7;
}
@keyframes pardavaLoaderSpin {
    to { transform: rotate(360deg); }
}
@keyframes pardavaLoaderPulse {
    0%, 100% { transform: scale(1); opacity: .88; }
    50% { transform: scale(1.05); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    #global-loader .loader-img,
    #global-loader .loader-ring { animation: none; }
}

/* ===================== Demo mode bar (حالت دمو) ===================== */
#demo-mode-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 14px;
    min-height: 44px;
    background: linear-gradient(90deg, #b45309, #d97706 45%, #b45309);
    color: #fff;
    font-size: .84rem;
    font-weight: 500;
    box-shadow: 0 -4px 18px rgba(180, 83, 9, .35);
}
#demo-mode-bar .demo-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, .7);
    animation: demoDotPulse 1.6s infinite;
    flex: 0 0 auto;
}
#demo-mode-bar .demo-text { line-height: 1.5; }
#demo-mode-bar .demo-reset-btn {
    border: 1px solid rgba(255, 255, 255, .55);
    background: rgba(255, 255, 255, .14);
    color: #fff;
    border-radius: 8px;
    padding: 4px 12px;
    font-size: .78rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background .2s ease;
}
#demo-mode-bar .demo-reset-btn:hover { background: rgba(255, 255, 255, .28); }
#demo-mode-bar .demo-features-link {
    color: #fff;
    font-size: .78rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    opacity: .9;
}
@keyframes demoDotPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .65); }
    70% { box-shadow: 0 0 0 9px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}
.demo-mode-active .page-main { padding-bottom: 56px; }
.demo-mode-active #back-to-top { bottom: 62px; }
@media (max-width: 640px) {
    #demo-mode-bar { font-size: .74rem; gap: 6px; padding: 7px 10px; }
    #demo-mode-bar .demo-text { text-align: center; }
}

/* ============================================================
   Pardava navy identity (سورمه‌ای) — authoritative defaults
   Loaded last; users who picked a custom color in the theme
   switcher keep their own choice via localStorage (inline style).
   ============================================================ */
:root {
    --primary-bg-color: #1e3a8a;
    --primary-bg-hover: #172f6d;
    --primary-bg-border: #2c4a9e;
    --primary: #1e3a8a;
    --transparent-primary: #1e3a8a;
    --primary-transparentcolor: #e7ecf7;
    --darkprimary-transparentcolor: #1d2749;
}
body.dark-mode {
    --primary-transparentcolor: #1d2749;
}

/* selection + focus accents follow the navy */
::selection { background: rgba(30, 58, 138, .22); }
.form-control:focus,
.form-select:focus {
    border-color: #2c4a9e;
    box-shadow: 0 0 0 .2rem rgba(30, 58, 138, .18);
}
.form-check-input:checked { background-color: #1e3a8a; border-color: #1e3a8a; }
.form-check-input:focus { border-color: #2c4a9e; box-shadow: 0 0 0 .2rem rgba(30, 58, 138, .18); }
a.nav-link.active, .nav-pills .nav-link.active { background-color: #1e3a8a !important; }
.dropdown-item.active, .dropdown-item:active { background-color: #1e3a8a !important; }
.page-item.active .page-link {
    background-color: #1e3a8a !important;
    border-color: #1e3a8a !important;
}
.spin-primary { border-top-color: #1e3a8a; }

/* ============================================================
   Persian calendar (تقویم) — pcal-*
   ============================================================ */
.pcal-hero {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 12px; flex-wrap: wrap;
}
.pcal-title { font-size: 1.15rem; font-weight: 700; color: #1e3a8a; }
body.dark-mode .pcal-title { color: #9db4e8; }
.pcal-today { margin-top: 4px; font-size: .95rem; }
.pcal-gtoday { color: #8a94a6; font-size: .82rem; }
.pcal-note { margin-top: 6px; font-size: .8rem; color: #64748b; }
.pcal-note-warn { color: #b45309; }
.pcal-yearnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pcal-yearbtn {
    border: 1px solid #d7dfef; background: #fff; color: #1e3a8a;
    border-radius: 10px; padding: 4px 12px; font-size: .85rem; font-weight: 600;
}
.pcal-yearbtn:hover { background: #e7ecf7; }
body.dark-mode .pcal-yearbtn { background: #232742; border-color: #30354e; color: #9db4e8; }
body.dark-mode .pcal-yearbtn:hover { background: #2b3050; }
.pcal-year-cur {
    min-width: 64px; text-align: center; font-weight: 800; font-size: 1.05rem;
    color: #fff; background: linear-gradient(135deg, #1e3a8a, #2c4a9e);
    border-radius: 10px; padding: 4px 10px;
}
.pcal-btn-now { border-color: #1e3a8a; }
.pcal-stats {
    display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center;
    margin-top: 14px; padding-top: 12px; border-top: 1px dashed #e2e8f0;
}
body.dark-mode .pcal-stats { border-top-color: #30354e; }
.pcal-stat { display: flex; flex-direction: column; }
.pcal-stat-num { font-weight: 800; font-size: 1.1rem; color: #1e3a8a; }
body.dark-mode .pcal-stat-num { color: #9db4e8; }
.pcal-stat-lbl { font-size: .74rem; color: #8a94a6; }
.pcal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: #64748b; margin-inline-start: auto; }
.pcal-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 5px; }
.pcal-legend-h { background: #dc2626; }
.pcal-legend-o { background: #d97706; }
.pcal-legend-f { background: #fca5a5; }
.pcal-legend-t { background: transparent; border: 2px solid #1e3a8a; }

.pcal-card { height: 100%; border: 1px solid #e6ebf5; }
body.dark-mode .pcal-card { border-color: #30354e; }
.pcal-card-today { box-shadow: 0 0 0 2px rgba(30, 58, 138, .35); }
.pcal-month-head {
    display: flex; justify-content: space-between; align-items: center;
    background: linear-gradient(135deg, #eef2fb, #f8fafd); border-bottom: 1px solid #e6ebf5;
}
body.dark-mode .pcal-month-head { background: #232742; border-bottom-color: #30354e; }
.pcal-month-head h6 { font-weight: 700; color: #1e3a8a; }
body.dark-mode .pcal-month-head h6 { color: #9db4e8; }
.pcal-greg { color: #8a94a6; font-size: .72rem; direction: ltr; unicode-bidi: plaintext; }
.pcal-badge {
    font-size: .7rem; font-weight: 700; color: #b91c1c;
    background: #fee2e2; border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
body.dark-mode .pcal-badge { background: #3b1d24; color: #fda4af; }
.pcal-badge-none { color: #64748b; background: #eef1f6; }
body.dark-mode .pcal-badge-none { background: #262a44; color: #8a94a6; }

.pcal-week {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px;
    font-size: .72rem; font-weight: 700; color: #64748b; text-align: center;
    margin-bottom: 4px;
}
.pcal-fri-head { color: #dc2626; }
.pcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.pcal-day {
    position: relative; min-height: 42px; border-radius: 8px;
    background: #f7f9fd; border: 1px solid transparent;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    line-height: 1.15; padding: 2px 1px 8px;
}
body.dark-mode .pcal-day { background: #262a44; }
.pcal-day .d-j { font-weight: 700; font-size: .9rem; color: #26314a; }
body.dark-mode .pcal-day .d-j { color: #cdd6ee; }
.pcal-day .d-g {
    position: absolute; bottom: 2px; inset-inline-end: 4px;
    font-size: .58rem; color: #a2abc0; direction: ltr;
}
.pcal-day.pcal-empty { background: transparent; min-height: 42px; }
.pcal-day.pcal-fri { background: #fef2f2; }
body.dark-mode .pcal-day.pcal-fri { background: #2e2029; }
.pcal-day.pcal-fri .d-j { color: #dc2626; }
.pcal-day.pcal-holiday { background: #fee2e2; border-color: #fecaca; }
body.dark-mode .pcal-day.pcal-holiday { background: #40222a; border-color: #6b2b35; }
.pcal-day.pcal-holiday .d-j { color: #b91c1c; }
body.dark-mode .pcal-day.pcal-holiday .d-j { color: #fda4af; }
.pcal-day.pcal-occasion { background: #fef7e8; }
body.dark-mode .pcal-day.pcal-occasion { background: #3a3222; }
.pcal-day.pcal-today {
    border: 2px solid #1e3a8a; box-shadow: 0 0 0 3px rgba(30, 58, 138, .15);
    background: #e7ecf7;
}
body.dark-mode .pcal-day.pcal-today { background: #232742; }
.pcal-dot {
    position: absolute; top: 3px; inset-inline-start: 3px;
    width: 6px; height: 6px; border-radius: 50%; background: #dc2626;
}
.pcal-dot-occ { background: #d97706; }

.pcal-events {
    margin: 10px 0 0; padding: 0; list-style: none;
    font-size: .76rem; color: #475569;
    max-height: 130px; overflow-y: auto;
}
.pcal-events li { padding: 3px 0; border-top: 1px dashed #eef1f6; }
body.dark-mode .pcal-events { color: #aab4cf; }
body.dark-mode .pcal-events li { border-top-color: #30354e; }
.pcal-events li b { color: #1e3a8a; margin-inline-end: 4px; }
body.dark-mode .pcal-events li b { color: #9db4e8; }
.pcal-events li.is-holiday { color: #b91c1c; }
body.dark-mode .pcal-events li.is-holiday { color: #fda4af; }
.pcal-none { margin-top: 10px; font-size: .76rem; color: #a2abc0; text-align: center; }
