﻿/* Dashboard UX: needs-attention strip, KPI cards, skeletons, customize panel, polish,
   command palette and quick-actions button. Theme-aware (Radzen variables only). */

/* ---- Needs attention ---- */
.st-attention {
    display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem;
    padding: .65rem .9rem; margin-bottom: .85rem;
    background: var(--rz-panel-background-color);
    color: var(--rz-text-color);
    border: 1px solid var(--rz-base-300);
    border-left: 4px solid var(--rz-warning);
    border-radius: 12px;
}
.st-attention-clear { border-left-color: var(--rz-success); }
.st-attention-title { display: flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .9rem; }
.st-attention-items { display: flex; flex-wrap: wrap; gap: .5rem; }
.st-attention-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .3rem .6rem; font: inherit; font-size: .82rem; cursor: pointer;
    color: var(--rz-text-color);
    background: var(--rz-base-background-color);
    border: 1px solid var(--rz-base-300); border-radius: 999px;
    transition: background .15s, transform .15s, box-shadow .15s;
}
.st-attention-chip:hover { background: var(--rz-base-200); transform: translateY(-1px); }
.st-attention-chip:focus-visible, .st-kpi:focus-visible, .st-customize-btn:focus-visible, .st-fab-btn:focus-visible {
    outline: 2px solid var(--rz-primary); outline-offset: 2px;
}
.st-attention-chip .rz-icon, .st-attention-chip .notranslate { font-size: 1.05rem; }
.st-sev-danger { border-color: var(--rz-danger); }
.st-sev-danger > .rz-icon:first-child { color: var(--rz-danger); }
.st-sev-warn { border-color: var(--rz-warning); }
.st-sev-warn > .rz-icon:first-child { color: var(--rz-warning); }
.st-sev-info > .rz-icon:first-child { color: var(--rz-info); }
.st-chip-go { opacity: .55; }

/* ---- KPI cards ---- */
.st-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: .85rem; }
.st-kpi {
    position: relative; display: flex; flex-direction: column; gap: .15rem; text-align: left;
    padding: .8rem .95rem; font: inherit; cursor: pointer; overflow: hidden;
    color: var(--rz-text-color);
    background: var(--rz-panel-background-color);
    border: 1px solid var(--rz-base-300); border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.st-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, .14); border-color: var(--rz-primary); }
.st-kpi-alert { border-color: var(--rz-danger); }
.st-kpi-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--rz-text-secondary-color); }
.st-kpi-value { font-size: 1.7rem; font-weight: 700; line-height: 1.15; }
.st-kpi-sub, .st-kpi-delta { font-size: .78rem; color: var(--rz-text-secondary-color); }
.st-kpi-delta.st-up { color: var(--rz-success); }
.st-kpi-delta.st-down { color: var(--rz-danger); }
.st-spark { width: 100%; height: 28px; margin-top: .35rem; color: var(--rz-primary); }

/* ---- Skeleton loaders ---- */
.st-dash-skeleton-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: .85rem; }
.st-skeleton {
    border-radius: 14px; min-height: 96px;
    background: linear-gradient(90deg, var(--rz-base-200) 25%, var(--rz-base-300) 37%, var(--rz-base-200) 63%);
    background-size: 400% 100%;
    animation: st-shimmer 1.4s ease infinite;
}
@keyframes st-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---- Customize ---- */
.st-customize-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .85rem; }
.st-customize-btn {
    display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .7rem; font: inherit; font-size: .82rem; cursor: pointer;
    color: var(--rz-text-color); background: var(--rz-base-background-color);
    border: 1px solid var(--rz-base-300); border-radius: 8px;
}
.st-customize-btn:hover { background: var(--rz-base-200); }
.st-customize-panel {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .5rem .8rem;
    color: var(--rz-text-color); background: var(--rz-panel-background-color);
    border: 1px solid var(--rz-base-300); border-radius: 10px;
}
.st-customize-hint { font-size: .78rem; color: var(--rz-text-secondary-color); }
.st-customize-option { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; cursor: pointer; }
.st-customize-reset { font: inherit; font-size: .8rem; cursor: pointer; color: var(--rz-primary); background: none; border: 0; text-decoration: underline; }

/* ---- Polish ---- */
.main-content-grid .dashboard-section { transition: box-shadow .2s ease; }
.main-content-grid .dashboard-section:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, .08); }
.dashboard-section.st-flash { animation: st-flash 1.5s ease; }
@keyframes st-flash { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 25% { box-shadow: 0 0 0 4px var(--rz-primary); } }

