/* ===================================================
   SIPOLDA — Police Database SQL Training
   style.css
   =================================================== */

/* --- RESET & ROOT --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep:       #030b14;
  --bg-panel:      #05111f;
  --bg-card:       #071828;
  --bg-input:      #040e1a;
  --border:        #0a3050;
  --border-glow:   #0f6ea0;
  --accent:        #00c8ff;
  --accent-dim:    #006f8e;
  --gold:          #f5c518;
  --red:           #ff3a3a;
  --red-dim:       #7a1010;
  --green:         #00ff88;
  --green-dim:     #005c30;
  --text-main:     #c8e0f0;
  --text-dim:      #4a6a82;
  --text-muted:    #2a4a60;
  --font-mono:     'Share Tech Mono', monospace;
  --font-display:  'Orbitron', sans-serif;
  --font-body:     'Inter', sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-body);
  overflow-x: hidden;
}

/* ---- SCANLINES ---- */
.scanlines {
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.08) 3px,
    rgba(0,0,0,0.08) 4px
  );
}

/* ---- HEADER ---- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(180deg, #020a12 0%, #050f1c 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 24px rgba(0,200,255,0.08);
}

.header-inner {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 24px;
}

/* Badge */
.badge-wrap { flex-shrink: 0; }
.badge {
  width: 52px; height: 52px;
  background: radial-gradient(circle at 50% 30%, #f5c518, #a87c00);
  border-radius: 50%; border: 3px solid #7a5c00;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 0 18px rgba(245,197,24,0.5);
}
.badge-star { font-size: 18px; line-height: 1; }
.badge-text { font-family: var(--font-display); font-size: 7px; color: #3a2800; font-weight: 900; letter-spacing: 1px; }

.header-title { flex: 1; }
.header-title h1 {
  font-family: var(--font-display); font-size: clamp(18px, 2.5vw, 26px);
  font-weight: 900; letter-spacing: 4px;
  background: linear-gradient(90deg, #00c8ff, #ffffff, #00c8ff);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  animation: shimmer 4s linear infinite;
  background-size: 200% auto;
}
@keyframes shimmer { to { background-position: 200% center; } }
.subtitle {
  font-size: 10px; color: var(--text-dim); letter-spacing: 2px;
  font-family: var(--font-mono); text-transform: uppercase; margin-top: 2px;
}

.header-status { display: flex; align-items: center; gap: 8px; }
.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; box-shadow: 0 0 10px var(--green); }
  50% { opacity: 0.4; box-shadow: 0 0 4px var(--green); }
}
.status-text { font-family: var(--font-mono); font-size: 11px; color: var(--green); letter-spacing: 2px; }

/* Ticker */
.ticker-wrap {
  width: 100%; overflow: hidden;
  background: var(--red-dim); border-top: 1px solid var(--red);
  padding: 5px 0;
}
.ticker {
  display: inline-flex; white-space: nowrap;
  font-family: var(--font-mono); font-size: 11px; color: #ffaaaa; letter-spacing: 1px;
  animation: ticker-scroll 28s linear infinite;
}
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---- MAIN LAYOUT ---- */
.main-layout {
  display: grid;
  grid-template-columns: 300px 1fr 280px;
  gap: 0;
  height: calc(100vh - 90px);
  overflow: hidden;
}

/* ---- PANELS ---- */
.panel {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex; flex-direction: column;
  gap: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-glow) var(--bg-panel);
}
.panel:last-child { border-right: none; }
.panel-left  { background: var(--bg-panel); }
.panel-center { background: var(--bg-deep); border-right: 1px solid var(--border); }
.panel-right { background: var(--bg-panel); }

.panel-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: rgba(0,200,255,0.04);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display); font-size: 11px; letter-spacing: 3px;
  color: var(--accent); text-transform: uppercase;
  position: sticky; top: 0; z-index: 10;
}

/* ---- MISSION INTRO ---- */
.mission-intro { padding: 16px; border-bottom: 1px solid var(--border); }

