/* ============================================
   داشبورد دانش‌آموز - استایل اختصاصی
   ============================================ */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #eef2ff;
    --gold: #f59e0b;
    --red: #ef4444;
    --green: #22c55e;
    --blue: #3b82f6;
    --purple: #8b5cf6;
    --orange: #f97316;
    --bg: #f1f5f9;
    --white: #ffffff;
    --text: #1e1e2e;
    --text-soft: #64748b;
    --border: #e2e8f0;
    --radius: 20px;
    --radius-sm: 16px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.10);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    width: 100%;
    overflow: hidden;
}

/* ======================
   Login Card
   ====================== */
.login-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--primary);
    text-align: center;
}

.login-card__preview {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 14px;
    padding: 18px 16px;
    margin-bottom: 20px;
    border: 1px solid #f59e0b;
}

.login-card__preview-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.login-card__preview-text {
    font-size: 0.85rem;
    color: #78350f;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.8;
}

.login-card__features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.login-card__features span {
    background: rgba(255, 255, 255, 0.7);
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #92400e;
    text-align: center;
}

.login-card__divider {
    position: relative;
    text-align: center;
    margin-bottom: 16px;
}

.login-card__divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.login-card__divider span {
    position: relative;
    background: var(--white);
    padding: 0 12px;
    font-size: 0.78rem;
    color: var(--text-soft);
    font-weight: 600;
}

/* ======================
   Login Form
   ====================== */
.login-form {
    max-width: 400px;
    margin: 0 auto;
}

.login-form__group {
    margin-bottom: 14px;
    text-align: right;
}

.login-form__label {
    display: block;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--text);
}

.login-form__input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 2px solid var(--border);
    font-family: inherit;
    font-size: 0.9rem;
    background: #f8fafc;
    transition: all 0.3s ease;
}

.login-form__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: var(--white);
}

.login-form__actions {
    margin-top: 20px;
}

.login-form__btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: var(--white);
    border: none;
    border-radius: 50px;
    font-family: inherit;
    font-weight: 900;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
    transition: var(--transition);
}

.login-form__btn:hover {
    transform: scale(1.03);
    box-shadow: 0 10px 32px rgba(99, 102, 241, 0.6);
}

.login-form__error {
    background: #fef2f2;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 12px;
    border: 1px solid #fecaca;
}

.login-notification {
    background: #dcfce7;
    color: #166534;
    padding: 12px 20px;
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    margin-bottom: 20px;
    animation: fadeIn 0.4s ease;
    border: 1px solid #bbf7d0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ======================
   Stats Row
   ====================== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 16px 10px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
    min-width: 0;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card__icon {
    font-size: 1.6rem;
    display: block;
    margin-bottom: 6px;
}

.stat-card__number {
    font-size: 1.4rem;
    font-weight: 900;
    display: block;
    color: #4f46e5;
    line-height: 1.2;
}

.stat-card__label {
    font-size: 0.7rem;
    color: var(--text-soft);
    font-weight: 600;
}

.stat-card__change {
    font-size: 0.68rem;
    font-weight: 700;
    margin-top: 4px;
    display: block;
}

.stat-card__change--up {
    color: #16a34a;
}

.stat-card__change--down {
    color: #dc2626;
}

/* ======================
   Dashboard Grid
   ====================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    min-width: 0;
    overflow: hidden;
}

.dashboard-card__title {
    font-size: 1rem;
    font-weight: 900;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
}

/* ======================
   Chart
   ====================== */
.chart-container {
    height: 250px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0;
    padding-top: 22px;
}

.chart-bar-group {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 100%;
}

.chart-bar {
    width: 70%;
    max-width: 36px;
    border-radius: 6px 6px 0 0;
    transition: height 0.6s ease;
    position: relative;
    cursor: pointer;
    min-height: 16px;
    align-self: flex-end;
}

.chart-bar:hover {
    opacity: 0.8;
    transform: scaleY(1.05);
}

.chart-bar__value {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 800;
    font-size: 0.65rem;
    color: var(--text);
    white-space: nowrap;
}

.chart-bar__label {
    font-size: 0.6rem;
    color: var(--text-soft);
    font-weight: 600;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    white-space: nowrap;
    display: flex;
    align-items: center;
    height: 100%;
}

/* ======================
   Intelligence Bars
   ====================== */
.intel-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.intel-bar-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.intel-bar-item__icon {
    width: 22px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.intel-bar-item__name {
    width: 48px;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.intel-bar-item__bg {
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    min-width: 0;
}

.intel-bar-item__fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s ease;
}

.intel-bar-item__score {
    font-weight: 700;
    font-size: 0.72rem;
    width: 30px;
    text-align: left;
    flex-shrink: 0;
}

/* ======================
   Ranking
   ====================== */
.rank-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}

.rank-item:last-child {
    border-bottom: none;
}

.rank-item__pos {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.75rem;
    flex-shrink: 0;
    background: #f1f5f9;
    color: var(--text-soft);
}

.rank-item__pos--top {
    background: #fef3c7;
    color: #92400e;
}

.rank-item__pos--me {
    background: #6366f1;
    color: var(--white);
}

.rank-item__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-item__score {
    font-weight: 700;
    flex-shrink: 0;
}

/* ======================
   Exam Table
   ====================== */
.exam-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 100%;
}

