@import url("https://fonts.googleapis.com/css2?family=Kanit:ital,wght@1,700;1,800;1,900&display=swap");

:root {
  --black: #050505;
  --panel: #101010;
  --panel-light: #151515;
  --border: #2b2b2b;
  --border-strong: #444444;
  --red: #df1421;
  --red-dark: #a70d16;
  --gold: #d3a81e;
  --green: #81c900;
  --white: #ffffff;
  --muted: #a9a9a9;
  --danger: #ff4953;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--white);
  background:
    linear-gradient(rgba(0, 0, 0, 0.94), rgba(0, 0, 0, 0.94)),
    repeating-linear-gradient(
      135deg,
      #050505 0,
      #050505 16px,
      #090909 16px,
      #090909 32px
    );
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.admin-shell {
  width: 100%;
  min-height: 100vh;
}

.admin-eyebrow,
.section-eyebrow,
h1,
h2,
h3,
.stat-card span,
.stat-card strong,
.voucher-stat-card span,
.voucher-stat-card strong,
.session-stat-card span,
.session-stat-card strong {
  font-family: "Kanit", Arial, Helvetica, sans-serif;
  font-style: italic;
  font-weight: 900;
}

.admin-eyebrow,
.section-eyebrow {
  margin: 0 0 7px;
  color: var(--gold);
  font-size: 0.74rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin-top: 0;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 5px;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-size: 2rem;
}

h3 {
  margin-bottom: 12px;
}

/* LOGIN */
.login-view {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
}

.login-card {
  width: min(100%, 460px);
  overflow: hidden;
  background: #101010;
  border: 1px solid var(--border);
  border-top: 7px solid var(--red);
  border-radius: 0;
  box-shadow: none;
}

.admin-brand {
  position: relative;
  padding: 35px 32px 25px;
  border-bottom: 1px solid var(--border);
}

.admin-brand::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 36%;
  height: 4px;
  background: var(--gold);
}

.admin-brand h1 {
  margin-bottom: 5px;
}

.admin-brand > p:last-child {
  margin: 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 20px;
  padding: 30px 32px 35px;
}

.login-form label,
.admin-card label {
  display: grid;
  gap: 8px;
  color: var(--white);
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.035em;
}

.login-form input,
.admin-card input,
.search-box input {
  width: 100%;
  padding: 13px 14px;
  color: var(--white);
  background: #090909;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  outline: none;
}

.login-form input:focus,
.admin-card input:focus,
.search-box input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(223, 20, 33, 0.16);
}

/* BUTTONS */
.primary-button,
.secondary-button {
  padding: 12px 18px;
  border-radius: 0;
  font-family: "Kanit", Arial, Helvetica, sans-serif;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
}

.primary-button {
  color: white;
  background: var(--red);
  border: 1px solid var(--red);
  box-shadow: none;
}

.primary-button:hover {
  transform: translateY(-1px);
  background: #f0212e;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.secondary-button {
  color: white;
  background: #141414;
  border: 1px solid var(--border-strong);
}

.secondary-button:hover {
  border-color: var(--red);
  background: #181818;
}

/* DASHBOARD HEADER */
.dashboard-view {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 25px;
}

.admin-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  padding: 25px 28px;
  background:
    linear-gradient(115deg, rgba(223, 20, 33, 0.17), transparent 34%),
    #101010;
  border: 1px solid var(--border);
  border-top: 7px solid var(--red);
  border-radius: 0;
}

.admin-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 30%;
  height: 4px;
  background: var(--gold);
}

.admin-header h1 {
  margin: 0;
  font-size: 2.25rem;
}

/* NAVIGATION */
.admin-tabs {
  display: flex;
  gap: 0;
  padding: 0;
  overflow-x: auto;
  background: #0b0b0b;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.admin-tab {
  position: relative;
  padding: 16px 20px;
  color: #9c9c9c;
  background: transparent;
  border: 0;
  border-right: 1px solid #202020;
  font-family: "Kanit", Arial, Helvetica, sans-serif;
  font-size: 0.8rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.04em;
}

.admin-tab:hover {
  color: white;
  background: #111111;
}

.admin-tab.active {
  color: white;
  background: #151515;
}

.admin-tab.active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  content: "";
  background: var(--red);
}

/* TAB CONTENT */
.tab-panel {
  padding: 28px 0;
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 3px solid var(--red);
}

.search-box {
  width: min(100%, 420px);
}

/* OVERVIEW */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  position: relative;
  min-height: 140px;
  padding: 21px;
  overflow: hidden;
  background: #101010;
  border: 1px solid var(--border);
  border-radius: 0;
}

.stat-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  content: "";
  background: var(--red);
}

.stat-card span {
  display: block;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  color: white;
  font-size: 2.35rem;
  line-height: 1;
}

/* CARDS */
.admin-card {
  padding: 24px;
  background: #101010;
  border: 1px solid var(--border);
  border-radius: 0;
}

.admin-card > p {
  color: var(--muted);
  line-height: 1.6;
}

.admin-card .primary-button {
  margin-top: 18px;
}

