/* ═══ حساب کاربری دانش‌آموز — هویت، اشتراک، امنیت ═══ */

.account-theme {
    --acc-ink: #1e1b4b;
    --acc-muted: #64748b;
    --acc-surface: rgba(255, 255, 255, 0.88);
    --acc-border: rgba(99, 102, 241, 0.16);
    --acc-accent: #4f46e5;
    --acc-accent-soft: rgba(79, 70, 229, 0.1);
    --acc-teal: #0d9488;
    --acc-teal-soft: rgba(13, 148, 136, 0.1);
    --acc-sky: #0284c7;
    --acc-sky-soft: rgba(2, 132, 199, 0.1);
    --acc-amber: #d97706;
    --acc-ok: #059669;
    --acc-danger: #dc2626;
}

.account-theme .orb-1 {
    background: radial-gradient(circle, rgba(79, 70, 229, 0.32), transparent 70%);
}
.account-theme .orb-2 {
    background: radial-gradient(circle, rgba(13, 148, 136, 0.22), transparent 70%);
}
.account-theme .orb-3 {
    background: radial-gradient(circle, rgba(2, 132, 199, 0.18), transparent 70%);
}

.account-main {
    max-width: 960px;
    margin: 0 auto;
}

/* ── Hero ── */
.account-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px 22px 20px;
    margin-bottom: 14px;
    border-radius: 22px;
    border: 1px solid rgba(79, 70, 229, 0.22);
    background:
        linear-gradient(125deg, rgba(79, 70, 229, 0.14) 0%, rgba(13, 148, 136, 0.08) 48%, rgba(255, 255, 255, 0.55) 100%);
    box-shadow: 0 14px 36px rgba(79, 70, 229, 0.1);
    animation: accountRise 0.45s ease both;
}

.account-hero-glow {
    position: absolute;
    inset-inline-end: -60px;
    top: -70px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.22), transparent 68%);
    pointer-events: none;
}

.account-hero-avatar {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    width: 68px;
    height: 68px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(145deg, #4338ca, #0d9488);
    box-shadow: 0 10px 24px rgba(67, 56, 202, 0.35);
    letter-spacing: -0.02em;
}

.account-hero-body {
    position: relative;
    z-index: 1;
    min-width: 0;
    flex: 1;
}

.account-hero-eyebrow {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--acc-accent);
    margin-bottom: 2px;
    letter-spacing: 0.02em;
}

.account-hero h1 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--acc-ink);
    margin: 0 0 4px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    font-size: 0.8rem;
    color: var(--acc-muted);
    margin: 0 0 10px;
}

.account-hero-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(100, 116, 139, 0.45);
}

.account-hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.account-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--acc-border);
    color: var(--acc-ink);
}

.account-pill-status.is-active {
    background: rgba(5, 150, 105, 0.12);
    border-color: rgba(5, 150, 105, 0.28);
    color: #047857;
}
.account-pill-status.is-free {
    background: rgba(13, 148, 136, 0.12);
    border-color: rgba(13, 148, 136, 0.28);
    color: #0f766e;
}
.account-pill-status.is-warning {
    background: rgba(217, 119, 6, 0.12);
    border-color: rgba(217, 119, 6, 0.3);
    color: #b45309;
}
.account-pill-status.is-expired {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.28);
    color: #b91c1c;
}

/* ── Jump nav ── */
.account-jump {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 2px 12px;
    margin-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    animation: accountRise 0.45s ease 0.06s both;
}
.account-jump::-webkit-scrollbar { display: none; }

