/* TMICE Exam Portal - neon blue + violet exam theme */
:root {
  --tm-bg: #080A1C;
  --tm-surface: #0F1230;
  --tm-surface-2: #161A3D;
  --tm-line: rgba(130, 145, 255, .18);
  --tm-text: #E9ECFF;
  --tm-muted: #9BA4D6;
  --tm-blue: #3B82FF;
  --tm-cyan: #38D3FF;
  --tm-violet: #8B5CF6;
  --tm-grad: linear-gradient(135deg, #38D3FF 0%, #3B82FF 48%, #8B5CF6 100%);
  --tm-glow-blue: 0 0 0 1px rgba(59, 130, 255, .45), 0 0 22px rgba(59, 130, 255, .35);
  --tm-radius: 14px;
  --tm-sidebar-w: 272px;
  --bs-body-bg: var(--tm-bg);
  --bs-body-color: var(--tm-text);
  --bs-body-font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-border-color: var(--tm-line);
  --bs-link-color: var(--tm-cyan);
  --bs-link-hover-color: #8fe6ff;
}

html { -webkit-text-size-adjust: 100%; }
body {
  background:
    radial-gradient(900px 480px at 85% -10%, rgba(139, 92, 246, .16), transparent 60%),
    radial-gradient(800px 460px at -5% 105%, rgba(59, 130, 255, .14), transparent 60%),
    var(--tm-bg);
  background-attachment: fixed;
  min-height: 100vh;
}
h1, h2, h3, h4, .tm-brand-text strong, .tm-stat-value { font-family: "Sora", "DM Sans", system-ui, sans-serif; letter-spacing: -.01em; }
:focus-visible { outline: 2px solid var(--tm-cyan); outline-offset: 2px; }
.tm-muted { color: var(--tm-muted); }
.tm-fineprint { color: var(--tm-muted); font-size: .85rem; margin: 1.25rem 0 0; }

/* ---------- buttons + inputs ---------- */
.tm-btn-primary {
  background: var(--tm-grad); color: #fff; border: 0; font-weight: 600; padding: .75rem 1.25rem;
  border-radius: 12px; box-shadow: 0 6px 24px rgba(59, 130, 255, .35);
  transition: box-shadow .2s, transform .1s, filter .2s;
}
.tm-btn-primary:hover { color: #fff; filter: brightness(1.08); box-shadow: 0 8px 30px rgba(139, 92, 246, .45); }
.tm-btn-primary:active { transform: translateY(1px); }
.tm-btn-primary:disabled { opacity: .7; }
.tm-icon-btn {
  background: var(--tm-surface-2); border: 1px solid var(--tm-line); color: var(--tm-text);
  border-radius: 12px; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
}
.tm-icon-btn:hover { border-color: var(--tm-blue); color: #fff; }
.tm-input.form-control, .tm-input {
  background: var(--tm-surface-2); border: 1px solid var(--tm-line); color: var(--tm-text);
  border-radius: 12px; padding: .75rem .95rem; min-height: 46px;
}
.tm-input.form-control:focus { background: var(--tm-surface-2); color: var(--tm-text); border-color: var(--tm-blue); box-shadow: var(--tm-glow-blue); }
.tm-input::placeholder { color: #6E78AE; }
.input-group > .tm-input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .tm-icon-btn { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0; }
.form-label { font-weight: 500; color: var(--tm-text); }
.tm-alert { border-radius: 12px; border: 1px solid var(--tm-line); }

/* ---------- login ---------- */
.tm-bare { display: block; }
.tm-login { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.tm-login-art { display: none; }
.tm-login-card {
  width: 100%; max-width: 440px; margin: auto; padding: 2rem 1.25rem;
}
.tm-login-card h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: .35rem; }
.tm-login-card form { margin-top: 1.5rem; }
.tm-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin-bottom: 1.25rem; background: var(--tm-surface); border: 1px solid var(--tm-line); border-radius: 14px; }
.tm-seg-btn {
  border: 0; background: transparent; color: var(--tm-muted); padding: .6rem .25rem; border-radius: 10px; font-weight: 600; font-size: .92rem;
  display: inline-flex; gap: .4rem; align-items: center; justify-content: center; min-height: 44px; transition: background .2s, color .2s;
}
.tm-seg-btn:hover { color: var(--tm-text); }
.tm-seg-btn.active { background: var(--tm-grad); color: #fff; box-shadow: 0 4px 16px rgba(59, 130, 255, .35); }

@media (min-width: 992px) {
  .tm-login { grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); }
  .tm-login-art {
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 3rem;
    border-right: 1px solid var(--tm-line);
    background: radial-gradient(620px 420px at 50% 42%, rgba(59, 130, 255, .18), transparent 70%);
  }
  .tm-login-art h1 { font-size: 2.4rem; font-weight: 700; margin: 2rem 0 .35rem; }
  .tm-login-art p { color: var(--tm-muted); font-size: 1.05rem; margin: 0; }
  .tm-login-card { padding: 3rem 2rem; }
}

/* the countdown ring - the one signature element */
.tm-ring { position: relative; width: min(300px, 60%); aspect-ratio: 1; }
.tm-ring svg { width: 100%; height: 100%; display: block; overflow: visible; }
.tm-ring-track { fill: none; stroke: rgba(130, 145, 255, .16); stroke-width: 6; }
.tm-ring-arc {
  fill: none; stroke-width: 6; stroke-linecap: round; stroke-dasharray: 540.4; stroke-dashoffset: 135;
  transform: rotate(-90deg); transform-origin: 100px 100px; filter: drop-shadow(0 0 8px rgba(59, 130, 255, .8));
  animation: tm-sweep 9s ease-in-out infinite alternate;
}
.tm-ring-ticks line { stroke: rgba(155, 164, 214, .4); stroke-width: 1.2; }
.tm-ring-core {
  position: absolute; inset: 27%; border-radius: 50%; display: grid; place-items: center; font-size: 3.2rem; color: #fff;
  background: var(--tm-grad); box-shadow: 0 0 60px rgba(139, 92, 246, .55), inset 0 0 24px rgba(255, 255, 255, .15);
}
@keyframes tm-sweep { from { stroke-dashoffset: 40; } to { stroke-dashoffset: 400; } }
@media (prefers-reduced-motion: reduce) { .tm-ring-arc { animation: none; } * { scroll-behavior: auto !important; } }

/* ---------- app shell ---------- */
.tm-sidebar { --bs-offcanvas-bg: var(--tm-surface); --bs-offcanvas-width: 288px; --bs-offcanvas-color: var(--tm-text); --bs-offcanvas-border-color: var(--tm-line); }
.tm-brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.25rem 1rem; }
.tm-brand-mark {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 1.25rem;
  background: var(--tm-grad); box-shadow: var(--tm-glow-blue);
}
.tm-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.tm-brand-text strong { font-size: 1.15rem; }
.tm-brand-text small { color: var(--tm-muted); font-size: .8rem; }
.tm-nav { flex: 1; overflow-y: auto; padding: .5rem .85rem 1rem; display: flex; flex-direction: column; gap: 4px; }
.tm-nav-link {
  position: relative; display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; border-radius: 12px;
  color: var(--tm-muted); text-decoration: none; font-weight: 500; min-height: 44px; transition: background .2s, color .2s;
}
.tm-nav-link i { font-size: 1.1rem; }
.tm-nav-link:hover { background: rgba(130, 145, 255, .1); color: var(--tm-text); }
.tm-nav-link.active { background: rgba(59, 130, 255, .14); color: #fff; }
.tm-nav-link.active::before {
  content: ""; position: absolute; left: -.85rem; top: 22%; bottom: 22%; width: 4px; border-radius: 0 4px 4px 0;
  background: var(--tm-grad); box-shadow: 0 0 14px rgba(59, 130, 255, .9);
}
.tm-nav-link.disabled { opacity: .55; cursor: default; }
.tm-nav-link.disabled:hover { background: transparent; color: var(--tm-muted); }
.tm-nav-link em { margin-left: auto; font-style: normal; font-size: .72rem; padding: .1rem .5rem; border-radius: 999px; border: 1px solid var(--tm-line); }
.tm-sidebar-foot { padding: 1rem 1.25rem; border-top: 1px solid var(--tm-line); color: var(--tm-muted); font-size: .8rem; }

.tm-main { min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.tm-topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .85rem; padding: .8rem 1.25rem;
  background: rgba(8, 10, 28, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--tm-line);
}
.tm-page-title { font-size: 1.15rem; font-weight: 600; margin: 0; }
.tm-user { display: flex; align-items: center; gap: .6rem; background: var(--tm-surface-2); border: 1px solid var(--tm-line); color: var(--tm-text); border-radius: 999px; padding: .3rem .8rem .3rem .3rem; min-height: 44px; }
.tm-user:hover { border-color: var(--tm-blue); }
.tm-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--tm-grad); }
.tm-user-meta { flex-direction: column; line-height: 1.15; text-align: left; max-width: 190px; }
.tm-user-meta strong { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-user-meta small { color: var(--tm-muted); font-size: .75rem; }
.tm-dropdown { --bs-dropdown-bg: var(--tm-surface-2); --bs-dropdown-border-color: var(--tm-line); --bs-dropdown-link-hover-bg: rgba(130, 145, 255, .12); --bs-dropdown-link-color: var(--tm-text); --bs-dropdown-link-hover-color: #fff; border-radius: 12px; }
.tm-content { padding: 1.5rem 1.25rem 3rem; width: 100%; max-width: 1280px; }

@media (min-width: 992px) {
  .tm-sidebar.offcanvas-lg {
    position: fixed !important; top: 0; bottom: 0; left: 0; width: var(--tm-sidebar-w) !important; height: 100vh !important;
    visibility: visible !important; transform: none !important; display: flex !important; flex-direction: column;
    background: var(--tm-surface) !important; border-right: 1px solid var(--tm-line) !important;
  }
  .tm-main { margin-left: var(--tm-sidebar-w); }
  .tm-topbar { padding: .85rem 2rem; }
  .tm-content { padding: 2rem 2rem 3rem; }
}

/* ---------- dashboard ---------- */
.tm-hero {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; padding: 1.75rem; margin-bottom: 1.5rem;
  border: 1px solid var(--tm-line); border-radius: 18px;
  background: linear-gradient(120deg, rgba(59, 130, 255, .2), rgba(139, 92, 246, .16) 60%, rgba(15, 18, 48, .6));
  box-shadow: 0 0 0 1px rgba(59, 130, 255, .12) inset;
}
.tm-hero h2 { font-size: clamp(1.4rem, 2.4vw, 2rem); font-weight: 700; margin: 0 0 .3rem; }
.tm-hero p { color: var(--tm-muted); margin: 0; max-width: 60ch; }
.tm-hero-name { color: var(--tm-text); font-weight: 600; background: rgba(8, 10, 28, .45); border: 1px solid var(--tm-line); border-radius: 999px; padding: .4rem .95rem; }
.tm-stat { display: flex; align-items: center; gap: .9rem; padding: 1.1rem; height: 100%; background: var(--tm-surface); border: 1px solid var(--tm-line); border-radius: var(--tm-radius); }
.tm-stat-icon { width: 46px; height: 46px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; }
.tone-blue .tm-stat-icon { color: var(--tm-blue); background: rgba(59, 130, 255, .14); box-shadow: inset 0 0 0 1px rgba(59, 130, 255, .35); }
.tone-violet .tm-stat-icon { color: #b69cff; background: rgba(139, 92, 246, .16); box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .4); }
.tone-cyan .tm-stat-icon { color: var(--tm-cyan); background: rgba(56, 211, 255, .12); box-shadow: inset 0 0 0 1px rgba(56, 211, 255, .35); }
.tm-stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.tm-stat-label { color: var(--tm-muted); font-size: .88rem; }
.tm-panel { background: var(--tm-surface); border: 1px solid var(--tm-line); border-radius: 18px; padding: 1.25rem; }
.tm-panel-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 1rem; }
.tm-empty { color: var(--tm-muted); padding: .75rem 0; }
.tm-table { --bs-table-bg: transparent; --bs-table-color: var(--tm-text); --bs-table-border-color: var(--tm-line); --bs-table-hover-bg: rgba(130, 145, 255, .06); }
.tm-table thead th { color: var(--tm-muted); font-weight: 600; font-size: .82rem; border-bottom-color: var(--tm-line); white-space: nowrap; }
.tm-table td { padding-top: .8rem; padding-bottom: .8rem; }

@media (max-width: 575.98px) {
  .tm-table thead { display: none; }
  .tm-table, .tm-table tbody, .tm-table tr, .tm-table td { display: block; width: 100%; }
  .tm-table tr { padding: .6rem 0; border-bottom: 1px solid var(--tm-line); }
  .tm-table td { border: 0; padding: .2rem 0; }
  .tm-table td::before { content: attr(data-label); display: block; color: var(--tm-muted); font-size: .75rem; }
  .tm-stat-value { font-size: 1.4rem; }
  .tm-hero { padding: 1.25rem; }
}

/* ---------- error pages ---------- */
.tm-error { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem; gap: .75rem; }
.tm-error-code { font-family: "Sora", sans-serif; font-size: clamp(4rem, 14vw, 7rem); font-weight: 700; line-height: 1; background: var(--tm-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tm-error h1 { font-size: 1.5rem; margin: 0; }
.tm-error p { color: var(--tm-muted); max-width: 46ch; margin: 0 0 .75rem; }
