/* VenueFlow AI - Modern Operational Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-dark: #0a0c10;
  --bg-panel: #141820;
  --bg-card: #1c212b;
  --accent: #2d6cdf;
  --accent-light: #5c93fa;
  
  --color-green: #00e676;
  --color-yellow: #ffb300;
  --color-red: #ff1744;
  --text-main: #f0f2f5;
  --text-muted: #8b949e;
  
  --border-subtle: #2d313c;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  background-image: radial-gradient(circle at 50% top, #141a29 0%, var(--bg-dark) 40%);
  background-attachment: fixed;
}

.hidden { display: none !important; }

/* Header & Roles */
.app-header {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
}
.logo .accent { color: var(--accent-light); }

.live-indicator {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pulse {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-green);
  box-shadow: 0 0 8px var(--color-green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

.header-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f1218;
  padding: 8px 24px;
  border-top: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.role-switch { display: flex; gap: 4px; background: var(--bg-dark); padding: 4px; border-radius: 8px; }
.role-btn {
  padding: 6px 16px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}
.role-btn.active {
  background: var(--bg-panel);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.segmented-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px;}
.tab-btn {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Views & Layout */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.container-padding { padding: 24px; max-width: 1200px; margin: 0 auto; }

.section-heading {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  font-weight: 700;
}
.section-header-row {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.sub-heading { color: #fff; font-size: 1rem; margin-bottom: 10px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 4px;}

/* Attendee Hero */
.hero-section {
  background: var(--bg-panel);
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.sticky-top {
  position: sticky; top: 96px; z-index: 900; /* Stays under header */
}
.hero-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.hero-title-row h2 { color: var(--text-main); font-size: 1.1rem; }

.hero-split { display: flex; justify-content: space-between; align-items: center; }
.hero-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; font-weight:700;}
.hero-title { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.5px; }
.hero-time { font-size: 2.2rem; font-weight: 800; line-height: 1; margin-bottom: 4px;}
.hero-right { text-align: right; min-width: 120px; }

/* Grid Systems */
.card-grid { display: grid; gap: 16px; }
.alert-grid { grid-template-columns: 1fr; }
@media(min-width: 768px) {
  .alert-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid:not(.alert-grid):not(.col-grid):not(.console-grid) { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .console-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Cards Base */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
}

.card-title { font-weight: 700; font-size: 1rem; color: #fff; margin-bottom: 4px; }
.reason-text { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }

/* Alerts */
.alert-card { border-left: 4px solid var(--border-subtle); position: relative; }
.alert-critical { border-left-color: var(--color-red); background: rgba(255,23,68,0.05); }
.alert-warning { border-left-color: var(--color-yellow); }
.alert-info { border-left-color: var(--accent-light); }

.alert-header { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; color: var(--text-muted); font-weight: 700;}

/* Badges */
.badge { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase;}
.badge-green { background: rgba(0, 230, 118, 0.15); color: var(--color-green); }
.badge-yellow { background: rgba(255, 179, 0, 0.15); color: var(--color-yellow); }
.badge-red { background: rgba(255, 23, 68, 0.15); color: var(--color-red); }
.badge-muted { background: var(--bg-panel); border: 1px solid var(--border-subtle); color: var(--text-muted); }
.badge-outline { border: 1px solid currentColor; background:transparent;}

/* Utilities */
.color-green { color: var(--color-green) !important; }
.color-yellow { color: var(--color-yellow) !important; }
.color-red { color: var(--color-red) !important; }

/* Buttons */
.action-btn { font-size: 0.85rem; padding: 8px 16px; border-radius: 6px; cursor: pointer; border: 1px solid var(--border-subtle); background: var(--bg-panel); color: #fff; font-weight: 600; transition: all 0.2s;}
.action-btn:hover { background: var(--bg-card); border-color: var(--text-muted); }
.solid-btn { background: var(--accent); border-color: var(--accent); }
.solid-btn:hover { background: var(--accent-light); }
.danger-btn { border-color: var(--color-red); color: var(--color-red); }
.danger-btn:hover { background: rgba(255,23,68,0.1); }

/* Empty States */
.empty-state {
  background: rgba(0, 230, 118, 0.05);
  border: 1px dashed rgba(0, 230, 118, 0.3);
  border-radius: 8px;
  padding: 32px 20px;
  text-align: center;
  color: var(--color-green);
}

/* Admin Dashboard Specific */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media(min-width: 768px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi-card { text-align: center; padding: 20px 12px; }
.kpi-title { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight:700;}
.kpi-value { font-size: 2.2rem; font-weight: 800; margin: 8px 0; line-height: 1; }
.kpi-subtext { font-size: 0.75rem; color: var(--text-muted); }

.admin-columns { display: flex; flex-direction: column; gap: 24px; margin-top: 24px; }
@media(min-width: 900px) {
  .admin-columns { flex-direction: row; }
  .admin-col { flex: 1; }
}

.admin-divider { border: 0; border-top: 1px solid var(--border-subtle); margin: 32px 0; }

.list-card { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.queue-card { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-left: 3px solid transparent; }
.queue-critical { border-left-color: var(--color-red); background: rgba(255,23,68,0.03); }
.queue-left { display: flex; align-items: center; gap: 12px; }
.queue-rank { font-size: 1.2rem; font-weight: 800; color: var(--border-subtle); width: 30px; text-align:center;}
.queue-right { text-align: right; }
.queue-time { font-size: 1.2rem; font-weight: 800; margin-bottom: 4px; }
.queue-time span { font-size: 0.8rem; font-weight: normal; color: var(--text-muted); }

/* Overrides Console */
.console-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 0.85rem;}
.console-input { background: var(--bg-dark); border: 1px solid var(--border-subtle); color: #fff; padding: 6px; border-radius: 4px; width: 90px; }

/* Utilities */
.inline-tabs { margin-bottom: 0; }

/* Virtual Stadium UI */
.virtual-stadium-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.virtual-stadium-controls {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.vs-control-group {
  display: flex;
  gap: 8px;
}

.vs-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.vs-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.virtual-stadium-layout {
  display: flex;
  flex-direction: column;
}
@media (min-width: 900px) {
  .virtual-stadium-layout {
    flex-direction: row;
  }
}

.virtual-stadium-map-container {
  flex: 1;
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}
@media (min-width: 900px) {
  .virtual-stadium-map-container {
    border-bottom: none;
    border-right: 1px solid var(--border-subtle);
  }
}

.stadium-svg {
  width: 100%;
  max-width: 500px;
  height: auto;
  display: block;
}

.st-bowl { fill: none; stroke: var(--border-subtle); stroke-width: 8; }
.st-stand { 
  fill: var(--bg-dark); 
  stroke: var(--border-subtle); 
  stroke-width: 2; 
  cursor: pointer; 
  transition: fill 0.3s, stroke 0.3s;
}
.st-stand:hover { fill: rgba(92, 147, 250, 0.2); stroke: var(--accent-light); }
.st-stand.active { fill: rgba(45, 108, 223, 0.4); stroke: var(--accent); }
.st-field { fill: #10141a; stroke: var(--border-subtle); stroke-width: 2; }
.st-pitch { fill: none; stroke: rgba(255, 255, 255, 0.3); stroke-width: 1.5; }
.st-stage { fill: var(--bg-panel); stroke: var(--accent-light); stroke-width: 2; }
.st-text { fill: var(--text-muted); font-size: 14px; font-weight: bold; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }

.st-gate {
  cursor: pointer;
  stroke: #fff;
  stroke-width: 2;
  transition: r 0.2s;
}
.st-gate:hover { r: 12; }
.st-gate.gate-open { fill: var(--color-green); }
.st-gate.gate-busy { fill: var(--color-yellow); }
.st-gate.gate-closed { fill: var(--color-red); opacity: 0.5; stroke: rgba(255,255,255,0.2); }
.st-gate.active { stroke: var(--accent-light); stroke-width: 4; }

.st-facility {
  fill: var(--bg-dark);
  stroke: #fff;
  stroke-width: 1.5;
  cursor: pointer;
  transition: transform 0.2s;
}
.st-facility:hover { transform: scale(1.1); }
.st-facility.active { stroke: var(--accent-light); stroke-width: 2.5; }

.st-fac-icon { font-size: 12px; pointer-events: none; text-anchor: middle; dominant-baseline: middle; }

.st-route {
  fill: none;
  stroke: var(--accent-light);
  stroke-width: 3;
  stroke-dasharray: 8 4;
  animation: dash 15s linear infinite;
  pointer-events: none;
  opacity: 0.8;
}
@keyframes dash {
  to { stroke-dashoffset: -1000; }
}

.st-user {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 2;
  pointer-events: none;
}
.st-user-pulse {
  fill: var(--accent);
  opacity: 0.4;
  animation: st-pulse 2s infinite;
  pointer-events: none;
}
@keyframes st-pulse {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}

.st-heatmap {
  fill: var(--color-red);
  opacity: 0; 
  pointer-events: none;
  transition: opacity 0.5s;
  filter: blur(8px);
}

.virtual-stadium-info {
  width: 100%;
  padding: 16px;
  background: var(--bg-panel);
}
@media (min-width: 900px) {
  .virtual-stadium-info {
    width: 300px;
  }
}

.vsi-header {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.vsi-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 12px;
}

.vsi-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vsi-detail {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.vsi-detail strong {
  color: #fff;
}

.st-alert-pulse {
  fill: rgba(255, 23, 68, 0.2);
  stroke: rgba(255, 23, 68, 0.8);
  stroke-width: 3;
  pointer-events: none;
  animation: alertPulse 2s infinite ease-in-out;
}
@keyframes alertPulse {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}