.account-jump-link {
    flex-shrink: 0;
    padding: 8px 14px;
    border-radius: 12px;
    border: 1px solid var(--acc-border);
    background: rgba(255, 255, 255, 0.65);
    color: var(--acc-muted);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 700;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.account-jump-link:hover {
    color: var(--acc-accent);
    border-color: rgba(79, 70, 229, 0.35);
    background: var(--acc-accent-soft);
    transform: translateY(-1px);
}

/* ── Layout grid ── */
.account-layout {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 14px;
    align-items: start;
    animation: accountRise 0.5s ease 0.1s both;
}

.account-panel-wide { grid-column: 1 / -1; }

.account-panel {
    background: var(--acc-surface);
    border: 1px solid var(--acc-border);
    border-radius: 20px;
    padding: 20px;
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 28px rgba(30, 27, 75, 0.04);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.account-panel:hover {
    border-color: rgba(79, 70, 229, 0.28);
    box-shadow: 0 12px 32px rgba(79, 70, 229, 0.07);
}

.account-panel-accent {
    background:
        linear-gradient(160deg, rgba(79, 70, 229, 0.08), rgba(255, 255, 255, 0.9) 42%);
    border-color: rgba(79, 70, 229, 0.22);
}

.account-panel-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.account-panel-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.account-panel-icon svg {
    width: 20px;
    height: 20px;
}

.account-panel-icon-sub {
    background: var(--acc-accent-soft);
    color: var(--acc-accent);
}
.account-panel-icon-ai {
    background: rgba(168, 85, 247, 0.12);
    color: #7c3aed;
}
.account-panel-icon-profile {
    background: rgba(14, 165, 233, 0.12);
    color: #0284c7;
}
.account-panel-icon-tg {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}
.account-panel-icon-doc {
    background: rgba(13, 148, 136, 0.12);
    color: #0f766e;
}
.account-panel-icon-lock {
    background: rgba(217, 119, 6, 0.12);
    color: #b45309;
}

.account-panel-head h2 {
    font-size: 1.02rem;
    font-weight: 800;
    margin: 0 0 2px;
    color: var(--acc-ink);
}

.account-panel-sub {
    margin: 0;
    font-size: 0.8rem;
    color: var(--acc-muted);
    line-height: 1.55;
}

.sub-status-active { color: var(--acc-ok) !important; font-weight: 700; }
.sub-status-warning { color: var(--acc-amber) !important; font-weight: 700; }
.sub-status-expired { color: var(--acc-danger) !important; font-weight: 700; }
.sub-status-free { color: #0f766e !important; font-weight: 700; }

/* ── Subscription metrics ── */
.account-sub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.account-sub-item {
    padding: 12px 13px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.18);
    transition: transform 0.15s, border-color 0.15s;
}
.account-sub-item:hover {
    transform: translateY(-1px);
    border-color: rgba(79, 70, 229, 0.3);
}
.account-sub-item span {
    display: block;
    font-size: 0.7rem;
    color: var(--acc-muted);
    margin-bottom: 4px;
}
.account-sub-item strong {
    font-size: 0.86rem;
    line-height: 1.4;
    color: var(--acc-ink);
}
.account-sub-item.highlight {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(13, 148, 136, 0.08));
    border-color: rgba(79, 70, 229, 0.3);
}
.account-sub-item.highlight strong { color: var(--acc-accent); }

.account-sub-empty {
    color: var(--acc-muted);
    font-size: 0.86rem;
    padding: 8px 0;
}

.account-sub-history {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed rgba(79, 70, 229, 0.22);
}
.account-sub-history h3 {
    font-size: 0.88rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--acc-ink);
}
.account-sub-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.account-history-row {
    display: grid;
    grid-template-columns: 1.4fr 1.2fr auto;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.16);
}
.account-history-main strong {
    display: block;
    font-size: 0.88rem;
}
.account-history-meta {
    display: block;
    font-size: 0.7rem;
    color: var(--acc-muted);
    margin-top: 2px;
}
.account-history-dates {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 0.78rem;
    color: var(--acc-muted);
    flex-wrap: wrap;
}
.account-history-status {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.1);
    color: var(--acc-muted);
    white-space: nowrap;
}
.account-history-status.on {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}
.account-history-status.off {
    background: rgba(148, 163, 184, 0.16);
    color: #475569;
}

/* ── AI Quota ── */
.account-quota-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr;
}

.account-quota-card {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(168, 85, 247, 0.18);
}
.account-quota-card.blocked {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.07);
}
.account-quota-card h3 {
    font-size: 0.88rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--acc-ink);
}

.quota-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quota-stat {
    padding: 0;
    background: none;
    border: none;
}
.quota-stat-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}
.quota-stat span {
    font-size: 0.7rem;
    color: var(--acc-muted);
    font-weight: 600;
}
.quota-stat strong {
    font-size: 0.84rem;
    color: var(--acc-ink);
}
.quota-stat small {
    display: block;
    font-size: 0.68rem;
    color: #7c3aed;
    margin-top: 5px;
}