@media (max-width: 640px) {
    .st-kpi-row, .st-dash-skeleton-row { grid-template-columns: repeat(2, 1fr); }
    .st-kpi-value { font-size: 1.4rem; }
    .st-attention-items { flex-direction: column; align-items: stretch; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .st-skeleton, .dashboard-section.st-flash { animation: none; }
    .st-kpi, .st-attention-chip { transition: none; }
    .st-kpi:hover, .st-attention-chip:hover { transform: none; }
}

/* ---- Command palette ---- */
.st-cp-overlay { position: fixed; inset: 0; z-index: 10000; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; background: rgba(0, 0, 0, .45); }
.st-cp-overlay[hidden] { display: none; }
.st-cp-box { width: min(560px, 92vw); max-height: 70vh; display: flex; flex-direction: column; overflow: hidden; color: var(--rz-text-color); background: var(--rz-panel-background-color); border: 1px solid var(--rz-base-300); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.st-cp-input { padding: .9rem 1rem; font: inherit; font-size: 1rem; color: var(--rz-text-color); background: var(--rz-base-background-color); border: 0; border-bottom: 1px solid var(--rz-base-300); outline: none; }
.st-cp-list { overflow-y: auto; padding: .35rem; }
.st-cp-row { display: flex; align-items: center; gap: .6rem; padding: .5rem .65rem; border-radius: 8px; cursor: pointer; }
.st-cp-row:hover, .st-cp-active { background: var(--rz-base-200); }
.st-cp-icon { font-size: 1.2rem; color: var(--rz-primary); }
.st-cp-text { flex: 1; }
.st-cp-group { font-size: .75rem; color: var(--rz-text-secondary-color); }
.st-cp-empty { padding: 1rem; text-align: center; color: var(--rz-text-secondary-color); }
.st-cp-foot { padding: .4rem .8rem; font-size: .72rem; color: var(--rz-text-secondary-color); border-top: 1px solid var(--rz-base-300); }

/* ---- Quick actions ---- */
.st-fab { position: fixed; right: 1.25rem; bottom: 5.5rem; z-index: 900; display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; }
.st-fab-btn { width: 52px; height: 52px; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: var(--rz-on-primary, #fff); background: var(--rz-primary); box-shadow: 0 6px 18px rgba(0, 0, 0, .3); transition: transform .15s; }
.st-fab-btn:hover { transform: scale(1.06); }
.st-fab-menu { display: flex; flex-direction: column; gap: .35rem; align-items: flex-end; }
.st-fab-menu[hidden] { display: none; }
.st-fab-item { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .8rem; font: inherit; font-size: .85rem; cursor: pointer; color: var(--rz-text-color); background: var(--rz-panel-background-color); border: 1px solid var(--rz-base-300); border-radius: 999px; box-shadow: 0 3px 10px rgba(0, 0, 0, .2); }
.st-fab-item:hover { background: var(--rz-base-200); }
.st-fab-item .rzi { font-size: 1.1rem; color: var(--rz-primary); }
@media print { .st-fab, .st-cp-overlay, .st-customize-bar { display: none !important; } }

/* ---- Pinned students launcher (sits left of the quick-actions button) ---- */
.st-pins { position: fixed; right: 5.25rem; bottom: 5.5rem; z-index: 900; display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; }
.st-pins-btn { width: 52px; height: 52px; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: var(--rz-on-secondary, #fff); background: var(--rz-secondary); box-shadow: 0 6px 18px rgba(0, 0, 0, .3); transition: transform .15s; }
.st-pins-btn:hover { transform: scale(1.06); }
.st-pins-btn:focus-visible { outline: 2px solid var(--rz-primary); outline-offset: 2px; }
.st-pins-backdrop { position: fixed; inset: 0; z-index: -1; }
.st-pins-menu { min-width: 230px; max-width: 300px; max-height: 60vh; overflow-y: auto; padding: .35rem; color: var(--rz-text-color); background: var(--rz-panel-background-color); border: 1px solid var(--rz-base-300); border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.st-pins-title { display: flex; align-items: center; gap: .4rem; padding: .4rem .6rem; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--rz-text-secondary-color); }
.st-pins-item { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .45rem .6rem; font: inherit; text-align: left; cursor: pointer; color: var(--rz-text-color); background: none; border: 0; border-radius: 8px; }
.st-pins-item:hover, .st-pins-item:focus-visible { background: var(--rz-base-200); outline: none; }
.st-pins-avatar { flex: none; width: 30px; height: 30px; display: grid; place-items: center; font-size: .75rem; font-weight: 600; border-radius: 50%; color: var(--rz-on-primary, #fff); background: var(--rz-primary); }
.st-pins-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-pins-empty { padding: .6rem; font-size: .85rem; color: var(--rz-text-secondary-color); }
@media print { .st-pins { display: none !important; } }

/* ---- Rich KPI cards ---- */
.st-kpi-row:has(.st-kpi-lg) { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.st-kpi-lg { flex-direction: row; align-items: center; gap: .9rem; padding: 1rem 1.1rem; }
.st-kpi-lg::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--rz-primary); }
.st-kpi-tuition::before { background: var(--rz-warning); }
.st-kpi-tuition.st-kpi-alert::before { background: var(--rz-danger); }
.st-kpi-icon { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; color: var(--rz-primary); background: var(--rz-base-200); }
.st-kpi-tuition .st-kpi-icon { color: var(--rz-warning); }
.st-kpi-tuition.st-kpi-alert .st-kpi-icon { color: var(--rz-danger); }
.st-kpi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.st-kpi-value small { font-size: .8rem; font-weight: 500; color: var(--rz-text-secondary-color); }
.st-kpi-value .st-kpi-muted { font-weight: 400; }
.st-progress { display: block; height: 6px; border-radius: 999px; background: var(--rz-base-300); overflow: hidden; }
.st-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--rz-success); transition: width .4s ease; }
.st-progress-danger > span { background: var(--rz-danger); }
.st-bars { flex: none; display: flex; align-items: flex-end; gap: 3px; width: 96px; height: 52px; }
.st-bars > span { flex: 1; border-radius: 3px 3px 0 0; background: var(--rz-base-400, var(--rz-base-300)); }
.st-bars > .st-bar-last { background: var(--rz-primary); }
@media (max-width: 640px) { .st-kpi-row:has(.st-kpi-lg) { grid-template-columns: 1fr; } .st-bars { display: none; } }

/* ---- Header logo icon ---- */
.st-header-logo { flex: none; display: inline-flex; align-items: center; margin: 0 .6rem 0 .25rem; border-radius: 8px; }
.st-header-logo img { height: 32px; width: 32px; display: block; }
.st-header-logo:hover { opacity: .85; }
.st-header-logo:focus-visible { outline: 2px solid var(--rz-primary); outline-offset: 2px; }

/* ---- Today at a glance ---- */
.st-glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.st-glance-card { background: var(--rz-panel-background-color); color: var(--rz-text-color); border: 1px solid var(--rz-base-300); border-radius: 12px; padding: 1rem 1.1rem; }
.st-glance-title { display: flex; align-items: center; gap: .4rem; font-weight: 600; margin-bottom: .6rem; }
.st-glance-title .rzi { color: var(--rz-primary); }
.st-glance-sub { font-weight: 400; font-size: .8rem; color: var(--rz-text-secondary-color); }
.st-glance-link { margin-left: auto; font-size: .8rem; font-weight: 500; color: var(--rz-primary); text-decoration: none; }
.st-glance-big { font-size: 1.8rem; font-weight: 700; line-height: 1.1; margin-bottom: .5rem; }
.st-glance-row { display: flex; justify-content: space-between; gap: .75rem; padding: .3rem 0; border-top: 1px solid var(--rz-base-200); font-size: .88rem; }
.st-glance-key { color: var(--rz-text-secondary-color); flex: none; }
.st-glance-row > span:last-child { text-align: right; }
.st-glance-empty { color: var(--rz-text-secondary-color); font-size: .9rem; }
.st-glance-empty a { color: var(--rz-primary); }
.st-glance-warn { margin-top: .5rem; color: var(--rz-warning); font-size: .85rem; display: flex; align-items: center; gap: .3rem; }
.st-glance-bad { color: var(--rz-danger); font-weight: 600; }

/* ---- Section ordering: operational content first, notification/pinned strips after the main sections ---- */
.modern-dashboard { display: flex; flex-direction: column; }
.modern-dashboard > * { min-width: 0; }
/* Order: banner/top row, needs-attention, notifications + pinned, then KPI cards, glance cards and sections */
.modern-dashboard > .st-after-ops { order: 1; }
.modern-dashboard > .st-attention { order: 2; }
.modern-dashboard > .st-after-ops[data-tour='pinned-students'] { order: 3; }
.modern-dashboard > .st-kpi-row, .modern-dashboard > .st-dash-skeleton-row, .modern-dashboard > .st-glance, .modern-dashboard > .main-content-grid { order: 4; }
.st-glance-ico { font-size: 1.1rem !important; vertical-align: middle; margin-right: .25rem; color: var(--rz-primary); }
.st-glance-ico-lg { font-size: 1.6rem !important; margin-right: .4rem; }

/* ---- Header org name: follow the theme's header text color so it is readable on any header background ---- */
.st-header-org, .st-header-org .rz-dropdown-label, .st-header-org .rz-dropdown-trigger .rzi, .st-header-org .rz-dropdown-trigger-icon { color: var(--rz-header-color, var(--rz-text-color)) !important; text-shadow: none; opacity: 1 !important; }
.st-header-org .rz-dropdown-trigger { background: transparent !important; }
/* ---- Clickable glance rows ---- */
a.st-glance-click { color: inherit; text-decoration: none; cursor: pointer; border-radius: 6px; transition: background .15s ease; }
a.st-glance-row.st-glance-click:hover { background: var(--rz-base-200); }
a.st-glance-warn.st-glance-click { color: var(--rz-warning); }
a.st-glance-click:focus-visible { outline: 2px solid var(--rz-primary); outline-offset: 1px; }
