/* ==========================================================================
   JavanehSchool - Dashboard Styles (یکپارچه)
   ادغام: dashboard.css + dashboard-modern.css + dashboard-complete.css
   ========================================================================== */

/* Dark mode overrides for dashboard custom classes */
html.dark-mode .chart-card,
html.dark-mode .quick-access-card,
html.dark-mode .donut-card,
html.dark-mode .top-students-card,
html.dark-mode .top-items-card,
html.dark-mode .stats-card {
    background: var(--bg-card, #1E293B) !important;
    border-color: var(--border-subtle, #334155) !important;
}

html.dark-mode .top-item { background: rgba(255,255,255,0.04); }
html.dark-mode .stat-box-mini { background: rgba(255,255,255,0.05); }
html.dark-mode .donut-legend-label { color: #94A3B8; }
html.dark-mode .dashboard-footer .footer-text { color: #475569; }

/* ==========================================================================
   1. Dashboard Layout
   ========================================================================== */

.dashboard-main {
    background: var(--bg-page);
    min-height: 100vh;
    padding: 1.5rem 2.5rem;
    scroll-behavior: smooth;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ==========================================================================
   2. Dashboard Header
   ========================================================================== */

.dashboard-header,
.dashboard-header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.header-title-section {
    flex: 1;
    min-width: 300px;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-shrink: 0;
}

.header-title {
    font-weight: 600;
    color: var(--primary-color);
}

.header-subtitle { color: rgba(0,0,0,0.6); }

.dashboard-welcome { font-weight: 900; margin-bottom: 0.25rem; }
.dashboard-subtitle { color: var(--text-muted); font-weight: 500; }

.help-button { border-radius: 9999px; border-color: var(--border-subtle); }
.help-button-text { font-weight: 700; font-size: 12px; }

/* ==========================================================================
   3. Stat Cards
   ========================================================================== */

.stat-card {
    border-radius: var(--radius-xl) !important;
    border: 1px solid var(--border-color);
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 7.5rem !important;
    height: 7.5rem !important;
    gap: 1rem !important;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    padding: 1.1rem 1.25rem !important;
    box-sizing: border-box !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

/* یکنواختی ارتفاع همه کارت‌های یک ردیف */
.stat-cards-row > [class*="col-"],
.stat-cards-row > .mud-grid-item { display: flex; }
.stat-cards-row > [class*="col-"] > .stat-card,
.stat-cards-row > .mud-grid-item > .stat-card { width: 100%; }

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(0,0,0,0.02) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: var(--shadow-hover) !important;
}

.stat-card:hover::before { opacity: 1; }

.stat-content {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.25rem !important;
    order: 1 !important;
    text-align: right !important;
}

.stat-label {
    color: var(--text-muted) !important;
    font-weight: 600 !important;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1.1;
    margin-top: 4px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* در صورت طولانی بودن مقدار، فونت کاهش یابد */
.stat-value.stat-value-long  { font-size: 1.3rem; }
.stat-value.stat-value-xlong { font-size: 1.1rem; }

.stat-value-container {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    flex-wrap: wrap !important;
}

.stat-chip { font-size: 9px; }
.stat-icon { font-size: 1.5rem; }

/* Stat Icon Wrappers */
.stat-icon-wrapper {
    padding: 5px !important;
    border-radius: var(--radius-lg) !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    order: 2 !important;
    width: 56px;
    height: 56px;
    opacity: 0.9;
}

.stat-icon-blue    { background: #EFF6FF; }
.stat-icon-orange  { background: #FFF7ED; }
.stat-icon-purple  { background: #FAF5FF; }
.stat-icon-teal    { background: #F0FDFA; }

.stat-icon-bprimary {
    background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
    color: var(--primary-color);
}

.stat-icon-bsuccess {
    background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%);
    color: #059669;
}

.stat-icon-berror {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    color: #DC2626;
}

.stat-icon-bwarning {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    color: #D97706;
}

.stat-icon-binfo {
    background: linear-gradient(135deg, #E0E7FF 0%, #C7D2FE 100%);
    color: var(--info-color);
}

.stat-icon-bcyan {
    background: linear-gradient(135deg, #CFFAFE, #A5F3FC);
    color: darkcyan;
}

.stat-icon-byellow {
    background: linear-gradient(135deg, #FEF9C3, #FDE68A);
    color: #CA8A04;
}

/* ==========================================================================
   4. Chart Cards
   ========================================================================== */

.chart-card {
    padding: 1.5rem !important;
    border-radius: var(--radius-xl) !important;
    background: white;
}

.chart-header { margin-bottom: 1.5rem !important; }
.chart-title { font-weight: 800; }
.chart-subtitle { color: var(--text-muted); font-size: 10px; }

.chart-stats {
    display: flex !important;
    align-items: baseline !important;
    gap: 0.5rem !important;
    justify-content: center !important;
    margin-bottom: 1rem !important;
    margin-top: 0.5rem;
}

.chart-main-value { font-weight: 900; }
.chart-chip { font-size: 9px; }
.chart-container { height: 200px; margin-top: 1rem; }

/* ==========================================================================
   5. Quick Access Card
   ========================================================================== */

.quick-access-card {
    padding: 1.5rem !important;
    border-radius: var(--radius-xl) !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    background: white;
}

.quick-access-title { font-weight: 800; margin-bottom: 1rem; }
.quick-access-stack { flex: 1; }

/* ==========================================================================
   6. Donut / Pie Chart Card
   ========================================================================== */

.donut-card {
    padding: 1.5rem !important;
    border-radius: var(--radius-xl) !important;
    background: white;
}

.donut-title { font-weight: 800; margin-bottom: 1.5rem; }

.donut-chart-container {
    height: 180px;
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.donut-legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.donut-legend-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.donut-dot {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 9999px;
}

.donut-dot-blue  { background: var(--primary-color); }
.donut-dot-lime  { background: #A3E635; }
.donut-dot-orange { background: #F97316; }
.donut-dot-pink  { background: #ec4899; }

.donut-legend-label { font-weight: 500; color: var(--text-secondary); font-size: 11px; }
.donut-legend-value { font-weight: 700; font-size: 11px; }

/* ==========================================================================
   7. Top Students / Podium
   ========================================================================== */

.top-students-card {
    padding: 1.25rem !important;
    border-radius: var(--radius-xl) !important;
}

.podium-base {
    width: 100%;
    border-radius: 0.5rem 0.5rem 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.podium-base-silver {
    height: 3rem;
    background: linear-gradient(to top, #F1F5F9, white);
    padding-bottom: 0.375rem;
}

.podium-base-gold {
    height: 5rem;
    background: linear-gradient(to top, #FEFCE8, white);
    padding-bottom: 0.5rem;
    box-shadow: inset 0 2px 4px 0 rgba(0,0,0,0.06);
}

.podium-base-bronze {
    height: 2rem;
    background: linear-gradient(to top, #FFF7ED, white);
    padding-bottom: 0.375rem;
}

/* ==========================================================================
   8. Top Items Card
   ========================================================================== */

.top-items-card {
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    background: white;
}

.top-items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.top-items-title { font-weight: 800; }
.view-all-button { font-size: 10px; font-weight: 700; }

.top-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: #F9FAFB;
}

.item-avatar { background: rgba(37, 99, 235, 0.1); color: var(--primary-color); }
.item-info { flex: 1; }
.item-name { font-weight: 700; font-size: 11px; }
.item-sales { color: var(--text-muted); font-size: 9px; }
.item-revenue { font-weight: 700; font-size: 11px; color: #10B981; }

.empty-top-items { text-align: center; padding: 2rem; }

/* ==========================================================================
   9. Stats Summary Card
   ========================================================================== */

.stats-card {
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    background: white;
}

.stats-header { display: flex; gap: 1rem; align-items: center; }

.stats-icon-wrapper {
    background: rgba(37, 99, 235, 0.1);
    padding: 0.75rem;
    border-radius: 0.75rem;
}

.stats-header-icon { color: var(--primary-color); font-size: 1.5rem; }
.stats-title { font-weight: 800; }
.stats-subtitle { color: var(--text-muted); font-size: 10px; }

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-row-label { font-weight: 500; color: var(--text-secondary); font-size: 11px; }
.stat-row-value { font-weight: 700; font-size: 13px; }

/* ==========================================================================
   10. AI Assistant Card
   ========================================================================== */

.ai-card {
    padding: 1.25rem !important;
    border-radius: var(--radius-xl) !important;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%) !important;
    color: white !important;
    position: relative;
    overflow: hidden;
    min-height: 320px;
    box-shadow: 0 20px 25px -5px rgba(37, 99, 235, 0.2), 0 10px 10px -5px rgba(37, 99, 235, 0.1) !important;
    transition: background-color 0.3s ease;
}

.ai-card:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #1E3A8A 100%) !important;
}

.ai-card * { color: white !important; }

.ai-bg-circle {
    position: absolute;
    border-radius: 9999px;
    filter: blur(40px);
}

.ai-bg-circle-1 {
    right: -2.5rem;
    top: -2.5rem;
    width: 10rem;
    height: 10rem;
    background: #3B82F6;
    opacity: 0.5;
}

.ai-bg-circle-2 {
    left: -2.5rem;
    bottom: 0;
    width: 8rem;
    height: 8rem;
    background: #60A5FA;
    opacity: 0.3;
}

.ai-content {
    position: relative;
    z-index: 10;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ai-content .mud-input-filled {
    background: rgba(30, 64, 175, 0.3) !important;
    border: none !important;
    border-radius: 0.5rem !important;
    backdrop-filter: blur(4px);
}

.ai-content .mud-select-input {
    color: #DBEAFE !important;
    font-size: 11px !important;
}

.ai-select .mud-input-control { margin-top: 8px; }
.ai-select .mud-input { background: rgba(255,255,255,0.1) !important; color: white !important; border-radius: 8px; }
.ai-select .mud-input-label { color: rgba(255,255,255,0.7) !important; }

/* ==========================================================================
   11. Dashboard Footer
   ========================================================================== */

.dashboard-footer {
    margin-top: 3rem;
    margin-bottom: 1rem;
    padding-bottom: 2rem;
    text-align: center;
}

.footer-text {
    color: #D1D5DB;
    font-weight: 500;
    font-size: 11px;
}

/* ==========================================================================
   12. Responsive Dashboard
   ========================================================================== */

@media (max-width: 960px) {
    .dashboard-main { padding: 1rem 1.5rem; }

    .stat-card { border-radius: 12px; }
    .stat-value { font-size: 1.5rem; }
}

@media (max-width: 600px) {
    .dashboard-main { padding: 1rem; }

    .dashboard-header,
    .dashboard-header-section {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 1.5rem;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .stat-card { border-radius: 12px; }
    .stat-label { font-size: 11px; }
    .stat-value { font-size: 1.25rem; }
    .stat-icon-wrapper { width: 48px; height: 48px; }
}

/* ==========================================================================
   13. Teacher Dashboard  (داشبورد معلم)
   ========================================================================== */

.t-hero {
    background: linear-gradient(135deg, #0f2042 0%, #1a56db 100%);
    border-radius: 20px;
    padding: 28px 32px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}
.t-hero::before {
    content: '';
    position: absolute;
    top: -50px; left: -50px;
    width: 200px; height: 200px;
    border-radius: 50%;
    border: 40px solid rgba(255,255,255,.06);
}
.t-hero::after {
    content: '';
    position: absolute;
    bottom: -60px; right: 10px;
    width: 180px; height: 180px;
    border-radius: 50%;
    border: 35px solid rgba(255,255,255,.05);
}
.t-hero-inner { position: relative; z-index: 1; }

.t-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 20px;
}
@media (max-width: 600px) { .t-stat-grid { grid-template-columns: repeat(2, 1fr); } }

.t-stat-box {
    background: rgba(255,255,255,.13);
    border-radius: 14px;
    padding: 14px 10px;
    text-align: center;
}
.t-stat-n { font-size: 24px; font-weight: 800; color: white; }
.t-stat-l { font-size: 11px; color: rgba(255,255,255,.75); margin-top: 3px; }

.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--mud-palette-text-secondary);
    letter-spacing: .05em;
    text-transform: uppercase;
    margin: 24px 0 14px;
    padding-right: 2px;
}

.class-card {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 16px;
    padding: 18px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    height: 100%;
}
.class-card:hover {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.progress-bar-wrap {
    height: 6px;
    background: var(--mud-palette-divider);
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .4s;
}

.hw-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--mud-palette-divider);
}
.hw-row:last-child { border-bottom: none; }
.hw-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ==========================================================================
   14. Deputy Dashboard  (داشبورد معاون)
   ========================================================================== */

.d-hero {
    background: linear-gradient(135deg, #0a1f3d 0%, #064e3b 100%);
    border-radius: 20px;
    padding: 28px 32px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}
.d-hero::before {
    content: '';
    position: absolute;
    top: -50px; left: -50px;
    width: 200px; height: 200px;
    border-radius: 50%;
    border: 40px solid rgba(255,255,255,.06);
}
.d-hero::after {
    content: '';
    position: absolute;
    bottom: -60px; right: 10px;
    width: 180px; height: 180px;
    border-radius: 50%;
    border: 35px solid rgba(255,255,255,.05);
}
.d-hero-inner { position: relative; z-index: 1; }

.d-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 20px;
}
@media (max-width: 600px) { .d-stat-grid { grid-template-columns: repeat(2, 1fr); } }

.d-stat-box {
    background: rgba(255,255,255,.13);
    border-radius: 14px;
    padding: 14px 10px;
    text-align: center;
}
.d-stat-n { font-size: 24px; font-weight: 800; color: white; }
.d-stat-l { font-size: 11px; color: rgba(255,255,255,.75); margin-top: 3px; }

.stat-card-d {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 0;
    height: 100%;
}

.sec-h {
    font-size: 13px;
    font-weight: 700;
    color: var(--mud-palette-text-secondary);
    letter-spacing: .05em;
    text-transform: uppercase;
    margin: 24px 0 14px;
}

.absent-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--mud-palette-divider);
}
.absent-row:last-child { border-bottom: none; }

.class-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--mud-palette-divider);
}
.class-row:last-child { border-bottom: none; }

.fill-bar {
    width: 100px;
    height: 6px;
    background: var(--mud-palette-divider);
    border-radius: 3px;
    overflow: hidden;
}
.fill-inner {
    height: 100%;
    border-radius: 3px;
    transition: width .4s;
}

.quick-action {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 14px;
    padding: 16px 12px;
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, transform .12s;
}
.quick-action:hover {
    border-color: var(--mud-palette-primary);
    transform: translateY(-3px);
}
/* ==========================================================================
   14. Student Dashboard  (داشبورد معاون)
   ========================================================================== */
.s-hero {
    background: linear-gradient(135deg, #4338ca 0%, #7c3aed 100%);
    border-radius: 20px;
    padding: 28px 32px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
    color: white;
}

    .s-hero::before {
        content: '';
        position: absolute;
        top: -40px;
        left: -40px;
        width: 180px;
        height: 180px;
        border-radius: 50%;
        border: 35px solid rgba(255,255,255,.07);
    }

    .s-hero::after {
        content: '';
        position: absolute;
        bottom: -60px;
        right: 20px;
        width: 200px;
        height: 200px;
        border-radius: 50%;
        border: 40px solid rgba(255,255,255,.05);
    }

.s-hero-inner {
    position: relative;
    z-index: 1;
}

.s-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 20px;
}

@@media (max-width:600px) {
    .s-stat-grid {
        grid-template-columns: repeat(2,1fr);
    }
}

.s-stat-box {
    background: rgba(255,255,255,.13);
    border-radius: 14px;
    padding: 14px 10px;
    text-align: center;
}

.s-stat-n {
    font-size: 24px;
    font-weight: 800;
}

.s-stat-l {
    font-size: 11px;
    color: rgba(255,255,255,.75);
    margin-top: 3px;
}

.s-card {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 14px;
    padding: 18px;
}

.s-hw-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--mud-palette-divider);
}

    .s-hw-row:last-child {
        border-bottom: none;
    }

.s-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.s-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.s-quick-btn {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 14px;
    padding: 18px 14px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, transform .1s;
}

    .s-quick-btn:hover {
        border-color: var(--mud-palette-primary);
        transform: translateY(-3px);
    }

.score-bar-wrap {
    height: 8px;
    background: var(--mud-palette-divider);
    border-radius: 4px;
    margin-top: 4px;
}

.score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .5s ease;
}

.sec-lbl {
    font-size: 11px;
    font-weight: 700;
    color: var(--mud-palette-text-secondary);
    letter-spacing: .1em;
    text-transform: uppercase;
    margin: 20px 0 12px;
}