/* ═══════════════════════════════════════════════════════════
   APC ACADEMY — FRONTEND STYLES
   ═══════════════════════════════════════════════════════════ */
:root {
  --apc-primary:   #4361ee;
  --apc-primary-d: #3451d1;
  --apc-primary-l: #eff3ff;
  --apc-success:   #22c55e;
  --apc-warning:   #f59e0b;
  --apc-danger:    #ef4444;
  --apc-bg:        #f0f4ff;
  --apc-card:      #ffffff;
  --apc-border:    #e2e8f0;
  --apc-text:      #1e293b;
  --apc-muted:     #64748b;
  --apc-sidebar-w: 260px;
  --apc-radius:    14px;
  --apc-shadow:    0 2px 12px rgba(67,97,238,.08);
}

/* ── Layout ───────────────────────────────────────────────── */
.apc-wrap { display: flex; min-height: 100vh; background: var(--apc-bg); font-family: 'Segoe UI', system-ui, sans-serif; }

/* ── Sidebar ──────────────────────────────────────────────── */
.apc-sidebar {
  width: var(--apc-sidebar-w); background: #1e1b4b; color: #fff;
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.apc-sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.1);
}
.apc-brand-logo  { font-size: 32px; }
.apc-brand-name  { font-size: 16px; font-weight: 700; }
.apc-brand-tagline { font-size: 11px; color: rgba(255,255,255,.55); }
.apc-nav { padding: 14px 12px; flex: 1; }
.apc-nav-link {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: 10px; text-decoration: none; color: rgba(255,255,255,.7);
  font-size: 14px; font-weight: 500; transition: all .2s; margin-bottom: 3px;
}
.apc-nav-link span { font-size: 18px; }
.apc-nav-link:hover, .apc-nav-link.active { background: rgba(255,255,255,.12); color: #fff; }
.apc-nav-link.active { background: var(--apc-primary); }
.apc-nav-logout { margin-top: auto; color: rgba(255,100,100,.8); }
.apc-nav-logout:hover { background: rgba(255,100,100,.15); color: #ff6464; }

/* ── Main ─────────────────────────────────────────────────── */
.apc-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ── Top Bar ──────────────────────────────────────────────── */
.apc-topbar {
  background: var(--apc-card); border-bottom: 1px solid var(--apc-border);
  padding: 14px 24px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.apc-topbar-title  { flex: 1; font-weight: 700; font-size: 17px; color: var(--apc-text); }
.apc-topbar-right  { display: flex; align-items: center; gap: 14px; }
.apc-hamburger { display: none; background: none; border: none; font-size: 20px; cursor: pointer; }
.apc-avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--apc-primary);
  color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.apc-user-name { font-weight: 600; font-size: 14px; color: var(--apc-text); }
.apc-user-role { font-size: 11px; color: var(--apc-muted); }

/* ── Notifications ────────────────────────────────────────── */
.apc-notif-btn { position: relative; cursor: pointer; font-size: 20px; }
.apc-notif-count {
  position: absolute; top: -5px; right: -8px; background: var(--apc-danger);
  color: #fff; font-size: 10px; font-weight: 700; border-radius: 50%;
  width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
}
.apc-notif-dropdown {
  position: absolute; right: 0; top: 32px; width: 300px; background: var(--apc-card);
  border: 1px solid var(--apc-border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.1);
  display: none; z-index: 999;
}
.apc-notif-btn:hover .apc-notif-dropdown { display: block; }
.apc-notif-item { padding: 12px 14px; font-size: 13px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; gap: 8px; }
.apc-notif-item small { color: var(--apc-muted); font-size: 11px; white-space: nowrap; }
.apc-notif-success { border-left: 3px solid var(--apc-success); }
.apc-notif-warning { border-left: 3px solid var(--apc-warning); }
.apc-notif-info    { border-left: 3px solid var(--apc-primary); }

/* ── Tab Content ──────────────────────────────────────────── */
.apc-tab-content { display: none; padding: 24px; }
.apc-tab-content.active { display: block; }

/* ── Welcome Banner ───────────────────────────────────────── */
.apc-welcome-banner {
  background: linear-gradient(135deg, var(--apc-primary) 0%, #7c3aed 100%);
  color: #fff; border-radius: var(--apc-radius); padding: 24px 28px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.apc-welcome-banner h2 { margin: 0 0 6px; font-size: 22px; }
.apc-welcome-banner p  { margin: 0; opacity: .85; font-size: 14px; }
.apc-welcome-art { font-size: 64px; line-height: 1; }

/* ── Stats Row ────────────────────────────────────────────── */
.apc-stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 900px)  { .apc-stats-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px)  { .apc-stats-row { grid-template-columns: 1fr 1fr; } }
.apc-stat-card {
  background: var(--apc-card); border-radius: var(--apc-radius); padding: 18px 16px;
  text-align: center; box-shadow: var(--apc-shadow); border: 1px solid var(--apc-border);
}
.apc-stat-icon  { font-size: 26px; margin-bottom: 6px; }
.apc-stat-value { font-size: 24px; font-weight: 800; color: var(--apc-text); }
.apc-stat-label { font-size: 12px; color: var(--apc-muted); margin-top: 3px; }
.apc-stat-blue   { border-top: 3px solid var(--apc-primary); }
.apc-stat-green  { border-top: 3px solid var(--apc-success); }
.apc-stat-red    { border-top: 3px solid var(--apc-danger);  }
.apc-stat-success{ border-top: 3px solid var(--apc-success); }
.apc-stat-warning{ border-top: 3px solid var(--apc-warning); }
.apc-stat-danger { border-top: 3px solid var(--apc-danger);  }

/* ── Section Title ────────────────────────────────────────── */
.apc-section-title { font-size: 16px; font-weight: 700; color: var(--apc-text); margin: 0 0 14px; }

/* ── Courses Grid ─────────────────────────────────────────── */
.apc-courses-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 28px; }
.apc-course-card {
  background: var(--apc-card); border-radius: var(--apc-radius); padding: 18px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--apc-shadow);
  border: 1px solid var(--apc-border); transition: transform .2s;
}
.apc-course-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(67,97,238,.12); }
.apc-course-icon  { font-size: 32px; }
.apc-course-info  { flex: 1; }
.apc-course-name  { font-weight: 700; font-size: 15px; color: var(--apc-text); }
.apc-course-class { font-size: 12px; color: var(--apc-primary); font-weight: 600; margin: 2px 0; }
.apc-course-meta  { font-size: 12px; color: var(--apc-muted); }

