/* =====================================================================
   Futsal Referee Training Platform - Stylesheet
   Design System: Sports Referee Dark/Navy Theme with Neon Accents
   Mobile-First & Fully Responsive (PWA Optimized)
   ===================================================================== */

:root {
  --bg-primary: #0a1118;
  --bg-surface: #111d28;
  --bg-card: #182635;
  --bg-card-hover: #1f3144;
  --bg-input: #0f1922;

  --border-subtle: #22374b;
  --border-focus: #00b4d8;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #00b4d8;
  --accent-cyan-hover: #0096c7;
  --accent-teal: #00f5d4;

  --card-yellow: #ffd166;
  --card-yellow-dark: #b58900;
  --card-red: #ef476f;
  --card-red-dark: #b71c1c;

  --status-active: #10b981;
  --status-expired: #f43f5e;
  --status-pending: #f59e0b;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(0, 180, 216, 0.3);

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-height: 64px;
  --bottom-bar-height: 62px;
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--bottom-bar-height) + 16px);
}

@media (min-width: 992px) {
  body {
    padding-bottom: 0;
  }
}

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

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

/* Container */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.3;
}

.section-title {
  font-size: 1.5rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

/* Top Navbar */
.navbar {
  background-color: rgba(17, 29, 40, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.5px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

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

@media (min-width: 992px) {
  .nav-links {
    display: flex;
  }
}

.nav-link {
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
  background-color: var(--bg-card);
}

.nav-link.active {
  border-bottom: 2px solid var(--accent-cyan);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--text-main);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal));
  color: #0a1118;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
}

/* Mobile Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-bar-height);
  background-color: rgba(17, 29, 40, 0.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 99;
}

@media (min-width: 992px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  width: 20%;
  height: 100%;
  gap: 3px;
  transition: color 0.2s ease;
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
}

.bottom-nav-item.active {
  color: var(--accent-cyan);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-cyan-hover));
  color: #061118;
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: var(--shadow-glow);
  color: #061118;
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--text-dim);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border-subtle);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-danger {
  background-color: var(--card-red);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: var(--card-red-dark);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 13px 26px;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-active {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--status-active);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-expired {
  background-color: rgba(244, 63, 94, 0.15);
  color: var(--status-expired);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-annual {
  background-color: rgba(0, 180, 216, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 180, 216, 0.3);
}

.badge-monthly {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--card-yellow);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-role {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* Subscription Expiration Alert Banner */
.alert-banner {
  background-color: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.alert-banner.warning {
  background-color: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
}

.alert-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-icon {
  font-size: 1.5rem;
  color: var(--card-yellow);
}

.alert-banner.danger .alert-icon {
  color: var(--card-red);
}

/* Cards & Grid */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 20px;
  flex: 1;
}

.card-footer {
  padding: 14px 20px;
  background-color: rgba(0, 0, 0, 0.15);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Video Card Details */
.video-thumbnail-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  background-color: #000;
  overflow: hidden;
  cursor: pointer;
}

.video-thumbnail-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card:hover .video-thumbnail-img {
  transform: scale(1.05);
}

.video-play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.video-thumbnail-container:hover .video-play-overlay {
  background: rgba(0, 0, 0, 0.1);
}

.play-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0, 180, 216, 0.9);
  color: #061118;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.duration-tag {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background-color: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 18px;
}

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

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.95rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

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

/* Filter Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
  background-color: var(--bg-surface);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-pill {
  padding: 6px 14px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.filter-pill:hover, .filter-pill.active {
  background-color: var(--accent-cyan);
  color: #061118;
  border-color: var(--accent-cyan);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 16px;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-backdrop.show .modal-dialog {
  transform: translateY(0);
}

.modal-dialog-lg {
  max-width: 900px;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text-main);
}

/* Video Player Modal Iframe */
.video-responsive-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background-color: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.video-responsive-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Trivia Google Forms Modal Iframe */
.trivia-iframe-wrap {
  width: 100%;
  height: 65vh;
  background-color: #ffffff;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.trivia-iframe-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Forum Threads & Replies */
.topic-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topic-item:hover {
  border-color: var(--accent-cyan);
  background-color: var(--bg-card-hover);
}

.topic-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.topic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--text-dim);
}

