/* Design System - Santander Xtreme 2026 */

:root {
  color-scheme: dark;
  
  /* Vibrant & Sporty Color Palette */
  --bg-main: #060913;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.15);
  
  /* Vibrant Neon Gradients & Colors */
  --accent-neon: #ccff00;      /* Lime/Yellow Neon */
  --accent-neon-hover: #b3df00;
  --accent-orange: #ff5e00;    /* Athletic Orange */
  --accent-pink: #ff007f;      /* Vibrant Pink */
  --accent-blue: #00f2fe;      /* Cyan Neon */
  
  /* Text colors */
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* UI Tokens */
  --gradient-primary: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-pink) 50%, var(--accent-neon) 100%);
  --gradient-dark: linear-gradient(180deg, #111827 0%, #030712 100%);
  --shadow-glow: 0 8px 32px rgba(255, 94, 0, 0.15);
  --shadow-neon: 0 0 15px rgba(204, 255, 0, 0.3);
  --shadow-inset: inset 0 1px 1px rgba(255, 255, 255, 0.05);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-display: 'Outfit', sans-serif;
  --font-sans: 'Plus Jakarta Sans', sans-serif;
}

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

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(255, 94, 0, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(204, 255, 0, 0.05) 0px, transparent 50%),
    radial-gradient(at 50% 0%, rgba(0, 242, 254, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Header Styles */
.main-header {
  border-bottom: 1px solid var(--border-color);
  background: rgba(6, 9, 19, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 0;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge-live {
  background: var(--gradient-primary);
  color: #000;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 1px;
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 94, 0, 0.4); }
  70% { transform: scale(1.03); box-shadow: 0 0 0 8px rgba(255, 94, 0, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 94, 0, 0); }
}

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

.brand-sub {
  color: var(--accent-orange);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 2px;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.5px;
  background: linear-gradient(180deg, #ffffff 30%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

/* Stats Cards */
.stats-dashboard {
  display: flex;
  gap: 12px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-inset);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  min-width: 90px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.card-accent {
  border-color: rgba(204, 255, 0, 0.2);
}

.card-accent .stat-value {
  color: var(--accent-neon);
}

.value-filtered {
  color: var(--accent-blue);
}

/* Mobile navigation tabs (hidden on desktop) */
.mobile-tabs {
  display: none;
}

/* Main App Layout */
.app-layout {
  max-width: 1400px;
  margin: 20px auto;
  padding: 0 20px 20px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  min-height: calc(100vh - 120px);
}

.panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - 125px);
  position: sticky;
  top: 90px;
}

/* Filters Area */
.filters-container {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(17, 24, 39, 0.3);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-box label,
.filter-item label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-secondary);
  pointer-events: none;
}

input[type="search"],
select {
  width: 100%;
  height: 42px;
  background: #0d1222;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 12px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: var(--transition-smooth);
}

input[type="search"] {
  padding-left: 40px;
}

input[type="search"]:focus,
select:focus {
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 3px rgba(255, 94, 0, 0.15);
  background: #11182c;
}

.filter-group {
  display: grid;
  grid-template-columns: 1fr 1fr 120px 42px;
  gap: 10px;
  align-items: flex-end;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.clear-btn {
  width: 42px;
  height: 42px;
  background: #1f2937;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.clear-btn:hover {
  background: var(--accent-orange);
  color: #fff;
  border-color: var(--accent-orange);
  box-shadow: var(--shadow-glow);
}

/* Results Table */
.table-container {
  overflow-y: auto;
  flex-grow: 1;
  position: relative;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #111827;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 13px;
  white-space: nowrap;
  transition: var(--transition-smooth);
}

.col-pos { width: 70px; text-align: center; }
.col-chip { width: 70px; }
.col-name { white-space: normal; font-weight: 600; color: #fff; }
.col-city { white-space: normal; }
.col-cat { white-space: normal; }
.col-time { width: 100px; font-family: var(--font-display); font-weight: 700; color: var(--accent-neon); }
.col-diff { width: 80px; font-family: var(--font-display); color: var(--text-secondary); }

tbody tr {
  cursor: pointer;
  background: transparent;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

tbody tr.active {
  background: rgba(255, 94, 0, 0.08);
  border-left: 3px solid var(--accent-orange);
}

tbody tr.active td {
  color: #fff;
}

tbody tr.active .col-pos {
  color: var(--accent-orange);
  font-weight: 800;
}

tbody tr.no-diploma td.col-name::after {
  content: "SIN DIPLOMA";
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

tr.is-empty td {
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
}

/* Detail & Viewer Panel */
.detail-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

/* Athlete Profile */
.athlete-profile {
  background: rgba(17, 24, 39, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.avatar {
  width: 50px;
  height: 50px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

#athleteInitials {
  color: #000;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
}

.profile-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-badge {
  background: rgba(204, 255, 0, 0.1);
  color: var(--accent-neon);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  align-self: flex-start;
}

.profile-badge.badge-pareja {
  background: rgba(0, 242, 254, 0.1);
  color: var(--accent-blue);
}

.profile-badge.badge-none {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.profile-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.grid-cell {
  background: #090d16;
  border: 1px solid var(--border-color);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.cell-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}

.cell-value {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.highlight-value {
  color: var(--accent-neon);
}

.profile-meta {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.meta-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.meta-value {
  color: #fff;
  font-weight: 600;
  text-align: right;
  max-width: 70%;
}

.profile-actions {
  display: flex;
  gap: 10px;
}

.btn {
  flex: 1;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #000;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow: 0 10px 24px rgba(255, 94, 0, 0.25);
}

.btn-secondary {
  background: #1f2937;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: #374151;
  color: #fff;
  border-color: var(--border-color-hover);
}

.btn[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.35;
  filter: grayscale(1);
}

/* Viewer Frame Shell */
.viewer-shell {
  flex-grow: 1;
  position: relative;
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 250px;
}

#diplomaCanvas {
  width: 100%;
  height: auto;
  display: block;
  max-width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.viewer-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(6, 9, 19, 0.85);
  color: var(--text-secondary);
  gap: 16px;
  border-radius: var(--radius-md);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 94, 0, 0.15);
  border-left-color: var(--accent-orange);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  color: var(--text-secondary);
}

.viewer-shell.has-pdf .empty-state {
  display: none;
}

.empty-icon {
  margin-bottom: 16px;
  color: var(--accent-orange);
  opacity: 0.8;
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 12px;
  max-width: 280px;
  line-height: 1.6;
}

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

::-webkit-scrollbar-track {
  background: #060913;
}

::-webkit-scrollbar-thumb {
  background: #1f2937;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Responsive Styles */
@media (max-width: 1200px) {
  .brand-title { font-size: 20px; }
  .app-layout { grid-template-columns: 1fr; }
  .panel { height: auto; position: static; }
  .table-container { max-height: 450px; }
  iframe { min-height: 500px; }
}

@media (max-width: 768px) {
  body {
    padding-bottom: 60px; /* Space for mobile floating nav/padding */
  }
  
  .header-container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 0 15px;
  }
  
  .logo-area {
    justify-content: center;
  }
  
  .stats-dashboard {
    justify-content: space-between;
  }
  
  .stat-card {
    flex: 1;
    padding: 6px 8px;
    min-width: 0;
  }
  
  .stat-value {
    font-size: 16px;
  }

  /* Mobile Tabs Navigation */
  .mobile-tabs {
    display: flex;
    background: #111827;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 93px; /* Just below header */
    z-index: 99;
  }
  
  .tab-btn {
    flex: 1;
    height: 48px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
  }
  
  .tab-btn.active {
    color: var(--accent-orange);
    border-bottom-color: var(--accent-orange);
    background: rgba(255, 94, 0, 0.03);
  }

  .app-layout {
    margin: 0;
    padding: 10px;
    min-height: 0;
  }
  
  .panel {
    border-radius: var(--radius-md);
    display: none;
    height: auto;
  }
  
  .panel.active {
    display: flex;
  }
  
  .filters-container {
    padding: 12px;
    gap: 12px;
  }
  
  .filter-group {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .clear-btn {
    width: 100%;
    height: 42px;
  }
  
  th, td {
    padding: 10px 8px;
    font-size: 12px;
  }
  
  .col-pos { width: 50px; }
  .col-chip { width: 50px; }
  .col-time { width: 80px; }
  .col-diff { width: 60px; }
  
  .detail-panel {
    padding: 10px;
  }
  
  .profile-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .profile-actions {
    flex-direction: column;
  }
  
  iframe {
    min-height: 460px;
  }
}

.spinner-small {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-left-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

