/* ============================================================
   منصة المعلم — إضافات على app.css (لا تعدّل app.css نفسه)
   ============================================================ */

/* ---------- حقول التسجيل ---------- */
.field-error {
    display: block;
    margin-top: 6px;
    color: var(--danger);
    font-size: .82rem;
    font-weight: 600;
}

.field.has-error input {
    border-color: var(--danger);
    background: #fff8f8;
}

.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.segment {
    position: relative;
    cursor: pointer;
}

.segment input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segment span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
    font-weight: 700;
    color: var(--ink);
    transition: .18s ease;
}

.segment:hover span {
    border-color: #b9bbff;
}

.segment input:checked + span {
    border-color: #696cff;
    background: #f1f1ff;
    color: #4b4ee0;
    box-shadow: 0 0 0 3px rgba(105, 108, 255, .12);
}

.segment input:focus-visible + span,
.choice-card input:focus-visible + .choice-content {
    outline: 2px solid #696cff;
    outline-offset: 2px;
}

.field.has-error .segment span {
    border-color: var(--danger);
}

/* ---------- مجموعات الاختيار (الصفوف والمواد) ---------- */
.choice-group {
    margin: 0 0 26px;
    padding: 0;
    border: 0;
}

.choice-group legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 0 0 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid #ececf0;
    color: var(--brand-950);
    font-weight: 800;
    font-size: 1rem;
}

.select-all {
    padding: 4px 12px;
    border: 1px solid #d9daff;
    border-radius: 999px;
    background: #f5f5ff;
    color: #4b4ee0;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
}

.select-all:hover {
    background: #ebebff;
}

.registration-onboarding .choice-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 12px;
}

.registration-onboarding .subject-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.registration-onboarding .choice-card input:checked + .choice-content {
    border-color: #696cff;
    background: #f5f5ff;
    box-shadow: 0 0 0 3px rgba(105, 108, 255, .1);
}

.stage-grid .choice-content {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-height: 120px !important;
    padding: 18px !important;
}

.stage-grid .choice-content strong {
    font-size: 1.05rem !important;
}

.choice-badge {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #f1f1ff;
    color: #4b4ee0;
    font-weight: 800;
    font-size: 1.05rem;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.header-user {
    color: var(--muted);
    font-weight: 600;
    font-size: .9rem;
}

.link-button {
    border: 0;
    background: none;
    cursor: pointer;
    padding: 0;
}

@media (max-width: 900px) {
    .registration-onboarding .choice-grid,
    .registration-onboarding .subject-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .registration .stepper small {
        font-size: .72rem;
        white-space: normal;
    }
}

@media (max-width: 520px) {
    .registration-onboarding .choice-grid,
    .registration-onboarding .subject-grid,
    .segmented {
        grid-template-columns: 1fr;
    }

    .registration .actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .registration .stepper span {
        width: 36px;
        height: 36px;
    }
}

/* ============================================================
   لوحة التحكم
   ============================================================ */
body.dashboard {
    background: #f5f5f9;
}

.dash-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid #ececf0;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
}

.dash-topbar-inner {
    width: min(1180px, calc(100% - 32px));
    min-height: 68px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.btn-small {
    min-height: 38px;
    padding: 6px 14px;
    font-size: .85rem;
}

.dash-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 90px;
    display: grid;
    gap: 24px;
}

.dash-shell > .alert {
    margin: 0;
}

.dash-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 30px 32px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-900), var(--brand-600));
    box-shadow: var(--shadow);
}

.dash-hero h1 {
    margin: 6px 0 6px;
    font-size: 1.7rem;
}

.dash-hero .lead {
    margin: 0;
    color: rgba(255, 255, 255, .85);
}

.dash-hero .eyebrow {
    color: rgba(255, 255, 255, .8);
}

.dash-stats {
    display: flex;
    gap: 12px;
    margin: 0;
}

.dash-stats div {
    min-width: 86px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .14);
    text-align: center;
}

.dash-stats dt {
    font-size: .8rem;
    color: rgba(255, 255, 255, .8);
}

.dash-stats dd {
    margin: 2px 0 0;
    font-size: 1.6rem;
    font-weight: 800;
}

