/* =====================================================================
 *  styles.css — Smart Elevator Nudge UX  (다크 관제 콘솔 테마)
 * ===================================================================== */
:root {
  --bg: #0d1420;
  --panel: #131c2b;
  --panel-2: #182335;
  --line: rgba(120, 160, 200, 0.12);
  --text: #dfeaf6;
  --muted: #8ba3bd;
  --accent: #5aa8ff;
  --elev: #5aa8ff;
  --stair: #2ecc96;
  --warn: #f5a623;
  --danger: #ff6b6b;
  --radius: 12px;
  font-size: 15px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #1a2740 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

/* ---------------- 상단바 ---------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: rgba(13, 20, 32, 0.85); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 10; flex-wrap: wrap; gap: 10px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  font-size: 26px; width: 46px; height: 46px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--elev), var(--stair));
  border-radius: 12px; color: #08121f; font-weight: 900;
}
.brand h1 { font-size: 18px; letter-spacing: -0.3px; }
.brand p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topnav { display: flex; gap: 4px; margin-left: auto; margin-right: 14px; }
.topnav a {
  font-size: 13px; color: var(--muted); text-decoration: none;
  padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
}
.topnav a:hover { color: var(--text); background: var(--panel-2); }
.topnav a.active {
  color: var(--text); background: var(--panel-2);
  border-color: var(--line); font-weight: 600;
}
.top-status { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 12px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 6px 11px; border-radius: 999px;
}
.chip b { color: var(--text); margin-left: 3px; }

/* ---------------- 레이아웃 ---------------- */
.layout {
  display: grid; grid-template-columns: 360px 1fr 340px;
  gap: 16px; padding: 16px; align-items: start;
}
.col { display: flex; flex-direction: column; gap: 16px; }
.col-center { position: sticky; top: 78px; }

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px;
}
.panel h2 { font-size: 14px; margin-bottom: 12px; letter-spacing: -0.2px; }