.classified-stamp {
  display: inline-block;
  border: 2px solid var(--red); color: var(--red);
  font-family: var(--font-display); font-size: 11px; letter-spacing: 4px;
  padding: 2px 10px; border-radius: 3px; margin-bottom: 10px;
  transform: rotate(-2deg);
  box-shadow: 0 0 10px rgba(255,58,58,0.3);
}

.case-title {
  font-family: var(--font-display); font-size: 14px; letter-spacing: 2px;
  color: var(--gold); margin-bottom: 4px;
}
.case-date { font-size: 10px; color: var(--text-dim); font-family: var(--font-mono); margin-bottom: 10px; }

.briefing-text {
  font-size: 12px; line-height: 1.6; color: var(--text-main); margin-bottom: 8px;
}
.briefing-text strong { color: var(--accent); }
.briefing-text em { color: var(--gold); font-style: normal; }

.witness-box {
  background: rgba(245,197,24,0.05); border: 1px solid rgba(245,197,24,0.3);
  border-radius: 6px; padding: 10px; margin-top: 10px;
}
.witness-label { font-size: 10px; color: var(--gold); font-family: var(--font-display); letter-spacing: 2px; margin-bottom: 6px; }
.witness-quote { font-size: 12px; color: #d4c080; line-height: 1.6; font-style: italic; }

/* ---- MISSION LIST ---- */
.mission-list { padding: 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.mission-list-header { font-size: 10px; color: var(--text-dim); letter-spacing: 3px; font-family: var(--font-display); margin-bottom: 6px; }

.mission-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; text-align: left;
  transition: all 0.2s;
}
.mission-btn:hover { border-color: var(--accent-dim); background: rgba(0,200,255,0.06); }
.mission-btn.active { border-color: var(--accent); background: rgba(0,200,255,0.1); }

.mission-num { font-family: var(--font-mono); font-size: 11px; color: var(--accent); flex-shrink: 0; width: 36px; }
.mission-name { font-size: 12px; color: var(--text-main); flex: 1; }
.mission-status { font-family: var(--font-mono); font-size: 14px; color: var(--text-muted); flex-shrink: 0; }
.mission-status.done { color: var(--green); }

/* ---- SCHEMA BOX ---- */
.schema-box { padding: 12px; }
.schema-header { font-size: 10px; color: var(--text-dim); letter-spacing: 3px; font-family: var(--font-display); margin-bottom: 10px; }
.schema-table { margin-bottom: 10px; }
.schema-table-name {
  font-family: var(--font-mono); font-size: 12px; color: var(--gold);
  margin-bottom: 3px;
}
.schema-table-name::before { content: '▶ '; }
.schema-cols { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); line-height: 1.6; padding-left: 12px; }

/* ---- MISSION DISPLAY ---- */
.mission-display {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,200,255,0.03);
  flex-shrink: 0;
  max-height: 310px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-glow) transparent;
}
.mission-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-size: 10px; letter-spacing: 3px;
  color: var(--bg-deep); background: var(--accent);
  padding: 3px 12px; border-radius: 2px; margin-bottom: 10px;
}
.mission-title-text {
  font-family: var(--font-display); font-size: 15px; letter-spacing: 1px;
  color: #ffffff; margin-bottom: 8px;
}
.mission-desc { font-size: 13px; line-height: 1.7; color: var(--text-main); }
.mission-desc strong { color: var(--accent); }
.mission-desc code {
  font-family: var(--font-mono); font-size: 12px;
  background: rgba(0,200,255,0.12); color: var(--accent);
  padding: 1px 6px; border-radius: 3px;
}
.mission-objective {
  margin-top: 10px; padding: 10px 14px;
  background: rgba(0,200,255,0.06); border-left: 3px solid var(--accent);
  font-size: 12px; color: var(--text-main); line-height: 1.6;
}
.mission-objective strong { color: var(--gold); }

