/* ==============================================================================
   PRO CORPORATE LEAGUE - CRICKET BOWLING SPEED ANALYZER
   Aesthetic: White background, navy-blue typography, condensed sports headings,
              light-gray panels, subtle pink/red dashed borders, rounded corners.
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Oswald:wght@500;600;700&display=swap');

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;

  --navy-dark: #0a192f;
  --navy-primary: #0f172a;
  --navy-secondary: #1e293b;
  --navy-light: #334155;
  --navy-accent: #1e3a8a;

  --rose-border: #fda4af;
  --rose-primary: #f43f5e;
  --rose-light: #fff1f2;

  --drs-cyan: #06b6d4;
  --drs-glow: rgba(6, 182, 212, 0.4);

  --success-green: #10b981;
  --success-bg: #ecfdf5;
  --warning-amber: #f59e0b;
  --warning-bg: #fffbeb;
  --danger-red: #ef4444;
  --danger-bg: #fef2f2;

  --border-subtle: #e2e8f0;
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --border-radius-xl: 24px;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Bebas Neue', 'Oswald', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--navy-secondary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   Top Navigation Header
   -------------------------------------------------------------------------- */
.top-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-md);
  background: linear-gradient(135deg, var(--navy-accent), var(--navy-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.25);
}

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

.brand-league {
  font-family: var(--font-heading);
  font-size: 20px;
  letter-spacing: 1.5px;
  color: var(--navy-accent);
  line-height: 1;
}

.brand-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--navy-light);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.header-status-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--navy-secondary);
  border: 1px solid var(--border-subtle);
}

.status-pill.online {
  background: var(--success-bg);
  color: var(--success-green);
  border-color: rgba(16, 185, 129, 0.3);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
}

.status-dot.pulse {
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.header-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--navy-primary);
  padding: 8px 14px;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.header-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--navy-light);
}

/* --------------------------------------------------------------------------
   Main Content Layout
   -------------------------------------------------------------------------- */
.main-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 28px 24px 60px 24px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* --------------------------------------------------------------------------
   Hero Heading Section
   -------------------------------------------------------------------------- */
.hero-section {
  text-align: center;
  padding: 10px 0 6px 0;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 58px;
  letter-spacing: 2px;
  line-height: 0.95;
  color: var(--navy-primary);
  text-transform: uppercase;
}

.hero-title .highlight {
  color: var(--navy-accent);
}

.hero-subtitle {
  font-size: 15px;
  color: var(--navy-light);
  max-width: 680px;
  margin: 10px auto 0 auto;
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   Mode Selector Cards
   -------------------------------------------------------------------------- */
.mode-selector-wrapper {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 4px;
}

.mode-card {
  flex: 1;
  max-width: 380px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 20px 24px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.mode-card:hover {
  border-color: var(--navy-accent);
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.mode-card.active {
  background: #ffffff;
  border-color: var(--navy-accent);
  border-width: 2px;
  box-shadow: var(--shadow-md), 0 0 0 3px rgba(30, 58, 138, 0.12);
}

.mode-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius-md);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--navy-accent);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.mode-card.active .mode-icon {
  background: var(--navy-accent);
  color: #fff;
}

.mode-content h3 {
  font-family: var(--font-heading);
  font-size: 24px;
  letter-spacing: 1px;
  color: var(--navy-primary);
  line-height: 1.1;
  margin-bottom: 4px;
}

.mode-content p {
  font-size: 13px;
  color: var(--navy-light);
  line-height: 1.4;
}

.mode-badge {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 9999px;
  background: var(--bg-tertiary);
  color: var(--navy-light);
}

.mode-card.active .mode-badge {
  background: var(--navy-accent);
  color: #fff;
}

/* --------------------------------------------------------------------------
   Mode Containers
   -------------------------------------------------------------------------- */
.mode-view {
  display: none;
  flex-direction: column;
  gap: 24px;
}

.mode-view.active {
  display: flex;
}

/* --------------------------------------------------------------------------
   Grid Workspaces
   -------------------------------------------------------------------------- */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1080px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   Main Viewport & Canvas Box
   -------------------------------------------------------------------------- */
.viewport-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.viewport-title {
  font-family: var(--font-heading);
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--navy-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.viewport-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-container {
  position: relative;
  background-color: #0b0f19;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--navy-primary);
}

.canvas-container video,
.canvas-container img,
.canvas-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.canvas-overlay {
  z-index: 10;
  pointer-events: auto;
}

/* HUD Overlay on Canvas */
.canvas-hud {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.hud-badge {
  background: rgba(10, 25, 47, 0.85);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 5px 12px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}

.hud-badge.drs {
  border-color: var(--drs-cyan);
  color: var(--drs-cyan);
}

.hud-badge.success {
  border-color: var(--success-green);
  color: #a7f3d0;
}

.hud-badge.warning {
  border-color: var(--warning-amber);
  color: #fde68a;
}

.hud-badge.danger {
  border-color: var(--danger-red);
  color: #fecaca;
}

/* Playback & Frame Scrubber Toolbar */
.playback-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  padding: 10px 16px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-subtle);
}

.scrubber-slider {
  flex: 1;
  accent-color: var(--navy-accent);
  cursor: pointer;
}

.time-readout {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--navy-secondary);
  min-width: 90px;
  text-align: right;
}

