/* ==========================================================================
   CUE ARENA — Core Design System & Public Dashboard Styles
   ========================================================================== */

:root {
  /* Colors */
  --bg-primary: #0B0F12;
  --bg-secondary: #171D22;
  --bg-tertiary: #1E252C;
  --bg-card: rgba(23, 29, 34, 0.85);
  --bg-card-hover: rgba(28, 36, 43, 0.95);
  --bg-glass: rgba(17, 22, 26, 0.7);

  --text-primary: #F5F5F5;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;

  --accent-gold: #D4AF37;
  --accent-gold-light: #F6E088;
  --accent-gold-dark: #8E6D18;
  --accent-gold-glow: rgba(212, 175, 55, 0.25);

  --snooker-green: #116B45;
  --snooker-green-light: #168858;
  --snooker-green-dark: #0B4B30;

  /* Status Colors */
  --status-available: #10B981;
  --status-available-glow: rgba(16, 185, 129, 0.35);
  --status-available-bg: rgba(16, 185, 129, 0.12);

  --status-occupied: #EF4444;
  --status-occupied-glow: rgba(239, 68, 68, 0.4);
  --status-occupied-bg: rgba(239, 68, 68, 0.12);

  --status-paused: #F59E0B;
  --status-paused-glow: rgba(245, 158, 11, 0.4);
  --status-paused-bg: rgba(245, 158, 11, 0.12);

  /* Borders & Shadows */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(212, 175, 55, 0.35);
  --border-gold-active: #D4AF37;
  --shadow-card: 0 16px 36px -10px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-glow-gold: 0 0 35px rgba(212, 175, 55, 0.18);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Cinzel', serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transitions */
  --transition-fast: 0.18s ease;
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  color-scheme: dark;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse at 50% 0%, rgba(17, 107, 69, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(212, 175, 55, 0.05) 0%, transparent 50%);
}

/* Ambient Ambient Glow Orbs */
.ambient-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(140px);
  z-index: 0;
  opacity: 0.6;
}

.glow-top-left {
  top: -150px;
  left: -150px;
  background: radial-gradient(circle, rgba(17, 107, 69, 0.25) 0%, transparent 70%);
}

.glow-bottom-right {
  bottom: -150px;
  right: -150px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.16) 0%, transparent 70%);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 1.5rem;
  transition: all var(--transition-normal);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
}

/* Brand */
.brand-group {
  display: flex;
  align-items: center;
  justify-self: start;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  height: 48px;
  width: auto;
  max-width: 140px;
  filter: drop-shadow(0 2px 10px rgba(212, 175, 55, 0.35)) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.7));
  transition: transform var(--transition-normal), filter var(--transition-normal);
  object-fit: contain;
}

.brand-link:hover .brand-logo {
  transform: scale(1.04);
  filter: drop-shadow(0 4px 16px rgba(212, 175, 55, 0.55)) drop-shadow(0 6px 14px rgba(0, 0, 0, 0.8));
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  background: linear-gradient(135deg, #FFFFFF 0%, var(--accent-gold-light) 45%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.brand-tagline {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-top: 3px;
}

/* Center Clock Card */
.header-center {
  display: flex;
  justify-content: center;
  align-items: center;
  justify-self: center;
  text-align: center;
}

.live-clock-card {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(11, 15, 18, 0.75);
  border: 1px solid rgba(212, 175, 55, 0.22);
  padding: 0.45rem 1.25rem;
  border-radius: 999px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  white-space: nowrap;
  flex-wrap: nowrap;
}

.clock-time,
.clock-date {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  color: #FFFFFF;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
}

.clock-date {
  color: #D1D5DB;
}

/* Header Actions & Pills */
.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  gap: 1rem;
}

.summary-pill-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.summary-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.pill-dot.emerald {
  background-color: var(--status-available);
  box-shadow: 0 0 8px var(--status-available);
}

.pill-dot.amber {
  background-color: var(--status-occupied);
  box-shadow: 0 0 8px var(--status-occupied);
}

.pill-label {
  color: var(--text-secondary);
}

.pill-value {
  color: #FFFFFF;
  font-family: var(--font-mono);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-gold {
  background: linear-gradient(135deg, #DFBE52 0%, var(--accent-gold) 60%, var(--accent-gold-dark) 100%);
  color: #0B0F12;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.3);
}

.btn-gold:hover {
  background: linear-gradient(135deg, #F8E38E 0%, #DFBE52 60%, var(--accent-gold) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(212, 175, 55, 0.45);
}

.btn-gold:active {
  transform: translateY(0);
}

/* Main Content */
.main-content {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 2.2rem 1.5rem 3.5rem;
  position: relative;
  z-index: 1;
}

/* Hero */
.dashboard-hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid var(--border-gold);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--accent-gold-light);
  margin-bottom: 0.85rem;
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.1);
}

.gold-star {
  color: var(--accent-gold);
  font-size: 0.65rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 2.85rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #FFFFFF;
  margin-bottom: 0.4rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
  font-weight: 400;
}

/* Sync Banner */
.sync-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid var(--border-gold);
  color: var(--accent-gold-light);
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  margin-bottom: 1.8rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.sync-banner.hidden {
  display: none;
}