.quota-bar {
    height: 7px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.1);
    overflow: hidden;
}
.quota-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6366f1, #0d9488);
    transition: width 0.45s ease;
    min-width: 0;
}
.quota-bar-fill.is-warn {
    background: linear-gradient(90deg, #f59e0b, #ea580c);
}
.quota-bar-fill.is-full {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}
.quota-bar-fill.is-unlimited {
    width: 100% !important;
    background: linear-gradient(90deg, #14b8a6, #0d9488);
}

.quota-blocked {
    font-size: 0.74rem;
    color: #b45309;
    margin-top: 10px;
    line-height: 1.5;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.1);
}

/* ── Profile form ── */
.account-profile-form .sf-field { margin-bottom: 0; }

.account-avatar-uploader {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 14px;
    padding: 12px;
    border-radius: 14px;
    border: 1px dashed rgba(99, 102, 241, 0.35);
    background: rgba(79, 70, 229, 0.05);
}

.account-avatar-preview {
    width: 62px;
    height: 62px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(145deg, #4338ca, #0d9488);
    overflow: hidden;
    flex-shrink: 0;
}

.account-avatar-preview img,
.account-hero-avatar.has-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.account-hero-avatar.has-photo {
    padding: 0;
    overflow: hidden;
    background: #1e1433;
    color: transparent;
}

.account-avatar-tools {
    min-width: 0;
    flex: 1;
}

.account-avatar-hint {
    margin: 0 0 8px;
    font-size: 0.78rem;
    color: var(--acc-muted);
}

.account-avatar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.account-avatar-pick {
    cursor: pointer;
}

.account-form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 14px;
    margin-bottom: 14px;
}
.account-field-span { grid-column: 1 / -1; }

.sf-field input.readonly,
.sf-field select:disabled {
    background: rgba(15, 23, 42, 0.04);
    color: var(--acc-muted);
    cursor: not-allowed;
}

.account-exams {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 2px 0;
}

.account-exam-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
.account-exam-chip:hover {
    border-color: rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}
.account-exam-chip:has(input:checked) {
    background: var(--acc-accent-soft);
    border-color: rgba(79, 70, 229, 0.4);
    color: var(--acc-accent);
    font-weight: 700;
}
.account-exam-chip input { accent-color: var(--acc-accent); }
.account-exams-empty { color: var(--acc-muted); font-size: 0.84rem; }

/* ── Credentials overrides ── */
.account-theme .credentials-status {
    border-radius: 12px;
}
.account-btn-recover {
    border: 1px solid rgba(217, 119, 6, 0.4);
    background: rgba(254, 243, 199, 0.85);
    color: #b45309;
    border-radius: 10px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}
.account-btn-recover:hover {
    background: rgba(253, 230, 138, 0.95);
    transform: translateY(-1px);
}
.account-btn-recover:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* dashboard shortcut card */
.dash-tool-card.account-tool {
    background: linear-gradient(145deg, #4338ca, #0d9488);
    box-shadow: 0 8px 24px rgba(67, 56, 202, 0.28);
}

@keyframes accountRise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

/* ── Responsive ── */
@media (max-width: 860px) {
    .account-layout { grid-template-columns: 1fr; }
    .account-panel-wide { grid-column: auto; }
}

@media (max-width: 720px) {
    .account-history-row { grid-template-columns: 1fr; gap: 6px; }
    .account-form-grid-2 { grid-template-columns: 1fr; }
    .account-field-span { grid-column: auto; }
    .account-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 18px;
    }
    .account-hero h1 { white-space: normal; font-size: 1.2rem; }
    .account-avatar-uploader {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .account-hero,
    .account-jump,
    .account-layout,
    .account-sub-item,
    .account-exam-chip,
    .account-jump-link,
    .quota-bar-fill {
        animation: none !important;
        transition: none !important;
    }
}

html[data-theme="dark"] .account-theme {
    --acc-ink: #eceeff;
    --acc-muted: #aeb7d5;
    --acc-surface: rgba(22, 26, 45, 0.9);
    --acc-border: rgba(129, 140, 248, 0.24);
    --acc-accent-soft: rgba(129, 140, 248, 0.16);
}

html[data-theme="dark"] .account-theme .account-jump-link,
html[data-theme="dark"] .account-theme .account-sub-item,
html[data-theme="dark"] .account-theme .account-history-row,
html[data-theme="dark"] .account-theme .account-quota-card,
html[data-theme="dark"] .account-theme .account-exam-chip,
html[data-theme="dark"] .account-theme .account-btn-recover {
    background: rgba(30, 36, 62, 0.92);
    color: var(--acc-ink);
    border-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .account-theme .account-panel-accent {
    background: linear-gradient(165deg, rgba(99, 102, 241, 0.14), rgba(22, 26, 45, 0.92) 50%);
}

html[data-theme="dark"] .account-theme .sf-field input,
html[data-theme="dark"] .account-theme .sf-field select,
html[data-theme="dark"] .account-theme .account-field input {
    background: #171c32;
    color: #eef2ff;
    border-color: rgba(148, 163, 184, 0.25);
}

html[data-theme="dark"] .account-theme .sf-field label,
html[data-theme="dark"] .account-theme .account-field label,
html[data-theme="dark"] .account-theme .account-panel-sub,
html[data-theme="dark"] .account-theme .account-hero-meta,
html[data-theme="dark"] .account-theme .quota-stat span,
html[data-theme="dark"] .account-theme .account-exams-empty {
    color: var(--acc-muted);
}

.account-danger-panel {
    border-color: rgba(239, 68, 68, 0.28);
    background: linear-gradient(165deg, rgba(239, 68, 68, 0.08), var(--acc-surface) 48%);
}
.account-panel-icon-danger {
    background: rgba(239, 68, 68, 0.14);
    color: #ef4444;
}
.sf-btn-danger {
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}
.sf-btn-danger:disabled { opacity: 0.6; cursor: wait; }
.account-modal-overlay {
    position: fixed; inset: 0; z-index: 80;
    background: rgba(15, 18, 28, 0.55);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.account-modal-overlay.hidden { display: none !important; }
.account-modal {
    width: min(420px, 100%);
    background: var(--acc-surface, #fff);
    border: 1px solid var(--acc-border, rgba(0,0,0,0.08));
    border-radius: 16px;
    padding: 18px 18px 14px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.25);
}
.account-modal h3 { margin: 0 0 8px; font-size: 1.05rem; }
.account-modal p { margin: 0 0 16px; color: var(--acc-muted, #64748b); font-size: 0.88rem; line-height: 1.55; }
.account-modal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
