/* =========================================================================
   ODIE — shared interface theme
   Palette pulled from the Cyber regimental crest: gun-metal charcoal,
   brushed silver-gray steel, antique military gold (the sword).
   Defense-console aesthetic: square edges, hairline borders, restrained
   gold accent, generous padding. Single stylesheet shared across the admin,
   student, and candidate interfaces.

   No external font dependency (works offline / under strict CSP). "Saira"
   is listed first as a progressive enhancement if present locally; the
   condensed system stack is the dependable fallback.
   ========================================================================= */

:root {
  --bg:        #0f0f0f;
  --panel:     #181818;
  --panel-2:   #222222;
  --inset:     #0b0b0b;

  --ink:       #ececea;
  --ink-dim:   #a2a2a2;
  --ink-faint: #6e6e6e;

  --steel:     #3a3a3a;
  --steel-2:   #555555;
  --steel-hi:  rgba(255,255,255,.05);

  --gold:      #c29a3d;
  --gold-hi:   #e0b94e;
  --gold-dim:  rgba(194,154,61,.14);

  --ok:        #84a96b;
  --bad:       #c66b62;
  --warn:      #d2ad55;

  --overlay:   rgba(11,11,11,.80);

  --sans: "Saira", "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --cond: "Saira Condensed", "Oswald", "Arial Narrow", "Helvetica Neue Condensed", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", "Courier New", monospace;
}

* { box-sizing: border-box; }
*, *::before, *::after { border-radius: 0 !important; }   /* square edges everywhere */