/* BOOKINGS */
.bookings-container {
  display: grid;
  gap: 10px;
}

.booking-card {
  display: grid;
  grid-template-columns:
    minmax(200px, 1.3fr)
    minmax(200px, 1fr)
    minmax(150px, 0.8fr)
    minmax(120px, 0.6fr);
  gap: 18px;
  align-items: center;
  padding: 17px 19px;
  background: #101010;
  border: 1px solid var(--border);
  border-left: 5px solid var(--red);
  border-radius: 0;
}

.booking-driver strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1rem;
}

.booking-driver span,
.booking-reference,
.booking-sessions {
  color: var(--muted);
  font-size: 0.85rem;
}

.booking-reference {
  word-break: break-all;
}

.booking-total {
  text-align: right;
  font-size: 1.1rem;
  font-weight: 900;
}

.status-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 8px;
  color: white;
  background: #333;
  border-radius: 0;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-badge.paid,
.status-badge.confirmed {
  background: #376500;
}

/* VOUCHERS */
.voucher-admin-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(350px, 1.2fr);
  gap: 18px;
}

.generated-codes {
  display: grid;
  gap: 7px;
  max-height: 500px;
  overflow-y: auto;
}

.generated-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 10px 12px;
  color: var(--gold);
  background: #080808;
  border: 1px solid #333;
  border-radius: 0;
  font-family: Consolas, monospace;
  font-weight: bold;
}

