@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Orbitron:wght@600;700;800;900&display=swap');

:root {
  --bg-dark: #090D16;
  --bg-card: rgba(18, 24, 38, 0.85);
  --bg-card-hover: rgba(28, 36, 56, 0.95);
  --bg-glass: rgba(15, 23, 42, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 240, 255, 0.3);

  --accent-gold: #FFC72C;
  --accent-gold-hover: #E0AB18;
  --accent-cyan: #00F0FF;
  --accent-purple: #7C3AED;
  --accent-emerald: #10B981;
  --accent-rose: #F43F5E;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-sub: #64748B;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-glow: 0 0 25px rgba(0, 240, 255, 0.15);
  --shadow-gold: 0 0 25px rgba(255, 199, 44, 0.2);
  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.4);
  --backdrop-blur: blur(16px);
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Orbitron', sans-serif;
}

/* -------------------------------------------------------------
   FASE 1 — BASELINE MOBILE-FIRST & JAMINAN NOL OVERFLOW
------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  font-family: var(--font-sans);
  background-image:
    radial-gradient(circle at 15% 15%, rgba(124, 58, 237, 0.14) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(0, 240, 255, 0.1) 0%, transparent 50%);
  background-attachment: fixed;
}

img,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

button,
input,
select,
textarea {
  max-width: 100%;
  font-family: inherit;
}

.flex-container,
.grid-container,
.features-grid,
.stats-grid,
.tournament-list,
.admin-layout {
  min-width: 0;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: #1E293B;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* Tipografi */
h1,
h2,
h3,
h4,
.brand-font {
  font-family: var(--font-display);
  letter-spacing: 0.5px;
  word-break: break-word;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--accent-gold);
}

/* Navigasi Bar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 5%;
  background: rgba(9, 13, 22, 0.88);
  backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
}

.brand-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-cyan));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-weight: 900;
  box-shadow: var(--shadow-gold);
  font-size: 1.1rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

/* Toggle Menu Mobile & Desktop */
.nav-toggle {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 1002;
  position: relative;
  user-select: none;
  transition: all 0.2s ease;
}

.nav-toggle:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.nav-mobile-menu {
  display: none;
  flex-direction: column;
  gap: 12px;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(12, 17, 29, 0.98);
  border-bottom: 1px solid var(--border-color);
  padding: 20px 5%;
  backdrop-filter: var(--backdrop-blur);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.8);
  z-index: 9999;
}

.nav-mobile-menu.active {
  display: flex !important;
}

/* Tombol dengan target sentuh minimal 44px */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  min-height: 44px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  text-decoration: none;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-hover));
  color: #0F172A;
  box-shadow: var(--shadow-gold);
  font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(255, 199, 44, 0.4);
  color: #000;
}

.btn-cyan {
  background: linear-gradient(135deg, var(--accent-cyan), #00B8D9);
  color: #0F172A;
  box-shadow: var(--shadow-glow);
  font-weight: 700;
}

.btn-cyan:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.4);
}

.btn-purple {
  background: linear-gradient(135deg, var(--accent-purple), #9333EA);
  color: #FFFFFF;
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
  font-weight: 700;
}

.btn-purple:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(124, 58, 237, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.35);
}

.btn-danger:hover:not(:disabled) {
  background: var(--accent-rose);
  color: #fff;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
  min-height: 38px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
  min-height: 50px;
}

/* Kartu Kaca (Glass Card) */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: all 0.3s ease;
  min-width: 0;
  word-wrap: break-word;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Lencana (Badge) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-upcoming {
  background: rgba(124, 58, 237, 0.2);
  color: #A78BFA;
  border: 1px solid rgba(124, 58, 237, 0.4);
}