/* ---------------- 폼 ---------------- */
label { display: block; font-size: 12px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
select, input[type="range"] { width: 100%; }
select {
  margin-top: 5px; padding: 9px 10px; border-radius: 8px;
  background: #0e1826; color: var(--text);
  border: 1px solid var(--line); font-size: 14px;
}
.ctl { margin-bottom: 14px; }
.ctl-row { display: flex; gap: 8px; }

.subhead {
  display: flex; justify-content: space-between; align-items: center;
  margin: 16px 0 4px; font-size: 12px; color: var(--text); font-weight: 600;
}
.hint { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.link-btn {
  background: none; border: none; color: var(--accent);
  font-size: 12px; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ---------------- 정차 그리드 ---------------- */
.stop-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px;
  max-height: 168px; overflow-y: auto; padding: 2px;
}
.stop-cell {
  padding: 7px 0; font-size: 11px; border-radius: 6px; cursor: pointer;
  background: #0e1826; color: var(--muted);
  border: 1px solid var(--line); transition: all .12s;
}
.stop-cell:hover { border-color: var(--accent); color: var(--text); }
.stop-cell.on {
  background: rgba(90, 168, 255, 0.22); color: #fff;
  border-color: var(--accent); font-weight: 600;
}

/* ---------------- 액션 버튼 ---------------- */
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.btn {
  padding: 12px; border: none; border-radius: 9px; cursor: pointer;
  font-size: 14px; font-weight: 700; color: #08121f; transition: transform .1s, filter .1s;
}
.btn:active { transform: translateY(1px); }
.btn-elev { background: linear-gradient(135deg, #ffb43d, var(--warn)); }
.btn-stair { background: linear-gradient(135deg, #34e0a6, var(--stair)); }
.btn-ghost {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); flex: 1;
}
.btn.flash { animation: flash .4s; }
@keyframes flash { 0% { filter: brightness(1.8); } 100% { filter: brightness(1); } }

/* ---------------- 넛지 카드 ---------------- */
.nudge-card {
  display: flex; gap: 12px; padding: 14px; border-radius: 10px;
  border: 1px solid var(--line); margin-bottom: 14px; align-items: flex-start;
}
.nudge-icon { font-size: 22px; }
.nudge-head { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.nudge-msg { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.level-neutral { background: rgba(139, 163, 189, 0.08); }
.level-stair, .level-stair-strong {
  background: rgba(46, 204, 150, 0.12); border-color: rgba(46, 204, 150, 0.4);
}
.level-stair-strong { box-shadow: 0 0 0 1px rgba(46, 204, 150, 0.35) inset; }
.level-stair-strong .nudge-head { color: var(--stair); }
.level-elevator {
  background: rgba(245, 166, 35, 0.10); border-color: rgba(245, 166, 35, 0.35);
}
.level-elevator .nudge-head { color: var(--warn); }

/* ---------------- 비교 카드 ---------------- */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cmp-card {
  background: #0e1826; border: 1px solid var(--line);
  border-radius: 9px; padding: 12px; transition: all .15s;
}
.cmp-title { font-size: 11px; color: var(--muted); }
.cmp-time { font-size: 26px; font-weight: 800; margin: 4px 0; }
.cmp-meta { font-size: 10.5px; color: var(--muted); line-height: 1.4; }
#cardElevator .cmp-time { color: var(--elev); }
#cardStair .cmp-time { color: var(--stair); }
.cmp-card.win { box-shadow: 0 0 0 2px currentColor inset; }
#cardElevator.win { color: var(--elev); border-color: var(--elev); }
#cardStair.win { color: var(--stair); border-color: var(--stair); }

.delta-badge {
  margin-top: 10px; text-align: center; font-size: 13px; font-weight: 700;
  padding: 8px; border-radius: 8px;
}
.delta-badge.stair { background: rgba(46, 204, 150, 0.14); color: var(--stair); }
.delta-badge.elevator { background: rgba(245, 166, 35, 0.14); color: var(--warn); }
.energy-line { margin-top: 10px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.energy-line b { color: var(--stair); }

/* ---------------- 통계 ---------------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stat b { display: block; font-size: 20px; color: var(--stair); }
.stat span { font-size: 10.5px; color: var(--muted); }

/* ---------------- 승강로 ---------------- */
.panel-shaft { height: calc(100vh - 110px); display: flex; flex-direction: column; }
.shaft-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tag { font-size: 11px; color: var(--muted); background: var(--panel-2);
  padding: 4px 9px; border-radius: 6px; border: 1px solid var(--line); }
#shaft { flex: 1; width: 100%; background: #0a1220; border-radius: 8px; }
.legend {
  display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px;
  font-size: 11px; color: var(--muted);
}
.legend i.dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.dot.up { background: var(--warn); }
.dot.down { background: var(--elev); }
.dot.car { background: #5a96dc; }
.dot.open { background: var(--stair); }
.dot.stop { background: var(--warn); border-radius: 1px; }

/* ---------------- 로그 ---------------- */
.panel-log { display: flex; flex-direction: column; }
.log-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.log {
  height: 300px; overflow-y: auto; background: #08101c;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px;
  font-family: "Consolas", "D2Coding", monospace; font-size: 11px; line-height: 1.7;
}
.log-line { white-space: nowrap; }
.log-t { color: #5f7898; }
.log-tag {
  display: inline-block; min-width: 48px; text-align: center;
  padding: 0 5px; border-radius: 3px; margin: 0 5px; font-size: 10px;
  background: #1b2942; color: #9fc0e6;
}
.log-hall .log-tag { background: rgba(245,166,35,0.2); color: var(--warn); }
.log-car .log-tag { background: rgba(90,168,255,0.2); color: var(--elev); }
.log-stop .log-tag { background: rgba(120,160,200,0.2); color: #b8cfe6; }
.log-nudge .log-tag, .log-decision .log-tag { background: rgba(46,204,150,0.2); color: var(--stair); }
.log-nudge, .log-decision { color: #cfeee0; }
.log-scan .log-tag { background: rgba(160,120,255,0.2); color: #b39dff; }

.note { font-size: 11px; color: var(--muted); line-height: 1.6; }

/* ---------------- 반응형 ---------------- */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 1fr; }
  .col-center { position: static; }
  .panel-shaft { height: 70vh; }
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #26374f; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