.admin-message {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.admin-message.error {
  color: var(--danger);
}

.admin-message.success {
  color: var(--green);
}

.empty-message {
  margin: 0;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

/* VOUCHER MANAGEMENT */
.voucher-list-section {
  margin-top: 28px;
}

.voucher-list-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.voucher-list-heading h3 {
  margin-bottom: 0;
}

.voucher-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.voucher-search-box {
  flex: 1;
  width: min(100%, 500px);
}

.voucher-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.voucher-filter {
  padding: 9px 13px;
  color: #aaa;
  background: #111;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  font-family: "Kanit", Arial, Helvetica, sans-serif;
  font-size: 0.75rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.voucher-filter:hover {
  color: white;
  border-color: var(--red);
}

.voucher-filter.active {
  color: white;
  background: var(--red);
  border-color: var(--red);
}

.voucher-stats-grid,
.session-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.voucher-stat-card,
.session-stat-card {
  position: relative;
  padding: 16px 18px;
  background: #101010;
  border: 1px solid var(--border);
  border-radius: 0;
}

.voucher-stat-card::before,
.session-stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--red);
}

.voucher-stat-card span,
.session-stat-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.voucher-stat-card strong,
.session-stat-card strong {
  display: block;
  color: white;
  font-size: 1.7rem;
  line-height: 1;
}

.vouchers-container,
.sessions-container {
  display: grid;
  gap: 10px;
}

.voucher-card,
.session-card {
  padding: 19px;
  background: #101010;
  border: 1px solid var(--border);
  border-left: 5px solid #555;
  border-radius: 0;
}

.voucher-card.unused,
.session-card {
  border-left-color: var(--green);
}

.voucher-card.used {
  border-left-color: var(--gold);
}

.voucher-card.disabled,
.session-card.disabled {
  border-left-color: #666;
  opacity: 0.78;
}

.voucher-card-header,
.session-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.voucher-card-header h3 {
  margin: 8px 0 4px;
  color: var(--gold);
  font-family: Consolas, monospace;
  font-size: 1.25rem;
  font-style: normal;
  word-break: break-all;
}

.voucher-card-header p,
.session-card-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.voucher-card-actions,
.session-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.voucher-card-actions .secondary-button,
.session-card-actions .secondary-button {
  padding: 9px 13px;
  font-size: 0.72rem;
}

.voucher-status,
.session-status {
  display: inline-block;
  padding: 5px 9px;
  color: white;
  background: #333;
  border-radius: 0;
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.voucher-status.unused,
.session-status.active {
  background: #376500;
}

.voucher-status.used {
  color: #111;
  background: var(--gold);
}

.voucher-status.disabled,
.session-status.disabled {
  background: #555;
}

.voucher-details-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.voucher-detail,
.session-detail,
.session-capacity-editor {
  min-width: 0;
  padding: 12px;
  background: #090909;
  border: 1px solid #2e2e2e;
  border-radius: 0;
}

.voucher-detail span,
.session-detail span,
.session-capacity-editor label {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.voucher-detail strong {
  display: block;
  color: white;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.voucher-detail small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

/* SESSION MANAGEMENT */
.session-card-header h3 {
  margin: 8px 0 4px;
  color: var(--white);
  font-size: 1.2rem;
}

.session-details-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.session-detail strong {
  display: block;
  margin-top: 7px;
  color: white;
  font-size: 1.1rem;
}

.session-capacity-controls {
  display: flex;
  gap: 8px;
  margin-top: 7px;
}

.session-capacity-input {
  width: 90px;
  padding: 9px 10px;
  color: white;
  background: #090909;
  border: 1px solid #444;
  border-radius: 0;
  outline: none;
}

.session-capacity-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(223, 20, 33, 0.15);
}

.session-capacity-save {
  padding: 9px 12px;
}

/* ADMIN SESSION DRIVER LIST */
.session-driver-section {
  margin-top: 14px;
  overflow: hidden;
  background: #090909;
  border: 1px solid #2e2e2e;
  border-radius: 0;
}

.session-driver-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 11px 13px;
  background: #111;
  border-bottom: 1px solid #292929;
}

.session-driver-heading span {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.session-driver-heading strong {
  color: var(--gold);
}

.admin-driver-list {
  display: grid;
  gap: 5px;
  min-height: 55px;
  padding: 8px;
}

.admin-driver-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: white;
  background: #151515;
  border: 1px solid #333;
  border-radius: 0;
  cursor: grab;
  user-select: none;
  transition:
    transform 0.12s ease,
    opacity 0.12s ease,
    border-color 0.12s ease;
}

.admin-driver-item:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.admin-driver-item:active {
  cursor: grabbing;
}

.admin-driver-item.dragging {
  opacity: 0.35;
}

.drag-handle {
  color: var(--muted);
  font-size: 1rem;
}

.session-empty-drivers {
  margin: 0;
  padding: 15px;
  color: var(--muted);
  text-align: center;
  font-size: 0.8rem;
}

.session-drop-zone {
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.session-drop-zone.drag-over {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(211, 168, 30, 0.2);
}

.sessions-busy {
  pointer-events: none;
  opacity: 0.65;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
  .session-details-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1000px) {
  .stats-grid,
  .voucher-stats-grid,
  .session-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .voucher-admin-grid {
    grid-template-columns: 1fr;
  }

  .booking-card {
    grid-template-columns: 1fr 1fr;
  }

  .booking-total {
    text-align: left;
  }

  .voucher-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .voucher-search-box {
    width: 100%;
  }

  .voucher-details-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .session-details-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 650px) {
  .dashboard-view {
    padding: 12px;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-header .secondary-button {
    width: 100%;
  }

  .admin-tabs {
    padding: 0;
  }

  .admin-tab {
    flex: 1;
    padding: 15px 12px;
  }

  .stats-grid,
  .voucher-stats-grid,
  .session-stats-grid {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .voucher-list-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
  }

  .booking-card,
  .voucher-details-grid,
  .session-details-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    border-radius: 0;
  }

  .admin-brand,
  .login-form {
    padding-right: 22px;
    padding-left: 22px;
  }

  .voucher-list-heading .secondary-button {
    width: 100%;
  }

  .voucher-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .voucher-filter {
    width: 100%;
  }

  .voucher-card-header,
  .session-card-header {
    flex-direction: column;
  }

  .voucher-card-actions,
  .session-card-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .voucher-card-actions .secondary-button,
  .session-card-actions .secondary-button {
    flex: 1;
  }

  .session-card-actions .secondary-button {
    width: 100%;
  }

  .session-capacity-controls {
    flex-direction: column;
  }

  .session-capacity-input,
  .session-capacity-save {
    width: 100%;
  }
}

/* =====================================================
   CHAMPIONSHIP DRIVERS
===================================================== */

.championship-admin-grid {
  display: grid;

  grid-template-columns:
    minmax(300px, 0.8fr)
    minmax(300px, 1.2fr);

  gap: 18px;
}

.championship-stats-grid {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 12px;
}

.championship-stat-card {
  position: relative;

  padding: 18px;

  background: #101010;

  border: 1px solid var(--border);
}

.championship-stat-card::before {
  content: "";

  position: absolute;

  top: 0;
  right: 0;
  left: 0;

  height: 3px;

  background: var(--red);
}

.championship-stat-card span {
  display: block;

  margin-bottom: 9px;

  color: var(--muted);

  font-family:
    "Kanit",
    Arial,
    Helvetica,
    sans-serif;

  font-size: 0.68rem;
  font-style: italic;
  font-weight: 900;

  letter-spacing: 0.08em;
}

.championship-stat-card strong {
  display: block;

  color: white;

  font-family:
    "Kanit",
    Arial,
    Helvetica,
    sans-serif;

  font-size: 1.8rem;
  font-style: italic;
  font-weight: 900;
}

.championship-list-section {
  margin-top: 28px;
}

.championship-drivers-container {
  display: grid;

  gap: 10px;

  margin-top: 18px;
}

.championship-driver-card {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 20px;

  padding: 16px 18px;

  background: #101010;

  border: 1px solid var(--border);
  border-left: 5px solid var(--green);
}

.championship-driver-details strong {
  display: block;

  margin-bottom: 5px;

  color: white;
}

.championship-driver-details span {
  color: var(--muted);

  font-size: 0.85rem;
}

.championship-driver-actions {
  flex-shrink: 0;
}

@media (max-width: 800px) {
  .championship-admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .championship-driver-card {
    align-items: stretch;
    flex-direction: column;
  }

  .championship-driver-actions .secondary-button {
    width: 100%;
  }
}

.championship-driver-details span {
  display: block;
}

.championship-driver-details span + span {
  margin-top: 4px;

  color: #777777;

  font-size: 0.75rem;
}