/* ═══════════════════════════════════════════════════════════════
   SISTEM TEMPAHAN COURT — TVET MARA LUMUT
   Design: "Court Lines" — hijau padang, garisan putih, aksen clay
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg:         #F4F3EE;
  --surface:    #FFFFFF;
  --ink:        #112A22;
  --green-900:  #0E3B2E;
  --green-700:  #14624A;
  --green-600:  #167B5A;
  --green-soft: #E6F0EB;
  --clay:       #D85C36;
  --clay-soft:  #FBEADF;
  --muted:      #6E776F;
  --line:       #E3E6E1;
  --danger:     #C5462E;
  --radius:     16px;
  --radius-sm:  10px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'Inter', sans-serif;
  --shadow:     0 1px 3px rgba(17,42,34,.06), 0 8px 24px rgba(17,42,34,.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ───────── App shell (mobile-first, centered on desktop) ───────── */
.app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ───────── Screens ───────── */
.screen { display: none; flex-direction: column; flex: 1; }
.screen.active { display: flex; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .screen.active { animation: none; }
  * { transition: none !important; }
}

/* ───────── Top bar (in-app) ───────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: var(--green-900);
  color: #fff;
  position: sticky; top: 0; z-index: 20;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-brand .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--clay);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #fff;
}
.topbar-brand .name { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: .2px; }

.user-chip { display: none; align-items: center; gap: 10px; }
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--green-600); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
}
.user-chip .chip-name { font-size: 13px; font-weight: 500; }
.icon-btn {
  background: rgba(255,255,255,.12); border: none; color: #fff;
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  display: grid; place-items: center; transition: background .2s;
}
.icon-btn:hover { background: rgba(255,255,255,.22); }

/* ───────── Content area ───────── */
.content { padding: 20px; flex: 1; padding-bottom: 90px; }

/* ═══════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════════════ */
.login-hero {
  background: var(--green-900);
  color: #fff;
  padding: 48px 28px 64px;
  position: relative;
  overflow: hidden;
}
/* court-line motif (signature) */
.login-hero::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.10) 1.5px, transparent 1.5px),
    linear-gradient(90deg, rgba(255,255,255,.10) 1.5px, transparent 1.5px);
  background-size: 100% 100%, 100% 100%;
  background-position: 0 70%, 18% 0;
  pointer-events: none;
}
.login-hero .court-circle {
  position: absolute; right: -50px; bottom: -50px;
  width: 160px; height: 160px; border: 2px solid rgba(255,255,255,.12);
  border-radius: 50%;
}
.login-logo {
  width: 52px; height: 52px; border-radius: 13px;
  background: var(--clay);
  display: grid; place-items: center; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 22px;
  margin-bottom: 22px; position: relative; z-index: 2;
  user-select: none;
}
.login-hero h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: 26px; line-height: 1.15; position: relative; z-index: 2;
}
.login-hero p {
  font-size: 13.5px; color: rgba(255,255,255,.7);
  margin-top: 8px; position: relative; z-index: 2;
}