.dash-card {
    padding: 24px 28px;
    border: 1px solid #ececf0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(67, 70, 91, .06);
}

.dash-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.dash-card-head h2,
.dash-section-title {
    margin: 0;
    color: var(--brand-950);
    font-size: 1.15rem;
}

.dash-section-title {
    margin-bottom: 14px;
}

.scope-stage + .scope-stage {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e4e4ea;
}

.scope-stage h3 {
    margin: 8px 0;
    color: var(--muted);
    font-size: .9rem;
}

.scope-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.scope-list li {
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr;
    gap: 12px;
    align-items: start;
}

.scope-list strong {
    color: var(--ink);
    font-size: .95rem;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    padding: 3px 11px;
    border-radius: 999px;
    background: var(--brand-50);
    border: 1px solid var(--brand-100);
    color: var(--brand-800);
    font-size: .82rem;
    font-weight: 600;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.tool-card {
    position: relative;
    padding: 22px;
    border: 1px solid #ececf0;
    border-radius: 14px;
    background: #fff;
}

.tool-card h3 {
    margin: 0 0 6px;
    color: var(--brand-950);
    font-size: 1.02rem;
}

.tool-card p {
    margin: 0;
    color: var(--muted);
    font-size: .88rem;
}

.tool-card::before {
    content: "";
    display: block;
    width: 40px;
    height: 6px;
    margin-bottom: 14px;
    border-radius: 99px;
    background: var(--tool-color, var(--brand-500));
}

.tool-desk { --tool-color: #0f8ca4; }
.tool-exam { --tool-color: #696cff; }
.tool-licence { --tool-color: #d7a94a; }
.tool-evidence { --tool-color: #1d7f63; }

.tool-status {
    position: absolute;
    top: 18px;
    left: 18px;
    padding: 2px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: .75rem;
    font-weight: 700;
}

body.dashboard .floating-help {
    top: auto;
    bottom: 18px;
}

@media (max-width: 960px) {
    .tool-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dash-hero {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 560px) {
    .tool-grid,
    .scope-list li {
        grid-template-columns: 1fr;
    }

    .dash-hero {
        padding: 24px 20px;
    }

    .dash-card {
        padding: 20px;
    }

    .header-user {
        display: none;
    }

    body.dashboard .floating-help {
        right: 14px;
        left: 14px;
    }
}

/* ---------- إصلاحات بعد المعاينة ---------- */
.choice-sub {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 500;
}

.choice-card input:checked + .choice-content .choice-sub {
    color: #5557d6;
}

.actions-stack {
    flex-direction: column;
    align-items: stretch;
}

.actions-stack .btn {
    width: 100%;
}

.switch-line {
    margin: 4px 0 0;
    text-align: center;
    color: var(--muted);
    font-size: .9rem;
}

.switch-line a {
    color: #4b4ee0;
    font-weight: 700;
}

.session-line {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: -18px 0 8px;
    color: var(--muted);
    font-size: .85rem;
}

.session-line button {
    padding: 3px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--brand-800);
    font-weight: 700;
    font-size: .8rem;
    cursor: pointer;
}

.dash-hero h1 {
    color: #fff;
}

@media (max-width: 900px) {
    .registration .auth-shell,
    .dash-shell {
        padding-bottom: 96px;
    }
}

/* رمز المعلم في تسجيل الطالب: حروف كبيرة متباعدة */
.code-input { text-transform: uppercase; letter-spacing: .35em; font-weight: 800; text-align: center; }

/* تنبيه المحاكيين: لا علاقة لهما بأي جهة رسمية */
.sim-disclaimer { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 16px; padding: 11px 14px; border: 1px solid #ecd9a6; border-radius: 12px; background: #fffaf0; color: #5f4a14; }
.sim-disclaimer p { margin: 0; font-size: .84rem; line-height: 1.8; }
.sim-disclaimer strong { color: #8a5a00; }
.sim-disclaimer-icon { flex: 0 0 auto; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 2px; border-radius: 50%; color: #fff; background: #c88a12; font-weight: 800; font-size: .8rem; }
.auth-aside .sim-disclaimer { margin-bottom: 18px; }
@media print { .sim-disclaimer { break-inside: avoid; } }