.badge-registration,
.badge-registration_open {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-registration_closed {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-ongoing,
.badge-in_progress {
  background: rgba(0, 240, 255, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.4);
}

.badge-finished,
.badge-completed {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-draft {
  background: rgba(100, 116, 139, 0.2);
  color: #94A3B8;
  border: 1px solid rgba(100, 116, 139, 0.35);
}

.badge-cancelled,
.badge-rejected {
  background: rgba(244, 63, 94, 0.2);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.badge-approved {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-pending {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-paid {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-unpaid {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Indikator status berkedip */
.pulse-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }

  50% {
    transform: scale(1.2);
    opacity: 1;
  }

  100% {
    transform: scale(0.95);
    opacity: 0.8;
  }
}

/* Formulir & Target Sentuh */
.form-group {
  margin-bottom: 20px;
  min-width: 0;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

.form-control::placeholder {
  color: var(--text-sub);
}

textarea.form-control {
  resize: vertical;
  min-height: 110px;
}

select.form-control {
  cursor: pointer;
}

/* Pembungkus Tabel Responsif - Menjamin Nol Overflow Halaman */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  margin-top: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.table-responsive table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  text-align: left;
}

.table-responsive th,
.table-responsive td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.table-responsive th {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
}

.table-responsive tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Pembungkus Bracket Responsif */
.bracket-scroll-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 20px 10px;
  border-radius: var(--radius-lg);
  background: rgba(11, 16, 28, 0.6);
  border: 1px solid var(--border-color);
}

/* Status Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.09) 37%, rgba(255, 255, 255, 0.04) 63%);
  background-size: 400% 100%;
  animation: skeletonLoading 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-title {
  height: 28px;
  width: 65%;
  margin-bottom: 14px;
}

.skeleton-card {
  height: 180px;
  border-radius: var(--radius-lg);
}

@keyframes skeletonLoading {
  0% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0 50%;
  }
}

/* Kontainer Toast */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: calc(100vw - 40px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--backdrop-blur);
  color: var(--text-main);
  font-size: 0.88rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease;
  min-width: 260px;
}

.toast-success {
  border-left: 4px solid var(--accent-emerald);
}

.toast-error {
  border-left: 4px solid var(--accent-rose);
}

.toast-info {
  border-left: 4px solid var(--accent-cyan);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 16px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.25s ease;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.modal-overlay.active .modal-box {
  transform: scale(1);
}

/* Footer */
footer {
  border-top: 1px solid var(--border-color);
  padding: 40px 5%;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 60px;
  background: rgba(9, 13, 22, 0.92);
}

/* -------------------------------------------------------------
   KELAS UTILITAS RESPONSIF & KARTU SELEKSI
------------------------------------------------------------- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.table-responsive table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
}

.grid-responsive-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-responsive-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.type-select-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}

.type-select-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(18, 24, 38, 0.9);
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
}

.type-select-card:hover {
  border-color: rgba(0, 240, 255, 0.4);
  background: rgba(28, 36, 56, 0.95);
}

.type-select-card input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--accent-gold);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.type-select-card.active,
.type-select-card:has(input[type="radio"]:checked) {
  border-color: var(--accent-gold);
  background: rgba(255, 199, 44, 0.08);
  box-shadow: 0 0 20px rgba(255, 199, 44, 0.15);
}

.type-select-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: block;
  margin-bottom: 4px;
}

.type-select-desc {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: block;
}

/* -------------------------------------------------------------
   MEDIA QUERY RESPONSIF (320px - 768px - 900px)
------------------------------------------------------------- */
@media (max-width: 900px) {
  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
  }

  #nav-right {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 12px 4%;
  }

  .nav-brand {
    font-size: 1.15rem;
  }

  .card {
    padding: 18px;
  }

  .modal-box {
    padding: 20px;
  }

  .btn-lg {
    padding: 12px 20px;
    font-size: 0.95rem;
  }

  .grid-responsive-2,
  .grid-responsive-3,
  .type-select-container {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .navbar {
    padding: 10px 14px;
  }

  .nav-brand span {
    font-size: 1rem;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 0.95rem;
  }

  .btn {
    width: 100%;
  }

  .btn-sm {
    width: auto;
  }

  .card {
    padding: 14px;
    border-radius: var(--radius-md);
  }

  .modal-box {
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  #toast-container {
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }

  .toast {
    min-width: unset;
    width: 100%;
  }

  .type-select-card {
    padding: 12px 14px;
  }

  .type-select-title {
    font-size: 0.93rem;
  }

  .type-select-desc {
    font-size: 0.8rem;
  }
}