.login-body { padding: 24px 20px; margin-top: -32px; position: relative; z-index: 5; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: 17px; margin-bottom: 4px;
}
.card-sub { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

/* ───────── Forms ───────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--ink); margin-bottom: 7px;
}
.form-input {
  width: 100%; padding: 13px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 14.5px; color: var(--ink);
  background: #fff; transition: border-color .2s, box-shadow .2s;
}
.form-input:focus {
  outline: none; border-color: var(--green-600);
  box-shadow: 0 0 0 3px var(--green-soft);
}
.form-input::placeholder { color: #AEB4AF; }

.welcome-line {
  font-size: 14px; color: var(--muted); margin-bottom: 16px;
}
.welcome-line strong { color: var(--ink); font-weight: 600; }

/* ───────── Buttons ───────── */
.btn {
  width: 100%; padding: 14px; border: none; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-weight: 600; font-size: 14.5px;
  cursor: pointer; transition: transform .12s, background .2s, opacity .2s;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--green-600); color: #fff; }
.btn-primary:hover { background: var(--green-700); }
.btn-secondary { background: var(--green-soft); color: var(--green-700); }
.btn-secondary:hover { background: #DBE9E1; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); }

.btn-link {
  background: none; border: none; color: var(--green-700);
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  cursor: pointer; padding: 4px; text-decoration: underline;
}
.btn-wa {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px; border-radius: var(--radius-sm);
  background: #25D366; color: #fff; border: none; font-weight: 600;
  font-size: 14px; cursor: pointer; margin-top: 8px;
}
.btn-wa:hover { background: #1EBE5A; }

.btn-row { display: flex; gap: 10px; }
.btn-row .btn { margin-top: 0; }

.btn-danger-sm {
  background: var(--clay-soft); color: var(--danger);
  border: none; border-radius: 8px; padding: 7px 13px;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.btn-danger-sm:hover { background: #F7DDD2; }
.btn-outline-sm {
  background: #fff; color: var(--green-700); border: 1.5px solid var(--line);
  border-radius: 8px; padding: 7px 13px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.btn-outline-sm:hover { border-color: var(--green-600); }

/* ───────── Alerts ───────── */
.alert {
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 14px; font-weight: 500;
}
.alert-danger  { background: var(--clay-soft); color: var(--danger); }
.alert-warning { background: #FDF3E3; color: #9A6A12; }
.alert-info    { background: var(--green-soft); color: var(--green-700); }
.alert-success { background: #E4F3EA; color: #1B7A4B; }

/* ═══════════════════════════════════════════════════════════════
   STEP BAR — court-line markers
   ═══════════════════════════════════════════════════════════════ */
.step-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 0; margin-bottom: 24px;
}
.step-node { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.step-circle {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 14px;
  background: #fff; border: 2px solid var(--line); color: var(--muted);
  transition: all .25s;
}
.step-circle.active { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.step-circle.done   { background: var(--clay); border-color: var(--clay); color: #fff; }
.step-label { font-size: 11px; font-weight: 600; color: var(--muted); }
.step-label.active { color: var(--green-700); }
.step-label.done   { color: var(--clay); }
.step-line {
  width: 44px; height: 2px; background: var(--line);
  margin: 0 4px; margin-bottom: 18px; transition: background .25s;
}
.step-line.done { background: var(--clay); }

/* ───────── Section labels ───────── */
.section-label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
  margin: 4px 0 12px;
}

/* ───────── Court / Sport cards ───────── */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.court-card {
  background: #fff; border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 18px 16px;
  cursor: pointer; text-align: left; transition: all .2s;
  position: relative; overflow: hidden;
}
.court-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: transparent; transition: background .2s;
}
.court-card:hover { border-color: var(--green-600); }
.court-card.selected { border-color: var(--clay); background: var(--clay-soft); }
.court-card.selected::before { background: var(--clay); }
.court-name {
  font-family: var(--font-display); font-weight: 600; font-size: 15.5px;
  margin-bottom: 5px;
}
.court-badge { font-size: 11.5px; color: var(--muted); line-height: 1.4; }

/* ───────── Slot buttons ───────── */
.slot-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 18px; }
.slot-btn {
  display: flex; flex-direction: column; align-items: flex-start;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; cursor: pointer; transition: all .2s;
  font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--ink);
}
.slot-btn:hover:not(:disabled) { border-color: var(--green-600); }
.slot-btn.selected { border-color: var(--clay); background: var(--clay-soft); }
.slot-btn.booked, .slot-btn:disabled {
  background: #F2F1EC; color: #B4B9B3; cursor: not-allowed;
  text-decoration: line-through; border-color: var(--line);
}
.slot-tag {
  font-family: var(--font-body); font-weight: 500; font-size: 11.5px;
  color: var(--muted); margin-top: 4px; text-decoration: none;
}
.slot-btn.booked .slot-tag::after { content: ' — penuh'; }

/* ───────── Summary ───────── */
.summary-head {
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
  padding: 14px 16px; background: var(--green-900); color: #fff;
  border-radius: var(--radius-sm); margin-bottom: 14px;
}
.summary-table { width: 100%; border-collapse: collapse; }
.summary-table td { padding: 11px 4px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.summary-table td:first-child { color: var(--muted); width: 38%; }
.summary-table td:last-child { font-weight: 500; }
.summary-table tr:last-child td { border-bottom: none; }

/* ───────── Booking items (history) ───────── */
.booking-item {
  display: flex; justify-content: space-between; align-items: flex-start;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 15px 16px; margin-bottom: 10px;
}
.booking-court-label { font-family: var(--font-display); font-weight: 600; font-size: 14.5px; }
.booking-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.badge { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.badge-active    { background: #E4F3EA; color: #1B7A4B; }
.badge-cancelled { background: #F2F1EC; color: var(--muted); }

/* ───────── Tables (admin) ───────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  text-align: left; padding: 10px 8px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid var(--line); font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
}
.data-table td { padding: 11px 8px; border-bottom: 1px solid var(--line); }

/* ───────── Stats ───────── */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 14px; text-align: center;
}
.stat-num { font-family: var(--font-display); font-weight: 700; font-size: 26px; color: var(--green-700); }
.stat-lbl { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ───────── Jadual matrix ───────── */
.sched-legend {
  display: flex; gap: 18px; margin-bottom: 14px; font-size: 12px; color: var(--muted);
}
.sched-legend span { display: flex; align-items: center; gap: 6px; }
.sched-legend .lg { width: 13px; height: 13px; border-radius: 4px; display: inline-block; }
.sched-legend .lg.free  { background: var(--green-soft); border: 1.5px solid var(--green-600); }
.sched-legend .lg.taken { background: var(--clay-soft); border: 1.5px solid var(--clay); }

.sched-table { display: flex; flex-direction: column; gap: 6px; }
.sched-row {
  display: grid;
  grid-template-columns: 84px 1fr 1fr 1fr;
  gap: 6px;
}
.sched-head .sched-cell-head {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-align: center; padding: 4px 2px; line-height: 1.2;
}
.sched-head .sched-cell-head span { display: block; font-weight: 400; font-size: 9.5px; margin-top: 2px; }
.sched-court {
  display: flex; flex-direction: column; justify-content: center;
}
.sched-court strong { font-family: var(--font-display); font-size: 13px; }
.sched-court span { font-size: 9px; color: var(--muted); line-height: 1.25; margin-top: 2px; }

.sched-cell {
  border-radius: 8px; min-height: 50px;
  display: grid; place-items: center; text-align: center;
  font-size: 11px; font-weight: 600; padding: 4px; line-height: 1.2;
}
.sched-cell.free {
  background: var(--green-soft); color: var(--green-700);
  border: 1.5px solid transparent; cursor: pointer; transition: all .15s;
}
.sched-cell.free:hover { border-color: var(--green-600); background: #DCEAE2; }
.sched-cell.taken {
  background: var(--clay-soft); color: var(--clay);
  border: 1.5px solid transparent;
}

/* ───────── Language toggle ───────── */
.lang-toggle {
  display: inline-flex; background: rgba(255,255,255,.14);
  border-radius: 9px; padding: 3px;
}
.lang-opt {
  border: none; background: transparent; color: rgba(255,255,255,.7);
  font-family: var(--font-display); font-weight: 600; font-size: 11.5px;
  padding: 5px 11px; border-radius: 7px; cursor: pointer; transition: all .18s;
}
.lang-opt.active { background: #fff; color: var(--green-900); }
.lang-toggle.hero-lang { position: absolute; top: 20px; right: 20px; z-index: 5; }

/* ───────── Empty state ───────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state p { font-size: 13.5px; }

/* ───────── Bottom nav ───────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 460px;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; padding: 8px 0; z-index: 30;
}
.nav-item {
  flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px; color: var(--muted); font-family: var(--font-body);
  font-size: 11px; font-weight: 500; transition: color .2s;
}
.nav-item svg { width: 21px; height: 21px; stroke-width: 1.8; }
.nav-item.active { color: var(--green-700); }
.nav-item.danger { color: var(--muted); }
.nav-item.danger:hover { color: var(--danger); }

/* ───────── Date input full width ───────── */
input[type="date"].form-input { -webkit-appearance: none; }

/* ───────── Desktop niceties ───────── */
@media (min-width: 480px) {
  .app { box-shadow: 0 0 60px rgba(17,42,34,.08); }
}