/* ============================================================
   ĐẶT GIỜ HỌC LÁI XE — hệ thống thiết kế
   Thế giới: đường phố ban đêm · xanh navy + vàng vạch kẻ đường
   ============================================================ */
:root {
  --navy-950: #081527;
  --navy-900: #0b1f3a;
  --navy-800: #0f3465;
  --navy-700: #12407a;
  --navy-600: #1a4f8f;
  --amber-500: #f0a500;
  --amber-100: #fff3d6;
  --bg: #eef2f7;
  --surface: #ffffff;
  --ink: #16233a;
  --ink-soft: #4c5a70;
  --ink-faint: #8391a8;
  --line: #dbe3ee;
  --line-soft: #e8edf5;
  --green-700: #1f6d2c;
  --green-100: #d9f0d8;
  --red-700: #8f1d18;
  --red-100: #f8d9d6;
  --radius: 14px;
  --shadow-card: 0 1px 2px rgba(11, 31, 58, .06), 0 10px 28px -14px rgba(11, 31, 58, .22);
  --shadow-pop: 0 24px 60px -24px rgba(4, 12, 26, .55);
  --focus: 0 0 0 3px rgba(240, 165, 0, .35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Be Vietnam Pro", system-ui, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

/* ---- Bề mặt trình duyệt theo thiết kế ---- */
::selection { background: var(--amber-500); color: var(--navy-900); }
::placeholder { color: var(--ink-faint); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #b9c5d6; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #93a3ba; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }

/* ---- Header ---- */
header {
  background: var(--navy-800);
  color: #fff;
  padding: 12px 18px;
  border-bottom: 2px solid var(--amber-500);
  position: sticky;
  top: 0;
  z-index: 40;
}
.bar { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.logo { font-weight: 800; font-size: 17px; letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 9px; }
.logo svg { color: var(--amber-500); flex: none; }
.who { margin-left: auto; font-size: 13.5px; opacity: .92; background: rgba(255,255,255,.09); padding: 6px 12px; border-radius: 999px; }

/* ---- Avatar + menu tài khoản ---- */
.user-menu { margin-left: auto; position: relative; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--amber-500); color: var(--navy-900);
  font-weight: 800; font-size: 17px; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 2px solid rgba(255,255,255,.55);
  transition: transform .12s, box-shadow .15s;
}
.avatar:hover { transform: scale(1.06); box-shadow: 0 0 0 4px rgba(240,165,0,.25); }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 10px);
  background: var(--surface); color: var(--ink);
  border-radius: 12px; min-width: 210px; padding: 6px;
  box-shadow: var(--shadow-pop); z-index: 60;
  animation: menu-in .16s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.ud-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; display: flex; flex-direction: column; }
.ud-head b { font-size: 14.5px; }
.ud-head span { font-size: 12px; color: var(--ink-soft); }
.user-dropdown a {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-size: 14px;
}
.user-dropdown a:hover { background: #f0f4f9; }
.user-dropdown a svg { color: var(--navy-700); flex: none; }
.user-dropdown a.ud-logout { color: var(--red-700); }
.user-dropdown a.ud-logout svg { color: var(--red-700); }

main { max-width: 1080px; margin: 26px auto 48px; padding: 0 16px; }

h1 { font-size: 23px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; }
h2 { font-size: 15.5px; font-weight: 700; margin: 10px 0; }
.muted { color: var(--ink-soft); font-size: 13.5px; margin-bottom: 12px; }

/* ---- Thẻ ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-card);
}
.center-card { max-width: 400px; margin: 60px auto; }
.center-card h1 { font-size: 20px; margin-bottom: 4px; }

label { display: block; font-size: 12.5px; color: var(--ink-soft); margin: 10px 0 4px; font-weight: 600; letter-spacing: .01em; }
input, select {
  width: 100%; padding: 10px 12px;
  border: 1px solid #c9d3e2; border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fbfcfe; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover { border-color: #a8b8cf; }
input:focus, select:focus { outline: none; border-color: var(--navy-600); box-shadow: 0 0 0 3px rgba(26, 79, 143, .18); }

/* ---- Nút ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; padding: 9px 15px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; text-decoration: none; color: var(--ink);
  background: #e4e9f1;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--navy-700); color: #fff; box-shadow: 0 6px 16px -8px rgba(18, 64, 122, .55); }
.btn.primary:hover { background: var(--navy-600); }
.btn.danger { background: #b3261e; color: #fff; }
.btn.ghost { background: transparent; border: 1px solid rgba(203, 213, 227, .8); color: inherit; }
header .btn.ghost { color: #fff; border-color: rgba(255,255,255,.35); }
header .btn.ghost:hover { background: rgba(255,255,255,.12); }
.btn.big { width: 100%; margin-top: 16px; padding: 12px; font-size: 16px; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.light { background: #fff; color: var(--navy-700); font-weight: 700; }

.alert {
  background: var(--red-100); color: var(--red-700);
  border: 1px solid #efb9b4; padding: 10px 12px; border-radius: 10px;
  margin: 10px 0; font-size: 14px;
}
.okmsg { background: var(--green-100); color: var(--green-700); border: 1px solid #b3dcb3; padding: 10px 12px; border-radius: 10px; margin: 10px 0; font-size: 14px; }

/* ---- Bảng ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; background: #f0f4f9; color: var(--ink-soft); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
tbody tr:last-child td, tr:last-child th { border-bottom: 0; }
td { font-variant-numeric: tabular-nums; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #f6f9fd; }

.badge { font-size: 13px; white-space: nowrap; font-weight: 600; }
.badge.free { color: var(--green-700); }
.badge.booked { color: var(--red-700); }
.badge.muted-b { color: #8a6d1a; }

/* ---- Form hàng ngang ---- */
.row-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row-form > div { min-width: 120px; }
.row-form .grow { flex: 1; min-width: 160px; }

/* ---- Thống kê ---- */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.stat {
  background: var(--surface); border-radius: var(--radius); padding: 14px 22px;
  border: 1px solid var(--line-soft); box-shadow: var(--shadow-card);
  text-align: center; flex: 1; min-width: 130px;
}
.stat b { display: block; font-size: 27px; font-weight: 800; color: var(--navy-700); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat span { font-size: 12.5px; color: var(--ink-soft); }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-form { display: inline-flex; gap: 4px; align-items: center; }
.sm-input { width: 110px; padding: 5px 8px; font-size: 13px; }
form { margin: 0; }
.hidden { display: none; }
a.phone { color: var(--navy-700); font-weight: 600; text-decoration: none; }
a.phone:hover { text-decoration: underline; text-underline-offset: 3px; }
.card.settings { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; padding: 12px 16px; }
.teacher-pick { max-width: 340px; }

/* ---- Tab ---- */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  padding: 8px 15px; border-radius: 10px; background: #e4e9f1;
  color: var(--ink); text-decoration: none; font-size: 13.5px; font-weight: 600;
  transition: background .15s, color .15s;
}
.tab:hover { background: #d6deea; }
.tab.active { background: var(--navy-700); color: #fff; }

.week-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.week-nav b { font-size: 14.5px; font-variant-numeric: tabular-nums; }

/* ---- Lưới lịch tuần ---- */
.grid { border-collapse: separate; border-spacing: 2px; width: 100%; }
.grid th { border: 0; padding: 7px 4px; font-size: 12px; text-align: center; background: transparent; color: var(--ink-soft); }
.grid th.today { background: var(--navy-700); color: #fff; border-radius: 8px; }
.grid .hour-col { width: 56px; min-width: 46px; font-weight: 600; font-variant-numeric: tabular-nums; }
.grid td.cell {
  height: 36px; min-width: 52px; border-radius: 8px;
  text-align: center; cursor: pointer; font-size: 13px;
  user-select: none; -webkit-user-select: none; touch-action: none;
  background: #fbfcfe; box-shadow: inset 0 0 0 1px var(--line);
  transition: background .12s, box-shadow .12s;
}
.grid td.cell-empty:hover { background: #eef4ff; box-shadow: inset 0 0 0 1px #b9cdf0; }
.grid td.cell-free { background: var(--green-100); box-shadow: inset 0 0 0 1px #b2d8b0; }
.grid td.cell-free:hover { background: #c3e8c1; box-shadow: inset 0 0 0 1px #8ec78c; }
.grid td.cell-booked { background: var(--red-100); box-shadow: inset 0 0 0 1px #e9b7b2; cursor: default; }
.grid td.cell-mine { background: #a7c9f5; box-shadow: inset 0 0 0 1px #7fadec; cursor: default; }
.grid td.cell-picking { background: #6d9ff0 !important; outline: 2px solid var(--navy-700); outline-offset: -2px; }
.grid td.cell-new { box-shadow: inset 0 0 0 2px var(--amber-500) !important; animation: newpulse 1s ease-in-out 3; }
@keyframes newpulse { 50% { background: #ffe9b3 !important; } }
.mode-bar { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.mode-opt { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.mode-opt input { width: auto; margin: 0; }
.mode-opt:has(input:checked) { color: var(--navy-700); }
.grid td.cell-del-picking { background: #f6b0ab !important; outline: 2px solid #b3261e; outline-offset: -2px; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); margin-top: 12px; }
.legend .chip { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 5px; vertical-align: -2px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.chip-empty { background: #fbfcfe; }
.chip-free { background: var(--green-100); }
.chip-booked { background: var(--red-100); }
.chip-mine { background: #a7c9f5; }

/* ---- Chip giáo viên trong lịch tổng hợp ---- */
.cell-multi { vertical-align: top; padding: 3px; height: auto !important; min-width: 52px; }
.tchip {
  display: block; width: 100%; margin: 2px 0; padding: 4px 7px;
  border: 0; border-radius: 7px; font-size: 12px; font-weight: 600;
  cursor: pointer; text-align: left; font-family: inherit;
  user-select: none; -webkit-user-select: none; touch-action: none;
  transition: filter .12s;
}
.tchip-free { background: var(--green-100); color: var(--green-700); }
.tchip-free:hover { filter: brightness(.94); }
.tchip-taken { background: var(--red-100); color: var(--red-700); cursor: default; }
.tchip-mine { background: #a7c9f5; color: #10243f; cursor: default; }
.tchip-picking { outline: 2px solid var(--navy-700); outline-offset: -2px; background: #6d9ff0 !important; color: #fff; }

/* ---- Thanh chọn nổi ---- */
.sel-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--navy-900); color: #fff;
  padding: 13px 18px; display: flex; gap: 12px; align-items: center;
  z-index: 50; box-shadow: 0 -8px 30px rgba(4, 12, 26, .35);
  font-size: 15px; animation: selbar-in .25s ease-out;
}
@keyframes selbar-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sel-bar.hidden { display: none; }
.sel-bar .btn.ghost { border-color: rgba(255,255,255,.4); color: #fff; }

/* ---- Menu điều hướng ---- */
.nav-cards { display: flex; gap: 10px; flex-wrap: wrap; }
.nav-cards .btn { box-shadow: var(--shadow-card); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.page-link { color: var(--navy-700); font-size: 13.5px; text-decoration: none; }
.page-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ============ TRANG ĐĂNG NHẬP — đường phố ban đêm ============ */
.auth-body { background: var(--navy-950); }
.auth-scene {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1100px 620px at 50% -8%, #17335c 0%, var(--navy-950) 62%);
  overflow: hidden;
}
.auth-card {
  position: relative; z-index: 3;
  width: min(400px, calc(100vw - 40px));
  background: var(--surface); border-radius: 18px;
  padding: 30px 30px 26px;
  box-shadow: var(--shadow-pop);
  animation: card-in .5s cubic-bezier(.2, .8, .3, 1);
}
@keyframes card-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.auth-brand { display: flex; justify-content: center; margin-bottom: 10px; }
.auth-card h1 { text-align: center; font-size: 21px; }
.auth-sub { text-align: center; color: var(--ink-soft); font-size: 13.5px; margin: 4px 0 8px; }

.auth-road { position: absolute; left: 0; right: 0; bottom: 0; height: 34vh; min-height: 230px; z-index: 1; }
.auth-footer {
  position: absolute; left: 0; right: 0; bottom: 8px; z-index: 2;
  text-align: center; font-size: 12.5px; color: rgba(255,255,255,.5); letter-spacing: .02em;
}
.auth-footer b { color: rgba(255,255,255,.75); font-weight: 600; }
.road-sky { position: absolute; inset: 0; background: transparent; }
.road-surface {
  position: absolute; left: 0; right: 0; bottom: 0; height: 42%;
  background: linear-gradient(180deg, #232c3d 0%, #161e2c 100%);
  border-top: 2px solid #3c4a63;
}
.lane-line {
  position: absolute; left: 0; right: 0; top: 46%; height: 6px;
  background: repeating-linear-gradient(90deg, var(--amber-500) 0 46px, transparent 46px 96px);
  opacity: .85;
  animation: lane-run 1.6s linear infinite;
}
@keyframes lane-run { from { background-position: 96px 0; } to { background-position: 0 0; } }
.auth-car { position: absolute; bottom: calc(42% - 14px); left: 0; animation: car-run 13s linear infinite; filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
@keyframes car-run {
  from { transform: translateX(-140px); }
  to { transform: translateX(calc(100vw + 40px)); }
}


@media (prefers-reduced-motion: reduce) {
  .lane-line, .auth-car, .wheel { animation: none; }
  .auth-card { animation: none; }
  .sel-bar { animation: none; }
  .btn, tbody tr, input, select { transition: none; }
}

@media (max-width: 640px) {
  main { margin-top: 18px; }
  .row-form { flex-direction: column; align-items: stretch; }
  table { font-size: 13px; }
  th, td { padding: 8px 6px; }
  .grid td.cell { height: 30px; min-width: 42px; }
  .grid .hour-col { width: 40px; min-width: 34px; }

  .auth-road { height: 26vh; min-height: 170px; }
}