html, body {
  width: 100%; min-height: 100%;
  margin: 0; padding: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- shell: crest + top-layer transparency ---- */
div.outer {
  max-width: 1040px; margin: 0 auto; min-height: 100vh;
  background-color: #000;
  background-image: url('img/cyber_regimental_crest-web.png');
  background-position: center 120px;
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: 520px auto;
  border-left: 1px solid var(--steel);
  border-right: 1px solid var(--steel);
  overflow: hidden;
}
div.content-background { background: var(--overlay); min-height: 100vh; width: 100%; }
div.content { color: var(--ink); padding: 34px 48px 60px; }

/* ---- typography ---- */
h1, h2, h3, h4 { font-family: var(--cond); margin: 0; font-weight: 600; }
h1 {
  font-size: 2.1rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #f3f4f6; padding-bottom: 14px; margin: 0 0 26px;
  border-bottom: 1px solid var(--steel); position: relative;
}
h1::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 84px; height: 3px; background: var(--gold); }
h2 { font-size: 1.5rem; letter-spacing: .08em; text-transform: uppercase; color: #f0f1f3; margin-bottom: 16px; }
h3 { font-size: 1.06rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: 14px; }

a { color: var(--gold-hi); text-decoration: none; border-bottom: 1px solid transparent; }
a:hover { border-bottom-color: var(--gold-hi); }

code, .mono, pre { font-family: var(--mono); }

/* ---- panels / sections (legacy + new) ---- */
.panel,
div.info-section,
div.login-section {
  background: var(--panel);
  border: 1px solid var(--steel);
  box-shadow: inset 0 1px 0 var(--steel-hi);
  padding: 22px 24px;
  margin: 0 0 22px;
}
div.info-section { border-style: solid; }   /* was dashed */
.panel-note { color: var(--ink-dim); font-size: .92rem; margin: 0 0 16px; }

/* section-label = the legacy sub-heading (used across candidate/login views) */
div.section-label { text-align: left; margin: 0 0 12px; }
div.section-label span,
span.label { color: var(--gold); font-size: 1rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; text-decoration: none; }
span.label { display: block; }

/* ---- buttons ---- */
button, .btn {
  font-family: var(--sans);
  font-size: .9rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, #242424, #1b1b1b);
  border: 1px solid var(--steel-2);
  padding: 9px 18px; cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
button:hover, .btn:hover { border-color: var(--gold); color: var(--gold-hi); background: linear-gradient(180deg, #2a2a2a, #1f1f1f); }
button:active, .btn:active { box-shadow: inset 0 2px 4px rgba(0,0,0,.5); }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
button:disabled, .login-disable:disabled { opacity: .45; cursor: not-allowed; }
button + button { margin-left: 8px; }

.btn-primary { color: #14110a; background: linear-gradient(180deg, var(--gold-hi), var(--gold)); border: 1px solid #8a6c25; text-shadow: 0 1px 0 rgba(255,255,255,.18); }
.btn-primary:hover { color: #14110a; background: linear-gradient(180deg, #ecc55c, var(--gold-hi)); border-color: #a07e2c; }
.btn-danger { color: var(--bad); border-color: #5a3b39; }
.btn-danger:hover { color: #fff; background: #7c3a35; border-color: #9a4a44; }
.btn-sm { padding: 5px 11px; font-size: .78rem; letter-spacing: .05em; }

div.launch-button { text-align: center; margin: 14px 0 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---- inputs ---- */
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  background: var(--inset); border: 1px solid var(--steel-2); color: var(--ink);
  padding: 9px 11px; font-family: var(--sans); font-size: .96rem; max-width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-dim), inset 0 0 0 1px rgba(194,154,61,.25);
}
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--gold); vertical-align: middle; }
input.invisible { background: transparent; border: none; color: var(--ink); font-family: var(--mono); font-size: 1em; width: 400px; max-width: 100%; }
label { color: var(--ink); }
.field { margin: 0 0 14px; }
.field > label { display: block; color: var(--ink-dim); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }

/* ---- config key/value list ---- */
ul.config-list { list-style: none; padding: 0; margin: 0; text-align: left; }
ul.config-list li {
  display: grid; grid-template-columns: 250px 1fr; gap: 14px; align-items: baseline;
  padding: 9px 0; margin: 0; border-bottom: 1px solid var(--steel); list-style-type: none;
}
ul.config-list li:last-child { border-bottom: none; }
ul.config-list li form { display: block; text-align: center; }
span.config_label { display: inline-block; width: auto; text-align: left; color: var(--ink-dim); font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; padding: 0; margin: 0; }
pre.config_value, span.config_value, code.config_value { display: inline-block; padding: 0; margin: 0; text-align: left; color: var(--ink); font-family: var(--mono); font-size: .9rem; word-break: break-all; }

/* ---- generic legacy lists ---- */
ul li { list-style-type: none; }
ul, li { padding: 0; margin: 0; }
.info-section ul, .login-section ul { padding-left: 0; }

/* ---- credentials (candidate VM/CTFd access) ---- */
.credentials { display: none; }   /* toggled open by the page JS */
ul.credentials-list { width: 100%; max-width: 640px; margin: 8px 0; padding: 0; text-align: left; }
ul.credentials-list li { display: grid; grid-template-columns: 200px 1fr; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--steel); }
ul.credentials-list li:last-child { border-bottom: none; }
ul.credentials-list .label { color: var(--ink-dim); font-size: .78rem; letter-spacing: .07em; text-transform: uppercase; font-weight: 600; }
code.descriptor { display: inline-block; color: var(--ink); background: var(--inset); border: 1px solid var(--steel); padding: 5px 10px; font-family: var(--mono); font-size: .88rem; word-break: break-all; }
.descriptor { margin-left: 0; }
button.descriptor { cursor: pointer; }

/* VM status row */
div.section-vm-status { margin: 4px 0 12px; color: var(--ink-dim); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
div.section-vm-status > span:first-child { font-size: .8rem; letter-spacing: .07em; text-transform: uppercase; }
.vm-status-text { color: var(--gold-hi); font-family: var(--mono); font-size: .9rem; }

/* instructions / help text */
p.instructions, div.login_instructions p, p.warning { text-align: left; color: var(--ink-dim); }
p.warning { color: var(--warn); padding: 0; }
div.user_info, div.account_info { text-align: left; }
div.user_info p, div.account_info p, div.login_instructions p { padding: 0; margin: 6px 0; text-align: left; }

/* ---- timer ---- */
.timer { text-align: center; display: block; width: 100%; padding: 16px 18px; margin: 6px 0; background: var(--inset); border: 1px solid var(--steel); font-family: var(--mono); font-size: 1.6rem; color: var(--gold-hi); letter-spacing: .04em; }

/* =========================================================================
   Candidate panel — mockup alignment (topbar header, gold diamond markers,
   floated toggle-credentials, click-to-copy credentials, themed session timer)
   ========================================================================= */
.topbar { display: flex; align-items: center; gap: 18px; margin: 0 0 22px; }
.brandrow { display: flex; align-items: center; gap: 18px; }
.brandrow img { width: 52px; height: 52px; opacity: .95; }
.topbar h1 { border: none; margin: 0; padding: 0; }
.topbar h1::after { display: none; }
h1 .sub { display: block; font-family: var(--sans); font-size: .8rem; letter-spacing: .32em; color: var(--ink-dim); font-weight: 500; margin-top: 8px; text-transform: uppercase; }

/* gold diamond markers + floated toggle, scoped to the candidate panel */
.user_info div.section-label { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.user_info div.section-label > span:first-child { display: inline-flex; align-items: center; gap: 11px; }
.user_info div.section-label > span:first-child::before { content: ""; width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); flex: 0 0 auto; }
a.toggle-creds { margin-left: auto; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); border: 1px solid var(--steel-2); padding: 4px 11px; }
a.toggle-creds:hover { color: var(--gold-hi); border-color: var(--gold); }

/* VM status: running = green, stopped = amber (loading stays gold) */
.vm-status-text-running { color: var(--ok); }
.vm-status-text-stopped { color: var(--warn); }

/* click-to-copy credential boxes (hover reveals hint, click flips to "copied!") */
ul.credentials-list code.descriptor { display: block; position: relative; cursor: pointer; padding-right: 72px; }
ul.credentials-list code.descriptor:hover { border-color: var(--gold); }
ul.credentials-list code.descriptor::after { content: "click to copy"; position: absolute; top: 50%; right: 10px; transform: translateY(-50%); font-family: var(--sans); font-size: .62rem; letter-spacing: .05em; text-transform: uppercase; color: var(--gold-hi); opacity: 0; transition: opacity .12s; pointer-events: none; white-space: nowrap; }
ul.credentials-list code.descriptor:hover::after { opacity: .85; }
ul.credentials-list code.descriptor.copied { border-color: var(--ok); color: var(--ok); }
ul.credentials-list code.descriptor.copied::after { content: "copied!"; color: var(--ok); opacity: 1; }

/* themed session timer (mockup) */
.session-timer { display: flex; gap: 16px; flex-wrap: wrap; }
.session-timer .stat { flex: 1 1 220px; background: var(--inset); border: 1px solid var(--steel); border-top: 2px solid var(--gold); padding: 14px 18px 16px; text-align: center; }
.session-timer .stat .k { display: block; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 8px; }
.session-timer .stat .v { font-family: var(--mono); font-size: 1.7rem; color: var(--gold-hi); letter-spacing: .04em; }
.session-timer .stat.primary .v { font-size: 2.1rem; }

.start-here { display: inline-block; margin-top: 6px; color: var(--gold-hi); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; }

/* ---- teardown ---- */
.teardown-section { text-align: left; }
.confirm-section { text-align: left; margin: 10px 0; }

/* ---- status colors ---- */
.has_account_true, .account_disabled_false, .ok-text { color: var(--ok); }
.has_account_false, .account_disabled_true, .bad-text { color: var(--bad); }

/* ---- errors ---- */
div.error { margin: 14px 0; text-align: center; color: var(--bad); }
div.error h3 { color: var(--bad); }

/* ---- utility ---- */
.max-height-600px { max-height: 600px; overflow: auto; }
.muted { color: var(--ink-dim); }
.note { color: var(--ink-dim); font-size: .92rem; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
hr.rule { border: none; border-top: 1px solid var(--steel); margin: 22px 0; }

/* ---- centered single-column form pages (login shell, student request) ---- */
body.form-page div.content { text-align: center; }
body.form-page div.login-section { max-width: 480px; margin-left: auto; margin-right: auto; text-align: center; }
body.form-page div.login-section.wide { max-width: 660px; }
body.form-page div.section-label { text-align: center; }
body.form-page div.section-label span { display: block; margin-bottom: 8px; }
body.form-page input[type=text], body.form-page input[type=email], body.form-page input[type=password] { width: 100%; }
body.form-page #login-submit-button, body.form-page #login-restart-button, body.form-page .launch-button { margin-top: 12px; }

/* =========================================================================
   New components (tables, badges, legend, dialogs) for views that adopt them
   ========================================================================= */
table.data { width: 100%; border-collapse: collapse; border: 1px solid var(--steel); font-size: .94rem; }
table.data thead th { background: var(--panel-2); color: var(--ink-dim); font-family: var(--cond); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; font-size: .82rem; text-align: left; padding: 11px 14px; border-bottom: 2px solid var(--gold); white-space: nowrap; }
table.data tbody td { padding: 11px 14px; border-bottom: 1px solid var(--steel); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:nth-child(even) { background: rgba(255,255,255,.018); }
table.data tbody tr:hover { background: var(--gold-dim); }
table.data td.mono, table.data td .mono { font-size: .86rem; color: var(--ink-dim); }
table.data td.right, table.data th.right { text-align: right; }

.badge { display: inline-block; padding: 3px 9px; font-size: .74rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; border: 1px solid var(--steel-2); color: var(--ink-dim); }
.badge.ok { color: var(--ok); border-color: rgba(132,169,107,.5); background: rgba(132,169,107,.10); }
.badge.bad { color: var(--bad); border-color: rgba(198,107,98,.5); background: rgba(198,107,98,.10); }
.badge.warn { color: var(--warn); border-color: rgba(210,173,85,.5); background: rgba(210,173,85,.10); }
.badge.idle { color: var(--ink-dim); }

.legend { display: flex; flex-wrap: wrap; gap: 10px 20px; padding: 12px 14px; border: 1px solid var(--steel); background: var(--inset); margin: 0 0 16px; }
.legend .item { display: flex; align-items: center; gap: 9px; font-size: .84rem; color: var(--ink-dim); }

/* =========================================================================
   jQuery UI re-skin (admin app dialogs: config editor, test stack, manage
   admins, login history) + datepicker/buttons
   ========================================================================= */
.ui-widget { font-family: var(--sans); }
.ui-widget-overlay { background: rgba(4,5,7,.66); opacity: 1; }
.ui-dialog { background: var(--panel); border: 1px solid var(--steel-2); box-shadow: 0 18px 60px rgba(0,0,0,.6); padding: 0; color: var(--ink); }
.ui-dialog .ui-dialog-titlebar { background: var(--panel-2); border: none; border-bottom: 2px solid var(--gold); padding: 12px 18px; color: var(--gold-hi); font-family: var(--cond); letter-spacing: .08em; text-transform: uppercase; }
.ui-dialog .ui-dialog-title { color: var(--gold-hi); font-size: 1.05rem; }
.ui-dialog .ui-dialog-titlebar-close { background: transparent; border: 1px solid var(--steel); width: 28px; height: 28px; right: 14px; top: 12px; margin-top: 0; }
.ui-dialog .ui-dialog-titlebar-close .ui-icon { background: none; color: var(--ink-dim); text-indent: 0; overflow: visible; width: auto; height: auto; }
.ui-dialog .ui-dialog-titlebar-close .ui-icon::before { content: "\00d7"; display: block; text-align: center; line-height: 26px; font-size: 1.1rem; }
.ui-dialog .ui-dialog-titlebar-close:hover { border-color: var(--gold); }
.ui-dialog .ui-dialog-titlebar-close:hover .ui-icon { color: var(--gold-hi); }
.ui-dialog .ui-dialog-content { background: var(--panel); color: var(--ink); padding: 20px 22px; }
.ui-dialog .ui-dialog-buttonpane { background: var(--panel); border: none; border-top: 1px solid var(--steel); margin-top: 0; padding: 12px 18px; }
.ui-dialog .ui-dialog-buttonpane .ui-button { font-family: var(--sans); font-size: .9rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); background: linear-gradient(180deg,#242424,#1b1b1b); border: 1px solid var(--steel-2); padding: 8px 16px; }
.ui-dialog .ui-dialog-buttonpane .ui-button:hover { border-color: var(--gold); color: var(--gold-hi); }
.ui-widget-content { background: var(--panel); color: var(--ink); border-color: var(--steel); }
.ui-widget-header { background: var(--panel-2); color: var(--gold-hi); border-color: var(--steel); }
.no-close .ui-dialog-titlebar-close { display: none; }