/* ---- PHASE 2 MISSION LIST STYLES ---- */
.mission-phase-header {
  padding: 8px 12px 4px;
  font-family: var(--font-display); font-size: 9px; letter-spacing: 3px;
  color: var(--text-muted); text-transform: uppercase;
  border-top: 1px solid var(--border); margin-top: 4px;
}
.mission-phase-header.p2 { color: rgba(255,100,50,0.6); }
.mission-phase-header.p2.unlocked { color: #ff7040; }

.mission-btn.locked {
  opacity: 0.35; cursor: not-allowed; pointer-events: none;
}
.mission-btn.p2-mission { border-color: rgba(255,100,50,0.2); }
.mission-btn.p2-mission:hover { border-color: rgba(255,100,50,0.5); background: rgba(255,100,50,0.06); }
.mission-btn.p2-mission.active { border-color: #ff6030; background: rgba(255,96,48,0.12); }
.mission-btn.p2-mission .mission-num { color: #ff7040; }
.mission-btn.p2-mission .mission-status.done { color: #ff9060; }

.p2-unlock-banner {
  margin: 8px 12px;
  padding: 10px 12px;
  background: rgba(255,96,48,0.08);
  border: 1px solid rgba(255,96,48,0.35);
  border-radius: 6px;
  font-size: 11px; color: #ff9060; line-height: 1.5;
  font-family: var(--font-mono);
}
.p2-unlock-banner strong { color: #ff7040; font-family: var(--font-display); letter-spacing: 1px; }

.mission-tag.p2 {
  background: #ff6030;
  color: #fff;
}

/* ---- TERMINAL ---- */
.terminal-wrap {
  flex: 1; display: flex; flex-direction: column;
  margin: 16px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0,200,255,0.06), inset 0 0 40px rgba(0,0,0,0.3);
}

.terminal-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: #040c17; border-bottom: 1px solid var(--border);
}
.terminal-dots { display: flex; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #ffbd2e; }
.dot-green  { background: #28c840; }
.terminal-title { flex: 1; font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); text-align: center; }
.btn-hint {
  font-family: var(--font-mono); font-size: 10px;
  background: rgba(245,197,24,0.1); border: 1px solid rgba(245,197,24,0.4);
  color: var(--gold); padding: 4px 10px; border-radius: 4px; cursor: pointer;
  transition: all 0.2s;
}
.btn-hint:hover { background: rgba(245,197,24,0.2); }

.terminal-history {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 16px;
  font-family: var(--font-mono);
  scrollbar-width: thin; scrollbar-color: var(--border-glow) transparent;
}

.terminal-welcome pre {
  color: var(--accent-dim); font-size: 9px; line-height: 1.2;
  white-space: pre;
}
.welcome-line { font-size: 13px; color: var(--text-dim); margin-top: 6px; }
.welcome-line.dim { color: var(--text-muted); }
.welcome-line kbd {
  background: rgba(0,200,255,0.15); border: 1px solid var(--accent-dim);
  color: var(--accent); padding: 1px 6px; border-radius: 3px; font-size: 11px;
}

/* History entries */
.history-entry { display: flex; flex-direction: column; gap: 6px; }
.history-query {
  display: flex; gap: 8px; align-items: flex-start;
}
.history-prompt { color: var(--red); font-size: 13px; flex-shrink: 0; padding-top: 1px; }
.history-query-text { font-size: 13px; color: #80d0f0; white-space: pre-wrap; word-break: break-all; }
.history-time { font-size: 10px; color: var(--text-muted); }

.history-result-wrap { margin-left: 24px; }

.result-table-wrap { overflow-x: auto; }
.result-table {
  border-collapse: collapse; font-size: 12px; min-width: 100%;
  border: 1px solid var(--border);
}
.result-table th {
  background: rgba(0,200,255,0.12); color: var(--accent);
  padding: 6px 12px; font-family: var(--font-display); font-size: 9px; letter-spacing: 2px;
  border: 1px solid var(--border); text-align: left; white-space: nowrap;
}
.result-table td {
  padding: 5px 12px; border: 1px solid var(--border);
  color: var(--text-main); font-family: var(--font-mono); font-size: 11px; white-space: nowrap;
}
.result-table tr:nth-child(even) td { background: rgba(0,200,255,0.03); }
.result-table tr:hover td { background: rgba(0,200,255,0.07); }

.result-rowcount { font-size: 10px; color: var(--green); margin-top: 6px; font-family: var(--font-mono); }
.result-error {
  background: rgba(255,58,58,0.1); border: 1px solid var(--red);
  color: var(--red); font-family: var(--font-mono); font-size: 12px;
  padding: 8px 12px; border-radius: 4px;
}
.result-success-msg {
  background: rgba(0,255,136,0.08); border: 1px solid var(--green);
  color: var(--green); font-family: var(--font-mono); font-size: 12px;
  padding: 8px 12px; border-radius: 4px;
}

/* Terminal Input */
.terminal-input-wrap {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 12px 16px;
  background: rgba(0,200,255,0.04); border-top: 1px solid var(--border);
}
.prompt-label { font-family: var(--font-mono); font-size: 14px; color: var(--red); padding-top: 4px; flex-shrink: 0; }
.terminal-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--accent); font-family: var(--font-mono); font-size: 13px;
  resize: none; line-height: 1.5;
  caret-color: var(--accent);
}
.terminal-input::placeholder { color: var(--text-muted); }

.terminal-actions {
  display: flex; gap: 8px; padding: 8px 16px 12px;
  background: rgba(0,200,255,0.04);
  flex-wrap: wrap;
}
.btn-run {
  flex: 1; padding: 10px 20px;
  background: linear-gradient(135deg, #004a70, #007aaa);
  border: 1px solid var(--accent); color: var(--accent);
  font-family: var(--font-display); font-size: 11px; letter-spacing: 2px;
  border-radius: 5px; cursor: pointer; transition: all 0.2s;
}
.btn-run:hover { background: linear-gradient(135deg, #006090, #00a0d8); box-shadow: 0 0 18px rgba(0,200,255,0.3); }
.btn-run:active { transform: scale(0.98); }

.btn-clear, .btn-solution {
  padding: 10px 14px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); font-family: var(--font-mono); font-size: 11px;
  border-radius: 5px; cursor: pointer; transition: all 0.2s;
}
.btn-clear:hover { border-color: var(--red); color: var(--red); }
.btn-solution:hover { border-color: var(--gold); color: var(--gold); }

/* ---- RIGHT PANEL RESULT ---- */
.result-area {
  flex: 1; padding: 14px;
  border-bottom: 1px solid var(--border);
  overflow-y: auto;
  font-family: var(--font-mono); font-size: 12px;
  scrollbar-width: thin; scrollbar-color: var(--border-glow) transparent;
}
.result-placeholder { color: var(--text-muted); font-style: italic; font-size: 12px; }

.side-result-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.side-result-table th {
  background: rgba(0,200,255,0.1); color: var(--accent);
  padding: 4px 8px; border: 1px solid var(--border);
  font-family: var(--font-display); font-size: 8px; letter-spacing: 1px; text-align: left;
}
.side-result-table td {
  padding: 4px 8px; border: 1px solid var(--border);
  color: var(--text-main); font-family: var(--font-mono); font-size: 10px;
}
.side-result-table tr:nth-child(even) td { background: rgba(0,200,255,0.03); }

.side-rowcount { font-size: 10px; color: var(--green); margin-top: 6px; }

/* ---- NOTES ---- */
.notes-box { padding: 12px; border-bottom: 1px solid var(--border); }
.notes-header { font-size: 10px; color: var(--text-dim); letter-spacing: 3px; font-family: var(--font-display); margin-bottom: 8px; }
.notes-area {
  width: 100%; min-height: 100px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-main); font-family: var(--font-body); font-size: 12px;
  padding: 8px; resize: vertical; line-height: 1.6;
}
.notes-area:focus { outline: none; border-color: var(--accent-dim); }

/* ---- PROGRESS ---- */
.progress-box { padding: 12px; }
.progress-label { font-size: 10px; color: var(--text-dim); letter-spacing: 3px; font-family: var(--font-display); margin-bottom: 8px; }
.progress-bar-outer { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.progress-bar-inner {
  height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 4px; transition: width 0.5s ease;
  box-shadow: 0 0 8px var(--accent);
}
.progress-text { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }

/* ---- MODALS ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--accent);
  border-radius: 12px; padding: 36px;
  max-width: 500px; width: 100%;
  box-shadow: 0 0 60px rgba(0,200,255,0.2);
  text-align: center;
  animation: modal-in 0.3s ease;
}
@keyframes modal-in { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-icon { font-size: 56px; margin-bottom: 16px; }
.modal-title {
  font-family: var(--font-display); font-size: 22px; letter-spacing: 3px;
  color: var(--green); margin-bottom: 16px;
}
.modal-criminal {
  background: rgba(0,255,136,0.07); border: 1px solid var(--green);
  border-radius: 8px; padding: 16px; margin-bottom: 16px;
  font-family: var(--font-mono); font-size: 14px; color: var(--gold);
  line-height: 2;
}
.modal-text { font-size: 13px; color: var(--text-main); line-height: 1.7; margin-bottom: 20px; }
.btn-modal-close {
  padding: 10px 30px;
  background: linear-gradient(135deg, #004a70, #007aaa);
  border: 1px solid var(--accent); color: var(--accent);
  font-family: var(--font-display); font-size: 12px; letter-spacing: 2px;
  border-radius: 5px; cursor: pointer; transition: all 0.2s;
}
.btn-modal-close:hover { box-shadow: 0 0 18px rgba(0,200,255,0.3); }

.modal-hint { text-align: left; max-width: 560px; }
.modal-hint-title {
  font-family: var(--font-display); font-size: 14px; letter-spacing: 2px;
  color: var(--gold); margin-bottom: 16px;
}
.modal-hint-content { font-size: 13px; color: var(--text-main); line-height: 1.8; margin-bottom: 20px; }
.modal-hint-content code {
  font-family: var(--font-mono); font-size: 12px;
  background: rgba(0,200,255,0.12); color: var(--accent);
  padding: 1px 6px; border-radius: 3px;
}
.modal-hint-content strong { color: var(--gold); }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 3px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1100px) {
  .main-layout { grid-template-columns: 260px 1fr 240px; }
}
@media (max-width: 860px) {
  .main-layout { grid-template-columns: 1fr; height: auto; }
  .panel { border-right: none; border-bottom: 1px solid var(--border); height: auto; }
  .terminal-wrap { min-height: 320px; }
}

/* ---- SOLUTION BOX ---- */
.solution-box {
  background: rgba(245,197,24,0.06); border: 1px solid rgba(245,197,24,0.3);
  border-radius: 6px; padding: 12px; margin: 8px 0;
}
.solution-label { font-size: 10px; color: var(--gold); font-family: var(--font-display); letter-spacing: 2px; margin-bottom: 8px; }
.solution-code {
  font-family: var(--font-mono); font-size: 12px; color: var(--gold);
  white-space: pre-wrap; word-break: break-all; line-height: 1.6;
}

/* ---- MISSION CHECK PASS ---- */
.check-pass {
  background: rgba(0,255,136,0.07); border: 1px solid var(--green);
  border-radius: 4px; padding: 8px 12px;
  font-family: var(--font-mono); font-size: 12px; color: var(--green);
}
.check-fail {
  background: rgba(255,58,58,0.07); border: 1px solid var(--red);
  border-radius: 4px; padding: 8px 12px;
  font-family: var(--font-mono); font-size: 12px; color: var(--red);
}

/* ---- THEORY BOX inside mission display ---- */
.theory-box {
  margin-top: 12px; padding: 12px 14px;
  background: rgba(5,17,31,0.8); border: 1px solid var(--border);
  border-radius: 6px;
}
.theory-title { font-size: 10px; color: var(--accent-dim); letter-spacing: 2px; font-family: var(--font-display); margin-bottom: 8px; }
.theory-body { font-size: 12px; color: var(--text-main); line-height: 1.7; }
.theory-body code {
  font-family: var(--font-mono); font-size: 11px;
  background: rgba(0,200,255,0.1); color: var(--accent);
  padding: 1px 5px; border-radius: 3px;
}
.theory-body pre {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 4px; padding: 10px; margin-top: 8px;
  font-family: var(--font-mono); font-size: 11px; color: #80d0f0;
  overflow-x: auto; white-space: pre;
}
