/* ══════════════════════════════════════════════
   EduManager Pro — Stylesheet
   ══════════════════════════════════════════════ */

/* ─ Reset & base ──────────────────────────────── */
.em-wrap *, .em-wrap *::before, .em-wrap *::after { box-sizing: border-box; }
.em-wrap { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 14px; color: #111827; line-height: 1.5; }

/* ─ Auth ──────────────────────────────────────── */
.em-auth-wrap { display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px; min-height: 60vh; }
.em-auth-card { background: #fff; border-radius: 16px; box-shadow: 0 4px 30px rgba(0,0,0,.10); padding: 40px 36px; width: 100%; max-width: 420px; }
.em-auth-card-wide { max-width: 560px; }
.em-auth-logo { text-align: center; margin-bottom: 28px; }
.em-auth-icon { font-size: 44px; margin-bottom: 8px; }
.em-auth-title { font-size: 22px; font-weight: 800; margin: 0 0 4px; color: #1e3a5f; }
.em-auth-sub { font-size: 13px; color: #6b7280; margin: 0; }
.em-auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: #6b7280; }
.em-auth-footer a { color: #1d4ed8; font-weight: 600; text-decoration: none; }

/* ─ Form elements ─────────────────────────────── */
.em-field { margin-bottom: 14px; }
.em-field label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .4px; }
.em-field input[type="text"],
.em-field input[type="email"],
.em-field input[type="password"],
.em-field input[type="number"],
.em-field select,
.em-field textarea,
.em-select,
.em-textarea { width: 100%; padding: 9px 12px; border: 1.5px solid #e5e7eb; border-radius: 8px; font-size: 13px; color: #111827; background: #fff; transition: border-color .15s, box-shadow .15s; outline: none; font-family: inherit; }
.em-field input:focus, .em-field select:focus, .em-field textarea:focus,
.em-select:focus, .em-textarea:focus { border-color: #1d4ed8; box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
.em-field-row { display: flex; gap: 12px; }
.em-field-row .em-field { flex: 1; min-width: 0; }
.em-field-pw { position: relative; }
.em-pw-toggle { position: absolute; right: 10px; top: 30px; background: none; border: none; cursor: pointer; font-size: 16px; padding: 0; color: #9ca3af; }
.em-check-label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; margin-bottom: 14px; }
.em-textarea { resize: vertical; min-height: 80px; }

/* ─ Buttons ───────────────────────────────────── */
.em-btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 20px; background: #1d4ed8; color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap; text-decoration: none; }
.em-btn-primary:hover { background: #1e40af; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(29,78,216,.3); }
.em-btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.em-btn-outline { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: #fff; color: #374151; border: 1.5px solid #d1d5db; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap; text-decoration: none; }
.em-btn-outline:hover { border-color: #1d4ed8; color: #1d4ed8; background: #f0f4ff; }
.em-btn-lg { padding: 12px 28px; font-size: 15px; border-radius: 10px; }
.em-btn-logout { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; background: #fff; color: #dc2626; border: 1.5px solid #fca5a5; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s; text-decoration: none; white-space: nowrap; }
.em-btn-logout:hover { background: #fee2e2; border-color: #dc2626; color: #b91c1c; text-decoration: none; }
.em-btn-sm { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; cursor: pointer; border: 1.5px solid #e5e7eb; background: #f9fafb; color: #374151; transition: all .15s; }
.em-btn-sm:hover { background: #f3f4f6; border-color: #9ca3af; }
.em-btn-sm.em-btn-danger { border-color: #fca5a5; color: #dc2626; background: #fff5f5; }
.em-btn-sm.em-btn-danger:hover { background: #fee2e2; }
.em-btn-sm.em-btn-blue { border-color: #93c5fd; color: #1d4ed8; background: #eff6ff; }
.em-btn-sm.em-btn-blue:hover { background: #dbeafe; }
.em-btn-sm.em-btn-green { border-color: #86efac; color: #15803d; background: #f0fdf4; }
.em-btn-sm.em-btn-green:hover { background: #dcfce7; }

/* ─ Dashboard shell ───────────────────────────── */
.em-dash { background: #f0f4fb; min-height: 70vh; border-radius: 16px; overflow: hidden; }

/* ─ Header ────────────────────────────────────── */
.em-header { background: #1e3a5f; color: #fff; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.em-header-left { display: flex; align-items: center; gap: 14px; }
.em-logo { font-size: 30px; }
.em-header-title { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.em-header-sub { font-size: 12px; color: rgba(255,255,255,.65); margin: 0; }
.em-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.em-header .em-btn-outline { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.3); }
.em-header .em-btn-outline:hover { background: rgba(255,255,255,.2); border-color: #fff; }

/* ─ Role badges ───────────────────────────────── */
.em-role-badge { font-size: 10px; font-weight: 700; padding: 2px 9px; border-radius: 20px; vertical-align: middle; text-transform: uppercase; letter-spacing: .5px; }
.em-role-admin   { background: #fef9c3; color: #854d0e; }
.em-role-resp    { background: #ede9fe; color: #5b21b6; }
.em-role-teacher { background: #dcfce7; color: #166534; }
.em-role-student { background: #dbeafe; color: #1e40af; }

/* ─ Tabs ──────────────────────────────────────── */
.em-tabs { display: flex; background: #fff; border-bottom: 2px solid #e5e7eb; padding: 0 16px; overflow-x: auto; gap: 2px; }
.em-tab { padding: 12px 18px; background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; font-size: 13px; font-weight: 600; color: #6b7280; cursor: pointer; white-space: nowrap; transition: all .15s; }
.em-tab:hover { color: #1d4ed8; }
.em-tab.active { color: #1d4ed8; border-bottom-color: #1d4ed8; }
.em-tab-content { padding: 20px 16px; }

/* ─ Cards ─────────────────────────────────────── */
.em-card { background: #fff; border-radius: 12px; padding: 18px; margin-bottom: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.em-card-title { font-size: 14px; font-weight: 800; color: #1e3a5f; margin: 0 0 14px; }
.em-card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.em-card-quiz { border: 2px solid #1d4ed8; }

/* ─ KPI grid ──────────────────────────────────── */
.em-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.em-kpi { background: #fff; border-radius: 12px; padding: 16px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.em-kpi-ico { font-size: 24px; display: block; margin-bottom: 6px; }
.em-kpi b { display: block; font-size: 26px; font-weight: 800; color: #1e3a5f; line-height: 1; }
.em-kpi span { font-size: 11px; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }

/* ─ Tables ────────────────────────────────────── */
.em-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.em-table thead th { background: #f0f4fb; color: #1e3a5f; padding: 8px 10px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.em-table tbody tr { border-bottom: 1px solid #f3f4f6; transition: background .1s; }
.em-table tbody tr:hover { background: #f8faff; }
.em-table td { padding: 8px 10px; vertical-align: middle; }
.em-table-sm td, .em-table-sm th { padding: 5px 8px; }

/* ─ Toolbar ───────────────────────────────────── */
.em-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.em-role-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.em-filter-btn { padding: 6px 14px; border-radius: 20px; border: 1.5px solid #d1d5db; background: #f9fafb; font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s; color: #374151; }
.em-filter-btn:hover, .em-filter-btn.active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }

/* ─ Assign panels ─────────────────────────────── */
.em-assign-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.em-assign-card { height: fit-content; }

/* ─ Badge ─────────────────────────────────────── */
.em-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.em-badge-ok   { background: #dcfce7; color: #15803d; }
.em-badge-warn { background: #fef9c3; color: #854d0e; }
.em-badge-err  { background: #fee2e2; color: #b91c1c; }

/* ─ Messages ──────────────────────────────────── */
.em-msg { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; background: #f3f4f6; border: 1px solid #e5e7eb; }
.em-msg-ok  { background: #f0fdf4; border-color: #86efac; color: #166534; }
.em-msg-err { background: #fff5f5; border-color: #fca5a5; color: #b91c1c; }
.em-notice { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.em-notice-info  { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.em-notice-error { background: #fff5f5; border: 1px solid #fca5a5; color: #b91c1c; }
.em-muted { color: #9ca3af; font-size: 13px; }

/* ─ Two-col layout ────────────────────────────── */
.em-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media(max-width:600px){ .em-two-col { grid-template-columns: 1fr; } }

/* ─ Exercise cards (teacher) ──────────────────── */
.em-exercise-card { background: #fff; border-radius: 12px; padding: 16px; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.06); border-left: 4px solid #1d4ed8; }
.em-ex-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.em-ex-type { font-size: 11px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; display: block; margin-bottom: 4px; }
.em-ex-title { font-size: 15px; font-weight: 700; margin: 0 0 4px; color: #1e3a5f; }
.em-ex-desc { font-size: 12px; color: #6b7280; margin: 0; }
.em-ex-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex-shrink: 0; }

/* ─ Question panel ────────────────────────────── */
.em-question-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f3f4f6; }
.em-question-row:last-child { border-bottom: none; }
.em-q-num { min-width: 28px; height: 28px; background: #1d4ed8; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex-shrink: 0; }
.em-q-body { flex: 1; }
.em-q-text { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.em-q-opts { font-size: 11px; color: #6b7280; }
.em-q-pts { font-size: 11px; color: #9ca3af; white-space: nowrap; }
.em-correct-marker { color: #15803d; font-weight: 800; }

/* ─ Student exercise grid ─────────────────────── */
.em-exercise-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.em-stud-card { background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 1px 6px rgba(0,0,0,.07); display: flex; flex-direction: column; gap: 8px; border-top: 4px solid #e5e7eb; transition: transform .15s, box-shadow .15s; }
.em-stud-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.10); }
.em-stud-card.em-ex-done { border-top-color: #22c55e; }
.em-stud-card.em-ex-new  { border-top-color: #1d4ed8; }
.em-stud-card-head { display: flex; align-items: center; justify-content: space-between; }
.em-stud-status { font-size: 11px; font-weight: 700; }
.em-stud-score { font-size: 12px; }
.em-q-count { font-size: 12px; color: #6b7280; margin: 0; }
.em-stud-card-foot { margin-top: auto; padding-top: 10px; }
.em-stud-card-foot .em-btn-primary,
.em-stud-card-foot .em-btn-outline { width: 100%; }

/* ─ Quiz panel ────────────────────────────────── */
.em-quiz-q { margin-bottom: 20px; padding: 16px; background: #f8faff; border-radius: 10px; border: 1.5px solid #e5e7eb; }
.em-quiz-q-num { font-size: 11px; font-weight: 800; color: #1d4ed8; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.em-quiz-q-text { font-size: 14px; font-weight: 700; color: #111827; margin-bottom: 14px; }
.em-quiz-options { display: flex; flex-direction: column; gap: 8px; }
.em-opt-label { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; border: 1.5px solid #e5e7eb; border-radius: 8px; cursor: pointer; transition: all .15s; font-size: 13px; }
.em-opt-label:hover { border-color: #1d4ed8; background: #eff6ff; }
.em-opt-label input[type="radio"] { accent-color: #1d4ed8; width: 16px; height: 16px; flex-shrink: 0; }
.em-opt-letter { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; background: #e0e7ff; color: #1d4ed8; border-radius: 50%; font-size: 11px; font-weight: 800; flex-shrink: 0; }

/* ─ Score display ─────────────────────────────── */
.em-score-display { text-align: center; padding: 24px 0; }
.em-score-circle { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 130px; height: 130px; border-radius: 50%; border: 6px solid #e5e7eb; margin-bottom: 12px; }
.em-score-circle.em-score-excellent { border-color: #22c55e; background: #f0fdf4; }
.em-score-circle.em-score-good      { border-color: #3b82f6; background: #eff6ff; }
.em-score-circle.em-score-avg       { border-color: #f59e0b; background: #fffbeb; }
.em-score-circle.em-score-low       { border-color: #ef4444; background: #fff5f5; }
.em-score-pct { font-size: 32px; font-weight: 900; line-height: 1; }
.em-score-raw { font-size: 13px; color: #6b7280; margin-top: 4px; }
.em-score-mention { font-size: 18px; font-weight: 700; margin-top: 4px; color: #1e3a5f; }

/* ─ Review ────────────────────────────────────── */
.em-review { margin-top: 16px; }
.em-review h4 { font-size: 13px; font-weight: 800; margin-bottom: 10px; color: #1e3a5f; text-transform: uppercase; letter-spacing: .4px; }
.em-rev-row { padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 6px; }
.em-rev-ok  { background: #f0fdf4; color: #166534; }
.em-rev-err { background: #fff5f5; color: #b91c1c; }

/* ─ Document content ──────────────────────────── */
.em-doc-content { font-size: 14px; line-height: 1.8; color: #374151; padding-top: 8px; }
.em-doc-content h1, .em-doc-content h2, .em-doc-content h3 { color: #1e3a5f; margin-top: 20px; }
.em-doc-content p { margin-bottom: 12px; }

/* ─ Empty state ───────────────────────────────── */
.em-empty-state { text-align: center; padding: 48px 20px; color: #9ca3af; }
.em-empty-state span { font-size: 48px; display: block; margin-bottom: 12px; }
.em-empty-state p { font-size: 14px; line-height: 1.7; }

/* ─ Modal ─────────────────────────────────────── */
.em-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.em-modal { background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 40px rgba(0,0,0,.2); }
.em-modal-wide { max-width: 600px; }
.em-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.em-modal-head h3 { font-size: 16px; font-weight: 800; color: #1e3a5f; margin: 0; }
.em-modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #9ca3af; padding: 0; }
.em-modal-close:hover { color: #ef4444; }
.em-modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid #e5e7eb; }

/* ─ Responsive ────────────────────────────────── */
@media (max-width: 640px) {
  .em-auth-card { padding: 28px 20px; }
  .em-header { padding: 12px 14px; }
  .em-tab-content { padding: 14px 10px; }
  .em-field-row { flex-direction: column; gap: 0; }
  .em-exercise-grid { grid-template-columns: 1fr; }
  .em-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .em-assign-panels { grid-template-columns: 1fr; }
}