.exam-table th,
.exam-table td {
    padding: 10px 4px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
}

.exam-table th {
    background: #f8fafc;
    font-weight: 800;
    color: var(--text);
    position: sticky;
    top: 0;
    white-space: nowrap;
}

.exam-table td {
    white-space: nowrap;
}

.exam-table__score {
    font-weight: 700;
}

.exam-table__change--up {
    color: #16a34a;
    font-weight: 700;
}

.exam-table__change--down {
    color: #dc2626;
    font-weight: 700;
}

/* ======================
   Responsive - Tablet
   ====================== */
@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-container {
        height: 220px;
    }

    .chart-bar {
        max-width: 30px;
    }
}

/* ======================
   Responsive - Mobile
   ====================== */
@media (max-width: 500px) {
    .dashboard-container {
        padding: 10px;
    }

    .login-card {
        padding: 18px 14px;
    }

    .login-card__features {
        grid-template-columns: 1fr;
    }

    .login-form__input {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .login-form__btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .stat-card {
        padding: 12px 6px;
    }

    .stat-card__icon {
        font-size: 1.2rem;
    }

    .stat-card__number {
        font-size: 1.1rem;
    }

    .stat-card__label {
        font-size: 0.65rem;
    }

    .stat-card__change {
        font-size: 0.62rem;
    }

    .dashboard-grid {
        gap: 10px;
    }

    .dashboard-card {
        padding: 14px 10px;
    }

    .dashboard-card__title {
        font-size: 0.9rem;
        margin-bottom: 12px;
    }

    .chart-container {
        height: 200px;
        padding-top: 18px;
    }

    .chart-bar-group {
        gap: 4px;
    }

    .chart-bar {
        max-width: 24px;
        border-radius: 4px 4px 0 0;
    }

    .chart-bar__value {
        font-size: 0.58rem;
        top: -18px;
    }

    .chart-bar__label {
        font-size: 0.52rem;
    }

    .intel-bar-item__icon {
        width: 18px;
        font-size: 0.85rem;
    }

    .intel-bar-item__name {
        width: 42px;
        font-size: 0.65rem;
    }

    .intel-bar-item__score {
        width: 24px;
        font-size: 0.65rem;
    }

    .rank-item {
        font-size: 0.75rem;
        padding: 6px 0;
    }

    .rank-item__pos {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }

    .table-wrapper {
        margin: 0 -10px;
        padding: 0 10px;
    }

    .exam-table th,
    .exam-table td {
        padding: 8px 3px;
        font-size: 0.65rem;
    }
}