/* Panthers Booking — gaya asas
   Warna jenama: merah & hitam.
   Reka bentuk bermula dari saiz telefon, kemudian dibesarkan untuk komputer. */

:root {
  --color-bg: #0b0b0d;          /* latar hitam */
  --color-surface: #16161a;     /* latar kad/bahagian */
  --color-border: #2a2a30;
  --color-text: #f5f5f5;
  --color-text-muted: #a1a1aa;
  --color-red: #e10600;         /* merah jenama: latar butang (teks putih di atasnya) */
  --color-red-hover: #b80500;   /* lebih gelap supaya teks putih kekal mudah dibaca */
  --color-red-text: #ff3b30;    /* merah lebih terang untuk TEKS di atas latar hitam */
  --color-success: #22c55e;     /* hijau: pembayaran disahkan */
  --color-warning: #f59e0b;     /* kuning: belum disahkan / sedang disemak */
  --max-width: 1100px;
  --radius: 8px;
  /* Kawalan borang browser (ikon kalendar, senarai pilihan) dalam tema gelap — supaya kelihatan */
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Atribut "hidden" mesti sentiasa menyembunyikan elemen, walaupun kelasnya menetapkan display
   (contoh: senarai bergaya grid). Tanpa ini, kandungan lama boleh kelihatan (ditemui oleh ujian, K-028). */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6;
}

main {
  flex: 1;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

/* Kepala halaman */
.site-header {
  border-bottom: 1px solid var(--color-border);
}

.site-header .container {
  display: flex;
  align-items: center;
  min-height: 64px;
}

.logo {
  color: var(--color-text);
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
  text-transform: uppercase;
}

.logo span {
  color: var(--color-red-text);
}

/* Bahagian utama (hero) */
.hero {
  padding: 64px 0 72px;
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-bg) 60%);
  border-bottom: 4px solid var(--color-red);
}

.hero-eyebrow {
  margin: 0 0 8px;
  color: var(--color-red-text);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 8vw, 3.5rem);
  line-height: 1.1;
}

.hero-text {
  max-width: 40ch;
  margin: 0 0 32px;
  color: var(--color-text-muted);
  font-size: 1.125rem;
}

/* Butang (digunakan untuk <a> dan <button>) */
.button {
  font: inherit;
  border: 0;
  cursor: pointer;
  display: inline-block;
  min-height: 48px; /* saiz mudah ditekan dengan jari */
  padding: 12px 28px;
  border-radius: var(--radius);
  background: var(--color-red);
  color: #ffffff;
  font-weight: 700;
  text-align: center; /* teks panjang yang terbelah pada skrin kecil kekal di tengah */
  text-decoration: none;
}

.button:hover {
  background: var(--color-red-hover);
}

.button:disabled {
  background: var(--color-border);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.button:focus-visible,
.logo:focus-visible {
  outline: 3px solid var(--color-text);
  outline-offset: 3px;
}

/* Kepala halaman dalaman */
.page-header {
  padding: 40px 0 24px;
  border-bottom: 1px solid var(--color-border);
}

.page-header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  line-height: 1.15;
}

.page-header p {
  margin: 0;
  color: var(--color-text-muted);
}

.page-section {
  padding: 24px 0 48px;
}

/* Mesej keadaan: memuatkan / tiada data / ralat */
.status {
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text-muted);
}

.status-error {
  border-color: var(--color-red);
  color: var(--color-text);
}

.status-message {
  margin: 0;
}

.status .button {
  margin-top: 12px;
}

/* Senarai kelas */
.class-list {
  display: grid;
  gap: 24px;
}

