/* ============================================================
   MarCert Global — Portal Dark Theme Additions
   ============================================================ */

/* ── mc-btn Component ────────────────────────────────────── */
.mc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px; border-radius: 10px; font-weight: 600; font-size: 13px;
  cursor: pointer; text-decoration: none; border: none; transition: all .2s;
  white-space: nowrap; letter-spacing: .2px; line-height: 1;
}
.mc-btn:hover { text-decoration: none; }
.mc-btn-primary {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #fff; box-shadow: 0 4px 16px rgba(37,99,235,.3);
}
.mc-btn-primary:hover { background: linear-gradient(135deg,#1e40af,#1d4ed8); color:#fff; transform:translateY(-1px); }
.mc-btn-outline {
  background: transparent; color: #60a5fa;
  border: 1.5px solid rgba(96,165,250,.35);
}
.mc-btn-outline:hover { background: rgba(96,165,250,.1); border-color:#60a5fa; color:#60a5fa; }
.mc-btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.mc-btn.w-100 { width: 100%; justify-content: center; }
.w-100 { width: 100% !important; }
.ms-auto { margin-left: auto !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-4 { margin-bottom: 16px !important; }
.me-1 { margin-right: 4px !important; }
.me-2 { margin-right: 8px !important; }

/* ── Public nav links ────────────────────────────────────── */
.mc-nav-link {
  color: rgba(255,255,255,.82); font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 8px; transition: all .2s;
  text-decoration: none; display: inline-flex; align-items: center;
}
.mc-nav-link:hover { color:#fff; background:rgba(255,255,255,.08); text-decoration:none; }
.mc-nav-link.active { color: #fbbf24; }
.mc-nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; font-size: 17px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.mc-nav-brand:hover { text-decoration:none; color:#fff; }

/* ── Dark card ───────────────────────────────────────────── */
.mc-card {
  background: rgba(15,28,48,.95); border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px; padding: 24px;
}

/* ── Form Controls (dark) ────────────────────────────────── */
.mc-form-group { margin-bottom: 18px; }
.mc-form-label { display:block; font-size:13px; font-weight:600; color:rgba(255,255,255,.8); margin-bottom:6px; }
.mc-form-control {
  width:100%; padding:10px 14px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; color: #f1f5f9; font-size: 14px; font-family: inherit;
  transition: border-color .2s;
}
.mc-form-control:focus { outline:none; border-color:#2563eb; box-shadow:0 0 0 3px rgba(37,99,235,.15); }
.mc-form-control::placeholder { color:rgba(255,255,255,.22); }
.mc-form-control option { background:#0f1c30; color:#f1f5f9; }
select.mc-form-control {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%2394a3b8' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 36px;
}
textarea.mc-form-control { resize:vertical; min-height:80px; line-height:1.6; }
.mc-input-wrap { position:relative; }
.mc-input-icon { position:absolute; left:13px; top:50%; transform:translateY(-50%); color:rgba(255,255,255,.3); pointer-events:none; font-size:14px; }
.mc-form-control.mc-has-icon { padding-left:38px; }
.mc-pw-toggle { position:absolute; right:10px; top:50%; transform:translateY(-50%); background:none; border:none; color:rgba(255,255,255,.35); cursor:pointer; padding:4px; }

/* ── Auth Wrap ───────────────────────────────────────────── */
.mc-auth-wrap {
  min-height:100vh;
  background: linear-gradient(160deg, #060d1a 0%, #0d1f3c 60%, #080f1e 100%);
  display:flex; flex-direction:column; align-items:center; justify-content:center; padding:40px 24px;
}
.mc-auth-brand { text-align:center; margin-bottom:24px; }
.mc-auth-card {
  width:100%; max-width:460px;
  background:rgba(15,28,48,.95); border:1px solid rgba(255,255,255,.08);
  border-radius:20px; padding:36px; box-shadow:0 40px 80px rgba(0,0,0,.4);
}
.mc-auth-title { font-size:24px; font-weight:800; color:#f1f5f9; margin-bottom:6px; }
.mc-auth-sub { font-size:14px; color:rgba(255,255,255,.68); margin-bottom:24px; }
.mc-auth-switch { text-align:center; margin-top:20px; font-size:14px; color:rgba(255,255,255,.68); }
.mc-auth-switch a { color:#60a5fa; }

/* ── Portal layout ───────────────────────────────────────── */
.mc-portal-wrap { display:flex; min-height:100vh; max-width:100vw; overflow-x:hidden; }
.mc-main { flex:1; min-width:0; background:#060d1a; display:flex; flex-direction:column; overflow-x:hidden; overflow-y:hidden; }
.mc-content { padding:28px 32px; flex:1; overflow-y:auto; overflow-x:hidden; color:#f1f5f9; }
.mc-topbar {
  height:60px; background:rgba(6,13,26,.95); border-bottom:1px solid rgba(255,255,255,.07);
  display:flex; align-items:center; padding:0 28px; gap:16px; flex-shrink:0;
}
.mc-topbar-title { font-size:17px; font-weight:700; color:#f1f5f9; flex:1; }
.mc-topbar-actions { display:flex; align-items:center; gap:12px; }
.mc-topbar-notif {
  width:36px; height:36px; border-radius:10px; border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.04); display:flex; align-items:center; justify-content:center;
  color:rgba(255,255,255,.72); font-size:16px; position:relative; text-decoration:none;
}
.mc-topbar-notif:hover { border-color:#3b82f6; color:#3b82f6; }
.mc-notif-dot { position:absolute; top:7px; right:7px; width:7px; height:7px; border-radius:50%; background:#ef4444; }
.mc-avatar {
  width:36px; height:36px; border-radius:10px;
  background: linear-gradient(135deg,#2563eb,#14b8a6);
  color:#fff; font-weight:800; font-size:14px;
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}

/* ── KPI Cards (portal) ──────────────────────────────────── */
.mc-kpi-card {
  background:rgba(15,28,48,.9); border:1px solid rgba(255,255,255,.07);
  border-radius:14px; padding:20px 16px; display:flex; flex-direction:column;
  align-items:flex-start; gap:8px; transition:.2s;
}
.mc-kpi-card:hover { border-color:rgba(37,99,235,.3); }
.mc-kpi-icon { width:40px; height:40px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:18px; }
.mc-kpi-value { font-size:26px; font-weight:800; color:#f1f5f9; line-height:1.1; }
.mc-kpi-label { font-size:12px; color:rgba(255,255,255,.68); font-weight:500; }

/* ── Table (dark) ────────────────────────────────────────── */
/* Tables: clip nothing vertically, but allow horizontal scroll within the box.
   This keeps wide tables readable without causing page-level horizontal scroll. */
.mc-table-wrap {
  background:rgba(15,28,48,.9); border:1px solid rgba(255,255,255,.07); border-radius:16px;
  overflow-x:auto; overflow-y:visible;
  -webkit-overflow-scrolling:touch;
}
.mc-table { width:100%; border-collapse:collapse; }
.mc-table th {
  padding:12px 16px; background:rgba(37,99,235,.08); font-size:11px; font-weight:700;
  text-transform:uppercase; letter-spacing:1px; color:rgba(255,255,255,.68); text-align:left;
  border-bottom:1px solid rgba(255,255,255,.07);
}
.mc-table td { padding:14px 16px; border-bottom:1px solid rgba(255,255,255,.05); font-size:13px; color:#e2e8f0; vertical-align:middle; }
.mc-table tr:last-child td { border-bottom:none; }
.mc-table tr:hover td { background:rgba(255,255,255,.02); }

/* ── Alerts (dark theme) ─────────────────────────────────── */
.alert-mc { padding:12px 16px; border-radius:10px; font-size:14px; margin-bottom:16px; display:flex; align-items:flex-start; gap:8px; }
.alert-mc-success { background:rgba(16,185,129,.12); color:#6ee7b7; border:1px solid rgba(16,185,129,.25); }
.alert-mc-danger  { background:rgba(239,68,68,.12); color:#fca5a5; border:1px solid rgba(239,68,68,.25); }
.alert-mc-warning { background:rgba(245,158,11,.12); color:#fde68a; border:1px solid rgba(245,158,11,.25); }
.alert-mc-info    { background:rgba(37,99,235,.12); color:#93c5fd; border:1px solid rgba(37,99,235,.25); }

/* ── Exam Engine ─────────────────────────────────────────── */
.exam-wrap { min-height:100vh; background:#060d1a; display:flex; flex-direction:column; }
.exam-header {
  height:60px; background:rgba(6,13,26,.95); border-bottom:1px solid rgba(255,255,255,.08);
  display:flex; align-items:center; justify-content:space-between; padding:0 24px; gap:16px;
  position:sticky; top:0; z-index:100; flex-shrink:0;
}
.exam-body { flex:1; display:grid; grid-template-columns:260px 1fr; height:calc(100vh - 60px); }
.exam-nav-panel {
  background:rgba(6,13,26,.9); border-right:1px solid rgba(255,255,255,.07);
  padding:20px; overflow-y:auto; display:flex; flex-direction:column; gap:12px;
}
.exam-proctor-preview { height:140px; background:#000; border-radius:10px; position:relative; overflow:hidden; }
.exam-main { padding:40px; overflow-y:auto; }
.exam-q-grid { display:grid; grid-template-columns:repeat(5,1fr); gap:6px; }
.exam-q-num {
  aspect-ratio:1; border-radius:6px; border:1px solid rgba(255,255,255,.15);
  background:rgba(255,255,255,.06); color:rgba(255,255,255,.72);
  display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:600;
  cursor:pointer; transition:.15s;
}
.exam-q-num:hover { border-color:rgba(37,99,235,.5); }
.exam-q-num.answered { background:rgba(16,185,129,.15); border-color:#10b981; color:#10b981; }
.exam-q-num.current  { background:#2563eb; border-color:#2563eb; color:#fff; }
.exam-q-num.flagged  { background:rgba(245,158,11,.15); border-color:#f59e0b; color:#f59e0b; }
.exam-q-counter { font-size:12px; color:rgba(255,255,255,.68); margin-bottom:8px; letter-spacing:1px; text-transform:uppercase; }
.exam-q-text { font-size:18px; font-weight:700; color:#f1f5f9; line-height:1.6; margin-bottom:16px; }
.exam-scenario {
  background:rgba(37,99,235,.08); border:1px solid rgba(37,99,235,.2); border-radius:10px;
  padding:14px 18px; font-size:14px; color:#93c5fd; margin-bottom:16px; line-height:1.7;
}
.exam-options { display:flex; flex-direction:column; gap:10px; }
.exam-option {
  display:flex; align-items:flex-start; gap:14px; padding:14px 18px;
  background:rgba(255,255,255,.04); border:1.5px solid rgba(255,255,255,.12);
  border-radius:12px; cursor:pointer; transition:.15s; color:rgba(255,255,255,.88); font-size:15px;
}
.exam-option:hover { border-color:rgba(37,99,235,.5); background:rgba(37,99,235,.08); color:#fff; }
.exam-option.selected { border-color:#2563eb; background:rgba(37,99,235,.15); color:#fff; }
.exam-option-letter {
  width:28px; height:28px; flex-shrink:0; border-radius:8px;
  background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.18);
  display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700;
  color:rgba(255,255,255,.78); margin-top:1px;
}
.exam-option.selected .exam-option-letter { background:#2563eb; border-color:#2563eb; color:#fff; }
.exam-timer {
  display:flex; align-items:center; gap:8px; padding:8px 16px;
  border-radius:10px; border:1px solid rgba(255,255,255,.1);
  font-weight:700; font-size:18px; color:#fff; font-family:monospace;
}
.exam-timer.warning { border-color:rgba(245,158,11,.5); color:#fbbf24; background:rgba(245,158,11,.1); }
.exam-timer.critical { border-color:rgba(239,68,68,.5); color:#fca5a5; animation:pulse-red .8s infinite; }
@keyframes pulse-red { 0%,100%{box-shadow:0 0 0 0 rgba(239,68,68,.3)} 50%{box-shadow:0 0 0 6px rgba(239,68,68,0)} }
@keyframes pulse-rec { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Certificate Verify ──────────────────────────────────── */
.mc-cert-verify-card { background:rgba(15,28,48,.95); border:1px solid rgba(255,255,255,.08); border-radius:20px; overflow:hidden; }
.mc-cert-verify-header { background:linear-gradient(135deg,#0d1f3c,#112240); padding:28px; border-bottom:1px solid rgba(245,158,11,.15); }
.mc-cert-verify-body { padding:28px; }
.mc-cert-num { font-family:monospace; font-size:15px; color:#fbbf24; font-weight:700; letter-spacing:1px; }

/* ── Plan Cards ──────────────────────────────────────────── */
.mc-plan-card {
  background:rgba(15,28,48,.9); border:1px solid rgba(255,255,255,.08);
  border-radius:20px; padding:32px; transition:.2s;
}
.mc-plan-card.popular {
  border-color:rgba(245,158,11,.35) !important;
  background:rgba(245,158,11,.04) !important;
  box-shadow:0 0 40px rgba(245,158,11,.08);
}
.billing-toggle-btn { background:transparent; color:rgba(255,255,255,.72); border:none; cursor:pointer; transition:.2s; font-family:inherit; }
.billing-toggle-btn.active { background:#2563eb; color:#fff; }

/* ── Sidebar ─────────────────────────────────────────────── */
.mc-sidebar {
  width: 240px; flex-shrink:0;
  background: linear-gradient(180deg, #0a1628 0%, #0d1f3c 100%);
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column; min-height: 100vh; overflow-y: auto;
}
.mc-sidebar-brand {
  display:flex; align-items:center; gap:12px; padding:24px 20px 20px;
  border-bottom:1px solid rgba(255,255,255,.06);
}
.mc-sidebar-nav { padding:16px 12px; flex:1; display:flex; flex-direction:column; }
.mc-sidebar-label {
  font-size:10px; font-weight:700; letter-spacing:2px; text-transform:uppercase;
  color:rgba(255,255,255,.48); padding:12px 10px 6px; margin-top:4px;
}
.mc-sidebar-link {
  display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:10px;
  color:rgba(255,255,255,.75); font-size:13px; font-weight:500; text-decoration:none;
  transition:.15s; margin-bottom:2px; border-left:3px solid transparent;
}
.mc-sidebar-link i { font-size:16px; width:18px; text-align:center; }
.mc-sidebar-link:hover { background:rgba(255,255,255,.06); color:#fff; text-decoration:none; }
.mc-sidebar-link.active { background:rgba(37,99,235,.15); color:#60a5fa; border-left-color:#2563eb; }
.mc-brand-mark {
  width:38px; height:38px; flex-shrink:0;
  background:url('../img/mercertlogo.png') center/contain no-repeat;
  border-radius:0; display:block; font-size:0;
}
.mc-brand-name { font-weight:800; font-size:16px; color:#fff; }
.mc-brand-name span { color:#fbbf24; }

/* ── Badge Extras ────────────────────────────────────────── */
.badge-level { font-size:11px !important; padding:3px 9px !important; border-radius:20px !important; font-weight:700 !important; }
.tier-badge { font-size:11px; padding:3px 10px; border-radius:20px; font-weight:600; }

/* ── Chat styles ─────────────────────────────────────────── */
.chat-msg-user { display:flex; justify-content:flex-end; }
.chat-msg-user > * { background:rgba(37,99,235,.15); border:1px solid rgba(37,99,235,.2); border-radius:16px 16px 4px 16px; padding:12px 16px; max-width:80%; font-size:15px; color:#f1f5f9; line-height:1.6; }
.chat-msg-assistant { display:flex; }
.chat-msg-assistant > * { max-width:90%; }
.typing-dots span { animation:blink 1.4s infinite both; }
.typing-dots span:nth-child(2) { animation-delay:.2s; }
.typing-dots span:nth-child(3) { animation-delay:.4s; }
@keyframes blink { 0%,80%,100%{opacity:0} 40%{opacity:1} }

/* ── Sidebar overlay ─────────────────────────────────────── */
.mc-sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(0,0,0,.55);
}
.mc-sidebar-overlay.visible { display: block; }

/* ── Responsive additions ────────────────────────────────── */
@media(max-width:1024px){
  .mc-sidebar { width:200px; }
}
@media(max-width:768px){
  /* Sidebar: GPU-accelerated slide-in using transform (avoids iOS Safari fixed-pos bugs) */
  .mc-sidebar {
    display: flex !important;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important; bottom: 0 !important;
    width: 260px !important;
    height: 100vh !important;
    min-height: 100vh !important;
    z-index: 9999 !important;
    transform: translateX(-100%) !important;
    -webkit-transform: translateX(-100%) !important;
    transition: transform .28s ease !important;
    -webkit-transition: -webkit-transform .28s ease !important;
    box-shadow: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .mc-sidebar.mobile-open {
    transform: translateX(0) !important;
    -webkit-transform: translateX(0) !important;
    box-shadow: 8px 0 40px rgba(0,0,0,.6) !important;
  }
  /* No horizontal scroll anywhere in the portal on mobile */
  .mc-portal-wrap,
  .mc-main,
  .mc-content { overflow-x: hidden !important; }
  /* Main content fills full width */
  .mc-main { width: 100% !important; min-width: 0 !important; }
  .mc-content { padding: 16px !important; }
  /* Tables: own horizontal scroll so wide tables stay accessible */
  .mc-table-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; }
  /* Grids with explicit minimums that could push past viewport — drop to 1 column */
  .mc-content [style*="minmax(320px"],
  .mc-content [style*="minmax(340px"] { grid-template-columns: 1fr !important; }
  /* Negative-margin grids (course-viewer, study-assistant) — reset to avoid overflow */
  .mc-viewer-grid,
  .mc-study-grid { margin: -16px !important; }
  .exam-body { grid-template-columns: 1fr !important; }
  .exam-nav-panel { display: none !important; }
  .mc-auth-card { padding: 24px !important; }
  /* Topbar: above overlay so hamburger/X is always tappable */
  .mc-topbar { padding: 0 16px !important; position: relative !important; z-index: 10001 !important; }
  /* Hamburger — large tap target, no 300ms delay */
  .mc-topbar-toggle {
    display: flex !important;
    min-width: 48px !important; min-height: 48px !important;
    padding: 10px 12px !important;
    font-size: 24px !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    cursor: pointer !important;
  }
}

/* ── Dark-body public pages: padding already handled in main.css ─ */
body[style*="background:var(--bg-dark)"] {
  padding-top: 70px;
}

/* ═══════════════════════════════════════════════════════════
   DARK BODY CONTEXT — fix all light-theme text classes
   Applies to any public page with body style="background:var(--bg-dark)"
   ═══════════════════════════════════════════════════════════ */
body[style*="background:var(--bg-dark)"] {
  color: #e2e8f0;
}

/* Course cards */
body[style*="background:var(--bg-dark)"] .mc-course-card {
  background: rgba(15,28,48,.95);
  border-color: rgba(255,255,255,.1);
  color: #e2e8f0;
}
body[style*="background:var(--bg-dark)"] .mc-course-title {
  color: #f1f5f9;
}
body[style*="background:var(--bg-dark)"] .mc-course-desc,
body[style*="background:var(--bg-dark)"] .mc-course-sub {
  color: #b0bdd0;
}
body[style*="background:var(--bg-dark)"] .mc-course-meta {
  color: #94a3b8;
}
body[style*="background:var(--bg-dark)"] .mc-course-footer {
  border-color: rgba(255,255,255,.08);
}
body[style*="background:var(--bg-dark)"] .mc-course-price {
  color: #f1f5f9;
}

/* Section headings */
body[style*="background:var(--bg-dark)"] .section-title,
body[style*="background:var(--bg-dark)"] h1,
body[style*="background:var(--bg-dark)"] h2,
body[style*="background:var(--bg-dark)"] h3,
body[style*="background:var(--bg-dark)"] h4 {
  color: #f1f5f9;
}
body[style*="background:var(--bg-dark)"] .section-sub {
  color: #b0bdd0;
}

/* Feature cards */
body[style*="background:var(--bg-dark)"] .mc-feature-card {
  background: rgba(15,28,48,.9);
  border-color: rgba(255,255,255,.08);
}
body[style*="background:var(--bg-dark)"] .mc-feature-title {
  color: #f1f5f9;
}
body[style*="background:var(--bg-dark)"] .mc-feature-desc {
  color: #b0bdd0;
}

/* Pricing / plan cards */
body[style*="background:var(--bg-dark)"] .mc-plan-card {
  background: rgba(15,28,48,.9);
  border-color: rgba(255,255,255,.08);
}
body[style*="background:var(--bg-dark)"] .mc-plan-name,
body[style*="background:var(--bg-dark)"] .mc-plan-price {
  color: #f1f5f9;
}
body[style*="background:var(--bg-dark)"] .mc-plan-desc {
  color: #94a3b8;
}
body[style*="background:var(--bg-dark)"] .mc-plan-feature {
  color: #d1d9e6;
}

/* Generic card/panel text */
body[style*="background:var(--bg-dark)"] .mc-card {
  color: #e2e8f0;
}

/* Labels and filter sidebar */
body[style*="background:var(--bg-dark)"] label {
  color: #d1d9e6;
}
body[style*="background:var(--bg-dark)"] p {
  color: #b0bdd0;
}

/* Tables on dark public pages */
body[style*="background:var(--bg-dark)"] table th {
  color: #94a3b8;
}
body[style*="background:var(--bg-dark)"] table td {
  color: #d1d9e6;
}