/* ── Results List ─────────────────────────────────────────── */
.apc-results-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.apc-result-item {
  background: var(--apc-card); border-radius: var(--apc-radius); padding: 16px 18px;
  display: flex; align-items: center; gap: 16px; border: 1px solid var(--apc-border);
  box-shadow: var(--apc-shadow);
}
.apc-result-donut { width: 56px; height: 56px; flex-shrink: 0; }
.apc-result-donut svg { width: 100%; height: 100%; }
.apc-donut-success { color: var(--apc-success); }
.apc-donut-warning { color: var(--apc-warning); }
.apc-donut-danger  { color: var(--apc-danger);  }
.apc-result-info { flex: 1; }
.apc-result-title { font-weight: 700; font-size: 14px; color: var(--apc-text); margin-bottom: 4px; }
.apc-result-meta  { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--apc-muted); }
.apc-result-score { text-align: right; }
.apc-score-val    { display: block; font-size: 18px; font-weight: 800; color: var(--apc-text); margin-bottom: 6px; }

/* ── Tests Grid ───────────────────────────────────────────── */
.apc-tests-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.apc-test-card {
  background: var(--apc-card); border-radius: var(--apc-radius); padding: 20px;
  border: 1px solid var(--apc-border); box-shadow: var(--apc-shadow); transition: all .2s;
  display: flex; flex-direction: column; gap: 10px;
}
.apc-test-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(67,97,238,.15); }
.apc-test-card.apc-test-done { opacity: .85; }
.apc-test-card-header { display: flex; align-items: center; justify-content: space-between; }
.apc-test-badge { background: var(--apc-primary-l); color: var(--apc-primary); font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.apc-test-title { font-size: 16px; font-weight: 700; color: var(--apc-text); }
.apc-test-meta  { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--apc-muted); }
.apc-test-meta span { background: #f8fafc; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--apc-border); }
.apc-test-negative { font-size: 11.5px; color: var(--apc-danger); background: #fef2f2; padding: 4px 8px; border-radius: 6px; }
.apc-test-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.apc-score-pill { background: var(--apc-primary-l); color: var(--apc-primary); font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }

/* ── Table ────────────────────────────────────────────────── */
.apc-table-wrap { overflow-x: auto; }
.apc-fe-table { width: 100%; border-collapse: collapse; font-size: 13.5px; white-space: nowrap; }
.apc-fe-table th { background: #f1f5f9; padding: 10px 14px; text-align: left; font-weight: 600; color: var(--apc-text); border-bottom: 2px solid var(--apc-border); }
.apc-fe-table td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.apc-fe-table tr:hover td { background: #f8fafc; }
.apc-text-success { color: var(--apc-success); font-weight: 700; }
.apc-text-danger  { color: var(--apc-danger);  font-weight: 700; }

/* ── Pill ─────────────────────────────────────────────────── */
.apc-pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.apc-pill-success { background: #dcfce7; color: #166534; }
.apc-pill-warning { background: #fef9c3; color: #854d0e; }
.apc-pill-danger  { background: #fee2e2; color: #991b1b; }

/* ── Analytics ────────────────────────────────────────────── */
.apc-analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .apc-analytics-grid { grid-template-columns: 1fr; } }
.apc-analytics-card { background: var(--apc-card); border-radius: var(--apc-radius); padding: 20px; border: 1px solid var(--apc-border); box-shadow: var(--apc-shadow); }
.apc-analytics-title { font-weight: 700; margin-bottom: 16px; font-size: 14px; color: var(--apc-text); }

/* ── Page Head ────────────────────────────────────────────── */
.apc-page-head { margin-bottom: 20px; }
.apc-page-head h3 { margin: 0; font-size: 18px; color: var(--apc-text); }

/* ── Empty State ──────────────────────────────────────────── */
.apc-empty-state { text-align: center; padding: 48px 20px; }
.apc-empty-icon  { font-size: 56px; margin-bottom: 14px; }
.apc-empty-state p { color: var(--apc-muted); font-size: 15px; }

/* ── Buttons ──────────────────────────────────────────────── */
.apc-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 20px;
  border-radius: 9px; border: none; cursor: pointer; font-size: 14px;
  font-weight: 600; text-decoration: none; transition: all .2s; line-height: 1;
}
.apc-btn:focus { outline: 3px solid rgba(67,97,238,.3); }
.apc-btn-primary  { background: var(--apc-primary); color: #fff; }
.apc-btn-primary:hover { background: var(--apc-primary-d); color: #fff; }
.apc-btn-outline  { background: transparent; border: 2px solid var(--apc-border); color: var(--apc-text); }
.apc-btn-outline:hover { border-color: var(--apc-primary); color: var(--apc-primary); }
.apc-btn-success  { background: var(--apc-success); color: #fff; }
.apc-btn-success:hover { background: #16a34a; color: #fff; }
.apc-btn-sm  { padding: 6px 12px; font-size: 13px; border-radius: 7px; }
.apc-btn-lg  { padding: 14px 30px; font-size: 16px; }
.apc-btn-full { width: 100%; justify-content: center; }

/* ── Notice ───────────────────────────────────────────────── */
.apc-notice { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin: 12px 0; }
.apc-notice-warning { background: #fef9c3; color: #854d0e; border-left: 4px solid var(--apc-warning); }
.apc-notice-danger  { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--apc-danger);  }
.apc-notice-success { background: #dcfce7; color: #166534; border-left: 4px solid var(--apc-success); }

/* ── Badge ────────────────────────────────────────────────── */
.apc-badge { display:inline-block; padding:3px 9px; border-radius:20px; font-size:11.5px; font-weight:700; background:#e2e8f0; color:var(--apc-text); }
.apc-badge-success { background:#dcfce7; color:#166534; }
.apc-badge-warning { background:#fef9c3; color:#854d0e; }
.apc-badge-danger  { background:#fee2e2; color:#991b1b; }

/* ── Input / Form ─────────────────────────────────────────── */
.apc-input {
  width: 100%; padding: 10px 14px; border: 2px solid var(--apc-border);
  border-radius: 9px; font-size: 14px; background: #fff; box-sizing: border-box;
  transition: border .2s;
}
.apc-input:focus { outline: none; border-color: var(--apc-primary); box-shadow: 0 0 0 3px rgba(67,97,238,.1); }
.apc-form-row { margin-bottom: 16px; }
.apc-form-row label { display: block; font-size: 13px; font-weight: 600; color: var(--apc-text); margin-bottom: 6px; }
.apc-form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .apc-form-grid-2 { grid-template-columns: 1fr; } }

/* ── Auth ─────────────────────────────────────────────────── */
.apc-auth-wrap  { display: flex; justify-content: center; align-items: center; min-height: 70vh; padding: 24px; background: var(--apc-bg); }
.apc-auth-card  { background: var(--apc-card); border-radius: 20px; padding: 36px 40px; width: 100%; max-width: 440px; box-shadow: 0 8px 40px rgba(67,97,238,.12); }
.apc-auth-card-wide { max-width: 680px; }
.apc-auth-logo  { font-size: 48px; text-align: center; margin-bottom: 10px; }
.apc-auth-card h2 { text-align: center; margin: 0 0 6px; font-size: 22px; color: var(--apc-text); }
.apc-auth-sub   { text-align: center; color: var(--apc-muted); font-size: 14px; margin-bottom: 24px; }
.apc-auth-form  { margin-top: 4px; }
.apc-auth-link  { text-align: center; font-size: 13.5px; margin-top: 14px; color: var(--apc-muted); }
.apc-auth-link a { color: var(--apc-primary); text-decoration: none; font-weight: 600; }
.apc-input-eye  { position: relative; }
.apc-input-eye .apc-input { padding-right: 44px; }
.apc-eye-btn    { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 18px; }

/* ── Overlay / Spinner ────────────────────────────────────── */
.apc-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 9999; display: none; align-items: center; justify-content: center; }
.apc-overlay.active { display: flex; }
.apc-overlay-inner { background: #fff; border-radius: 14px; padding: 32px 40px; text-align: center; }
.apc-spinner { width: 40px; height: 40px; border: 4px solid var(--apc-border); border-top-color: var(--apc-primary); border-radius: 50%; animation: apcSpin .7s linear infinite; margin: 0 auto 14px; }
@keyframes apcSpin { to { transform: rotate(360deg); } }

/* ── Result Page ──────────────────────────────────────────── */
.apc-result-page { max-width: 900px; margin: 0 auto; padding: 20px; }
.apc-result-banner { border-radius: var(--apc-radius); padding: 28px 32px; margin-bottom: 24px; }
.apc-result-pass { background: linear-gradient(135deg, #059669, #047857); color: #fff; }
.apc-result-fail { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; }
.apc-result-banner-inner { display: flex; align-items: center; gap: 20px; }
.apc-result-trophy { font-size: 52px; }
.apc-result-banner-info { flex: 1; }
.apc-result-banner-info h2 { margin: 0 0 6px; font-size: 22px; }
.apc-result-banner-info p  { margin: 0; opacity: .85; font-size: 14px; }
.apc-result-big-score { text-align: right; }
.apc-big-pct { font-size: 48px; font-weight: 900; line-height: 1; }
.apc-big-score-sub { font-size: 14px; opacity: .8; }

.apc-result-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 24px; }
@media (max-width: 900px) { .apc-result-stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 500px) { .apc-result-stats { grid-template-columns: repeat(2, 1fr); } }
.apc-rs-card { background: var(--apc-card); border-radius: 12px; padding: 16px 12px; text-align: center; border: 1px solid var(--apc-border); box-shadow: var(--apc-shadow); }
.apc-rs-icon { font-size: 22px; margin-bottom: 6px; }
.apc-rs-val  { font-size: 20px; font-weight: 800; color: var(--apc-text); }
.apc-rs-label{ font-size: 11px; color: var(--apc-muted); margin-top: 3px; }
.apc-rs-success { border-top: 3px solid var(--apc-success); }
.apc-rs-danger  { border-top: 3px solid var(--apc-danger);  }
.apc-rs-warning { border-top: 3px solid var(--apc-warning); }

.apc-result-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
@media (max-width: 700px) { .apc-result-charts { grid-template-columns: 1fr; } }
.apc-chart-card { background: var(--apc-card); border-radius: var(--apc-radius); padding: 20px; border: 1px solid var(--apc-border); box-shadow: var(--apc-shadow); }
.apc-chart-title { font-weight: 700; margin-bottom: 14px; font-size: 14px; }

/* ── Answer Review ────────────────────────────────────────── */
.apc-answer-review { margin-bottom: 24px; }
.apc-review-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.apc-review-header h3 { margin: 0; font-size: 16px; }
.apc-review-legend { display: flex; gap: 14px; font-size: 12px; color: var(--apc-muted); }
.apc-q-review { background: var(--apc-card); border-radius: 12px; padding: 18px 20px; margin-bottom: 12px; border: 1px solid var(--apc-border); }
.apc-q-review-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.apc-q-num { background: var(--apc-primary); color: #fff; border-radius: 6px; padding: 3px 9px; font-size: 12px; font-weight: 700; }
.apc-q-marks { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--apc-text); }
.apc-q-review-text { font-size: 15px; font-weight: 500; color: var(--apc-text); margin-bottom: 12px; line-height: 1.5; }
.apc-q-review-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 600px) { .apc-q-review-options { grid-template-columns: 1fr; } }
.apc-q-option { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; border: 1.5px solid var(--apc-border); font-size: 13.5px; background: #f8fafc; }
.apc-opt-letter { width: 26px; height: 26px; border-radius: 50%; background: var(--apc-border); color: var(--apc-text); font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.apc-opt-correct { border-color: var(--apc-success); background: #f0fdf4; }
.apc-opt-correct .apc-opt-letter { background: var(--apc-success); color: #fff; }
.apc-opt-wrong   { border-color: var(--apc-danger);  background: #fef2f2; }
.apc-opt-wrong   .apc-opt-letter { background: var(--apc-danger);  color: #fff; }
.apc-opt-tick    { margin-left: auto; color: var(--apc-success); font-weight: 700; }
.apc-opt-your    { font-size: 11px; color: var(--apc-muted); font-style: italic; }
.apc-q-explanation { background: #fffbeb; border-left: 3px solid var(--apc-warning); padding: 10px 12px; border-radius: 0 8px 8px 0; font-size: 13px; margin-top: 10px; color: var(--apc-text); }
.apc-q-status-badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.apc-badge-success { background: #dcfce7; color: #166534; }
.apc-badge-danger  { background: #fee2e2; color: #991b1b; }
.apc-badge-warning { background: #fef9c3; color: #854d0e; }
.apc-result-actions { text-align: center; margin-top: 20px; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .apc-sidebar { position: fixed; left: -100%; top: 0; height: 100vh; z-index: 1000; transition: left .3s; }
  .apc-sidebar.open { left: 0; }
  .apc-hamburger { display: block; }
  .apc-welcome-art { display: none; }
  .apc-result-banner-inner { flex-direction: column; text-align: center; }
  .apc-result-big-score { text-align: center; }
}