.class-card {
  padding: 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.class-card h2 {
  margin: 0 0 4px;
  font-size: 1.375rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.class-meta {
  margin: 0 0 12px;
  color: var(--color-red-text);
  font-weight: 700;
}

.class-description {
  margin: 0 0 16px;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

.no-sessions {
  margin: 0;
  color: var(--color-text-muted);
}

.session-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.session {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

.session-date {
  margin: 0;
  font-weight: 700;
}

.session-time {
  margin: 0;
  color: var(--color-text-muted);
}

.session-seats {
  margin: 4px 0 0;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.session-seats-full {
  color: var(--color-red-text);
  font-weight: 700;
}

/* Halaman tempahan */
.container.narrow {
  max-width: 640px;
}

.text-link {
  color: var(--color-text);
}

.text-link:focus-visible {
  outline: 3px solid var(--color-text);
  outline-offset: 3px;
}

.summary-card,
.form-card {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.summary-card h2,
.form-card h2 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.form-card h2:focus {
  outline: none;
}

.summary-line {
  margin: 0;
}

.summary-price {
  margin: 8px 0 0;
  color: var(--color-red-text);
  font-weight: 700;
}

.form-intro {
  margin: 0 0 16px;
  color: var(--color-text-muted);
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.field-hint {
  margin: 0 0 6px;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

/* Medan yang tidak boleh diubah (contoh: kelas / tarikh / masa sesi sedia ada) */
.field input:disabled,
.field select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  border-color: var(--color-text);
  outline: 3px solid var(--color-text);
  outline-offset: 1px;
}

.field [aria-invalid="true"] {
  border-color: var(--color-red-text);
}

.field-error,
.form-error {
  margin: 6px 0 0;
  color: var(--color-red-text);
  font-size: 0.875rem;
  font-weight: 700;
}

.form-error {
  margin: 0 0 16px;
  font-size: 1rem;
}

.review-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px 16px;
  margin: 0 0 16px;
}

.review-list dt {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.review-list dd {
  margin: 0 0 10px;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button-secondary {
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text);
}

.button-secondary:hover {
  background: var(--color-bg);
}

.notice {
  padding: 12px;
  border-left: 4px solid var(--color-red);
  background: var(--color-bg);
}

.status .actions {
  margin-top: 12px;
}

.status .actions .button {
  margin-top: 0;
}

/* Halaman thank-you: warna sisi kad membezakan keadaan (teks tetap menerangkan status) */
.summary-card h2:focus {
  outline: none;
}

.result-message {
  margin: 0 0 16px;
}

.summary-card[data-status] {
  border-left-width: 6px;
}

.summary-card[data-status="paid"] {
  border-left-color: var(--color-success);
}

.summary-card[data-status="pending_payment"],
.summary-card[data-status="needs_review"] {
  border-left-color: var(--color-warning);
}

.summary-card[data-status="payment_failed"],
.summary-card[data-status="expired"],
.summary-card[data-status="cancelled"] {
  border-left-color: var(--color-red);
}

/* Dashboard admin: kad ringkasan */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 12px;
}

.stat {
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

.stat dt {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.stat dd {
  margin: 4px 0 0;
  font-size: 1.5rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.stat-wide {
  grid-column: 1 / -1;
}

.stat-revenue dd {
  color: var(--color-success);
}

.stat-warning {
  border-color: var(--color-warning);
}

.stat-warning dd {
  color: var(--color-warning);
}

/* Halaman admin: menu */
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.admin-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-weight: 700;
  text-decoration: none;
}

.admin-nav a[aria-current="page"] {
  border-color: var(--color-red);
  background: var(--color-surface);
}

.admin-nav a:focus-visible {
  outline: 3px solid var(--color-text);
  outline-offset: 2px;
}

/* Urus kelas: kotak semak "Aktif" */
.field-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.field-check input {
  width: 22px;
  min-height: 22px;
  height: 22px;
  margin: 3px 0 0;
  padding: 0;
  flex: none;
  accent-color: var(--color-red);
}

.field-check label {
  margin: 0;
  font-weight: 400;
}

.class-actions {
  margin-top: 8px;
}

.field-hint-after {
  margin: 6px 0 0;
}

/* Tetapan akademi: nombor semasa + pautan semak */
.current-setting {
  margin: 0 0 16px;
  overflow-wrap: anywhere;
}

.current-setting p {
  margin: 0;
}

.current-setting a {
  display: inline-block;
  padding: 10px 0;
  color: var(--color-text);
  text-decoration: underline;
}

/* Dashboard admin: carian dan penapis */
.filter-form {
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

.filter-form .field input,
.filter-form .field select {
  background: var(--color-surface);
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 12px;
}

.filter-grid .field-wide {
  grid-column: 1 / -1;
}

.recent-hint {
  margin: 12px 0 0;
}

/* Dashboard admin: senarai tempahan */
.booking-list {
  display: grid;
  gap: 12px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.booking-item {
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

.booking-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.booking-ref {
  font-weight: 800;
}

.booking-line {
  margin: 6px 0 0;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

.booking-amount {
  margin: 6px 0 0;
  font-weight: 700;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
}

.badge-paid {
  border-color: var(--color-success);
  color: var(--color-success);
}

.badge-pending {
  border-color: var(--color-warning);
  color: var(--color-warning);
}

.badge-failed {
  border-color: var(--color-red);
  color: var(--color-red-text);
}

.badge-closed {
  color: var(--color-text-muted);
}

.booking-details {
  margin-top: 8px;
}

.booking-details summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  cursor: pointer;
}

.booking-details summary:focus-visible {
  outline: 3px solid var(--color-text);
  outline-offset: 2px;
}

.booking-details .review-list {
  margin: 4px 0 0;
}

@media (min-width: 560px) {
  .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-list {
    grid-template-columns: max-content 1fr;
  }

  .review-list dd {
    margin: 0;
  }
}

/* Kaki halaman */
.site-footer {
  padding: 24px 0;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
}

/* Butang yang kelihatan seperti pautan (contoh: "Tetapan privasi" di kaki halaman) */
.link-button {
  min-height: 44px;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.link-button:focus-visible {
  outline: 3px solid var(--color-text);
  outline-offset: 2px;
}

/* Banner persetujuan Meta Pixel (K-032): melekat di bawah skrin, tidak menutup kaki halaman */
.consent-banner {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: 12px 0;
  border-top: 2px solid var(--color-red);
  background: var(--color-surface);
}

.consent-title {
  margin: 0 0 4px;
  font-size: 1.125rem;
}

.consent-text,
.consent-current {
  margin: 0 0 10px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.consent-current {
  color: var(--color-text-muted);
}

.consent-actions .button {
  min-width: 120px;
}

/* Komputer dan tablet */
@media (min-width: 768px) {
  .hero {
    padding: 120px 0 128px;
  }

  .class-card {
    padding: 28px;
  }
}