.topic-badge-pinned {
  color: var(--card-yellow);
  font-weight: 700;
}

.reply-item {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 14px;
}

.reply-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.reply-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reply-author-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.reply-date {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.reply-content {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Tables (Admin) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
}

.table th {
  background-color: var(--bg-card);
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

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

/* Stats Cards */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .stats-row {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-cyan);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Physical Fitness Test Calculator (Yo-Yo / Ariet for Futsal Referees) */
.calculator-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 24px;
}

.result-card {
  background-color: var(--bg-card);
  border: 2px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  margin-top: 18px;
}

.result-card.passed {
  border-color: var(--status-active);
  background: rgba(16, 185, 129, 0.08);
}

.result-card.failed {
  border-color: var(--status-expired);
  background: rgba(244, 63, 94, 0.08);
}

/* Hero Section (Index / Landing) */
.hero {
  padding: 40px 0 20px;
  text-align: center;
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #ffffff 40%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto 30px;
}

/* Offline Page Styling */
.offline-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.offline-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  max-width: 480px;
}

.offline-icon-box {
  color: var(--card-yellow);
  margin-bottom: 18px;
}

.offline-title {
  font-size: 1.6rem;
  margin-bottom: 12px;
}

.offline-message {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.offline-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Utility Helpers */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.text-success { color: var(--status-active); }
.text-danger { color: var(--status-expired); }
.text-warning { color: var(--card-yellow); }
.text-cyan { color: var(--accent-cyan); }
.cursor-pointer { cursor: pointer; }
.hidden { display: none !important; }
.m-0 { margin: 0 !important; }
.ml-2 { margin-left: 8px !important; }
.text-sm { font-size: 0.85rem !important; }
.text-xs { font-size: 0.82rem !important; }
.badge-xs { font-size: 0.65rem !important; padding: 2px 6px !important; }
.avatar-admin { background: linear-gradient(135deg, #ef476f, #b71c1c) !important; color: #fff !important; }
.select-filter-wrap { min-width: 180px; }
.filter-label { font-size: 0.9rem; font-weight: 600; }
.renew-user-summary { background-color: var(--bg-card); padding: 14px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.form-note { font-size: 0.82rem; color: var(--text-dim); }
.result-distance-text { font-size: 1.35rem; }
.topic-author-info { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 16px; }
.modal-subdesc { font-size: 0.85rem; margin: 0; }

.grid-col-all { grid-column: 1 / -1; }
.empty-card { padding: 40px 20px; }
.user-sub-info { font-size: 0.78rem; color: var(--text-dim); }
.user-perf-info { font-size: 0.8rem; }
.actions-wrap { display: flex; gap: 6px; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.btn-delete-card { color: var(--card-red) !important; border-color: transparent !important; }
.avatar-instructor { background: linear-gradient(135deg, #ffd166, #f77f00) !important; color: #0a1118 !important; }
.badge-instructor { font-size: 0.7rem !important; margin-left: 6px !important; }
.test-pass-badge { color: var(--status-active); font-weight: 800; font-size: 1.25rem; }
.test-fail-badge { color: var(--status-expired); font-weight: 800; font-size: 1.25rem; }
.border-cyan { border-left: 4px solid var(--accent-cyan); }
.border-yellow { border-left: 4px solid var(--card-yellow); }
.key-points-box { background-color: var(--bg-surface); padding: 12px 16px; border-radius: var(--radius-sm); border: 1px dashed var(--border-subtle); }
.official-decision-box { background: rgba(0, 180, 216, 0.08); border: 1px solid rgba(0, 180, 216, 0.3); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 8px; }
.official-decision-text { margin: 0; font-size: 0.95rem; font-weight: 600; }
.card-title-md { font-size: 1.1rem; margin-bottom: 8px; }
.flex-1 { flex: 1; }
.meta-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