/* --------------------------------------------------------------------------
   Light-Gray Upload Card with Pink/Red Dashed Border
   -------------------------------------------------------------------------- */
.upload-card-dashed {
  background-color: var(--bg-secondary);
  border: 2px dashed var(--rose-border);
  border-radius: var(--border-radius-lg);
  padding: 36px 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.upload-card-dashed:hover,
.upload-card-dashed.dragover {
  border-color: var(--rose-primary);
  background-color: var(--rose-light);
  transform: scale(1.005);
}

.upload-icon-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--rose-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--rose-primary);
  box-shadow: 0 4px 10px rgba(244, 63, 94, 0.1);
}

.upload-card-dashed h4 {
  font-family: var(--font-heading);
  font-size: 26px;
  letter-spacing: 1px;
  color: var(--navy-primary);
  line-height: 1;
}

.upload-card-dashed p {
  font-size: 13px;
  color: var(--navy-light);
  max-width: 360px;
}

.upload-specs {
  font-size: 11px;
  font-weight: 600;
  color: var(--navy-light);
  background: #fff;
  padding: 4px 12px;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
}

/* Sample Videos Quick Picker */
.sample-videos-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-subtle);
}

.sample-videos-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--navy-secondary);
}

.sample-chip {
  background: #fff;
  border: 1px solid var(--border-subtle);
  color: var(--navy-accent);
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.sample-chip:hover {
  background: var(--navy-accent);
  color: #fff;
  border-color: var(--navy-accent);
}

/* --------------------------------------------------------------------------
   Side Control & Calibration Panels
   -------------------------------------------------------------------------- */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.panel-title {
  font-family: var(--font-heading);
  font-size: 20px;
  letter-spacing: 0.8px;
  color: var(--navy-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Telemetry Key-Value Rows */
.telemetry-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.telemetry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-subtle);
}

.telemetry-row:last-child {
  border-bottom: none;
}

.telemetry-label {
  color: var(--navy-light);
  font-weight: 500;
}

.telemetry-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--navy-primary);
}

.telemetry-val.success {
  color: var(--success-green);
}

.telemetry-val.warning {
  color: var(--warning-amber);
}

.telemetry-val.danger {
  color: var(--danger-red);
}

/* Action Buttons */
.btn-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  width: 100%;
  padding: 12px 18px;
  border-radius: var(--border-radius-md);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--navy-primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
}

.btn-primary:hover {
  background: var(--navy-accent);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(30, 58, 138, 0.25);
}

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

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--navy-light);
}

.btn-success {
  background: var(--success-green);
  color: #fff;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
  background: #059669;
}

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

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

/* --------------------------------------------------------------------------
   Speed Dashboard & Quality Badges
   -------------------------------------------------------------------------- */
.speed-hero-card {
  background: linear-gradient(135deg, var(--navy-primary), #0a192f);
  color: #fff;
  border-radius: var(--border-radius-lg);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.speed-title {
  font-family: var(--font-heading);
  font-size: 18px;
  letter-spacing: 1.5px;
  color: #94a3b8;
  text-transform: uppercase;
}

.speed-readout {
  font-family: var(--font-mono);
  font-size: 72px;
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
  letter-spacing: -2px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}

.speed-unit {
  font-family: var(--font-heading);
  font-size: 26px;
  letter-spacing: 1px;
  color: var(--drs-cyan);
}

.speed-submetrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.submetric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.submetric-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
}

.submetric-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}

.measurement-pill {
  padding: 6px 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.measurement-pill.measured {
  background: var(--success-green);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.measurement-pill.not-measured {
  background: var(--danger-red);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Progress Bar & Stage Tracker
   -------------------------------------------------------------------------- */
.progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress-stage-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--navy-primary);
}

.progress-pct-readout {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--navy-accent);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--navy-accent), var(--rose-primary));
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* --------------------------------------------------------------------------
   Analysis Results Media Tabs
   -------------------------------------------------------------------------- */
.results-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tabs-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid var(--border-subtle);
  padding-bottom: 4px;
}

.tab-btn {
  background: none;
  border: none;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  color: var(--navy-light);
  padding: 8px 16px;
  border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--navy-primary);
}

.tab-btn.active {
  color: var(--navy-accent);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--navy-accent);
  border-radius: 3px 3px 0 0;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.video-player-frame {
  width: 100%;
  border-radius: var(--border-radius-md);
  background: #000;
  max-height: 520px;
}

.downloads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.download-tile {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  text-decoration: none;
  color: var(--navy-primary);
  transition: all 0.2s ease;
}

.download-tile:hover {
  background: #ffffff;
  border-color: var(--navy-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.download-icon {
  font-size: 28px;
  color: var(--navy-accent);
}

/* --------------------------------------------------------------------------
   Modal Window
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--border-radius-lg);
  max-width: 560px;
  width: 90%;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.modal-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--navy-light);
}