.spin {
  animation: spin 1.2s linear infinite;
  display: inline-block;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* Tables Grid */
.tables-grid-section {
  margin-bottom: 3.5rem;
}

.tables-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.8rem;
}

/* Table Card Component */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.table-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 44px -10px rgba(0, 0, 0, 0.85), 0 0 20px rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.25);
}

/* Card Header */
.table-card-header {
  padding: 1.2rem 1.4rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.table-name-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.table-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #FFFFFF;
}

.table-rate-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-gold);
  background: rgba(212, 175, 55, 0.1);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(212, 175, 55, 0.2);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-badge.available {
  background: var(--status-available-bg);
  color: var(--status-available);
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 12px var(--status-available-glow);
}

.status-badge.occupied {
  background: var(--status-occupied-bg);
  color: #FF5A5A;
  border: 1px solid rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 14px var(--status-occupied-glow);
}

.status-badge.paused {
  background: var(--status-paused-bg);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 12px var(--status-paused-glow);
}

/* Pulses */
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.pulse-emerald {
  background-color: var(--status-available);
  box-shadow: 0 0 0 0 var(--status-available);
  animation: pulse-green 2s infinite;
}

.pulse-red {
  background-color: #EF4444;
  box-shadow: 0 0 0 0 #EF4444;
  animation: pulse-red 1.6s infinite;
}

.pulse-amber {
  background-color: #F59E0B;
  box-shadow: 0 0 0 0 #F59E0B;
  animation: pulse-amber 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-red {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes pulse-amber {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.8); }
  70% { transform: scale(1); box-shadow: 0 0 0 7px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Snooker Table Graphic Preview */
.table-visual-wrap {
  padding: 1.1rem 1.4rem 0.5rem;
  background: radial-gradient(circle at 50% 50%, rgba(17, 107, 69, 0.12) 0%, transparent 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.table-graphic {
  width: 100%;
  max-width: 320px;
  height: 145px;
  border-radius: 12px;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.6));
  transition: transform var(--transition-normal);
}

.table-card:hover .table-graphic {
  transform: scale(1.02);
}

/* Card Body */
.table-card-body {
  padding: 1rem 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  flex: 1;
}

/* Players Area */
.table-players-box {
  background: rgba(11, 15, 18, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.players-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.players-names {
  font-size: 0.95rem;
  font-weight: 600;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.players-empty {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Timer Display Area */
.table-timer-box {
  background: linear-gradient(180deg, rgba(14, 19, 23, 0.95) 0%, rgba(9, 12, 15, 0.95) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.table-timer-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
  opacity: 0.5;
}

.timer-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.timer-value {
  font-family: var(--font-mono);
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #FFFFFF;
  line-height: 1.1;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.2);
}

.timer-value.active {
  color: #FFFFFF;
  text-shadow: 0 0 16px rgba(212, 175, 55, 0.35);
}

.timer-value.paused {
  color: #FBBF24;
  text-shadow: 0 0 16px rgba(245, 158, 11, 0.35);
}

.timer-value.idle {
  color: #4B5563;
  text-shadow: none;
}

.timer-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Financial / Amount Box */
.table-cost-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: rgba(212, 175, 55, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 12px;
}

.cost-label-group {
  display: flex;
  flex-direction: column;
}

.cost-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold-light);
  font-weight: 600;
}

.cost-rate-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.cost-value {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--accent-gold-light);
  letter-spacing: 0.02em;
}

.cost-value.idle {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Card Footer Meta */
.table-card-footer {
  padding-top: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.footer-meta-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Skeleton Loading State */
.table-card.skeleton {
  min-height: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
}

.card-loading {
  color: var(--text-muted);
  font-size: 0.9rem;
  animation: pulse-opacity 1.5s ease-in-out infinite;
}

@keyframes pulse-opacity {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

/* Specs Section */
.club-specs-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 1.8rem 2rem;
  margin-top: 1rem;
  box-shadow: var(--shadow-card);
}

.specs-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.spec-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.spec-icon {
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 12px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.spec-info {
  display: flex;
  flex-direction: column;
}

.spec-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.spec-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #FFFFFF;
  margin: 2px 0;
}

.spec-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: rgba(11, 15, 18, 0.9);
  padding: 1.5rem 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.footer-name {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.1em;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1100px) {
  .tables-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-card:last-child {
    grid-column: span 2;
  }

}

@media (max-width: 768px) {
  .site-header {
    padding: 0.75rem 0;
  }

  .header-container {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand actions"
      "clock clock";
    align-items: center;
    gap: 0.85rem 1rem;
    padding: 0 1rem;
  }

  .brand-group {
    grid-area: brand;
  }

  .header-actions {
    grid-area: actions;
    display: flex;
    justify-content: flex-end;
  }

  .header-center {
    grid-area: clock;
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .live-clock-card {
    width: auto;
    max-width: fit-content;
    justify-content: center;
    padding: 0.4rem 1.1rem;
    white-space: nowrap;
    flex-wrap: nowrap;
  }

  .main-content {
    padding: 1.5rem 1rem 3rem;
  }

  .dashboard-hero {
    margin-bottom: 1.8rem;
  }

  .hero-title {
    font-size: 1.85rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
    padding: 0 0.5rem;
  }

  .tables-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .table-card:last-child {
    grid-column: auto;
  }

  .footer-container {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
