/* Athlete Analyzer Professional UI - Mobile-First Design */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-2: #fbfcfe;
  --text: #0f172a;
  --text-muted: #475569;
  --text-faint: #64748b;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --pad: 20px;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #111827;
  --danger: #dc2626;
  --success: #16a34a;

  --whiteSide: #ffffff;
  --blueSide: #2563eb;
  --blueSide-light: #eff6ff;

  --sidebar-width: 260px;
  --header-height: 64px;
}

* { box-sizing: border-box; }
html, body { 
  height: 100%; 
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  font-size: 14px;
}

a { 
  color: var(--primary); 
  text-decoration: none; 
  transition: color 0.2s ease;
}
a:hover { 
  color: var(--primary-hover);
  text-decoration: underline; 
}

/* Layout Structure */
.app-layout {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 var(--pad);
  gap: 20px;
}

.app-header__logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.app-header__logo:hover {
  text-decoration: none;
}

.app-header__logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 900;
  font-size: 18px;
}

.app-header__nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--text);
  font-size: 20px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.app-header__nav-toggle:hover {
  background: var(--bg);
}

.app-header__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header__user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.app-header__user-badge {
  background: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
}

/* Main Content Area */
.app-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s ease;
  position: relative;
}

.app-sidebar__nav {
  padding: 20px 0;
}

.app-sidebar__section {
  margin-bottom: 24px;
}

.app-sidebar__section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 0 var(--pad);
  margin-bottom: 8px;
}

.app-sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--pad);
  color: var(--text);
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.app-sidebar__link:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  text-decoration: none;
}

.app-sidebar__link.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

.app-sidebar__link-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.app-sidebar__link-text {
  flex: 1;
}

/* Content Area */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--pad);
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Page Header */
.page-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header__title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.page-header__subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.page-header__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

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

.card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

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

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

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

.row {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

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

/* Typography */
h1, h2, h3, h4 {
  letter-spacing: -0.02em;
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 800;
}

h2 {
  font-size: 20px;
  font-weight: 700;
}

h3 {
  font-size: 16px;
  font-weight: 600;
}

p { 
  margin: 12px 0; 
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.muted { 
  color: var(--text-muted); 
}

/* Form Elements */
input[type="text"],
input[type="number"],
input[type="url"],
input[type="email"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

textarea { 
  min-height: 110px; 
  resize: vertical; 
}

input:focus, 
select:focus, 
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: #fff;
}

::placeholder { 
  color: var(--text-faint); 
}

/* Buttons */
button, .btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

button:active, .btn:active { 
  transform: translateY(1px); 
}

button {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

button:hover { 
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

button.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
  box-shadow: none;
}

button.secondary:hover { 
  background: var(--bg);
  border-color: var(--border-2);
}

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

button.danger:hover { 
  background: #b91c1c;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Badges & Pills */
.badge, .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
}

.badge { 
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-light);
}

/* Tables */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.table thead th {
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

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

.table tbody tr:last-child td { 
  border-bottom: 0; 
}

.table tbody tr:hover td { 
  background: var(--primary-light);
}

/* Timeline */
.timeline { 
  margin-top: 20px; 
}

.trow {
  display: grid;
  grid-template-columns: 1fr 100px 1fr;
  gap: 16px;
  align-items: stretch;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.tcell { 
  min-height: 50px; 
  display: flex; 
  align-items: center; 
}

.tstamp {
  justify-content: center;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.tstamp:hover { 
  background: var(--primary-light);
  text-decoration: none;
}

.cardbox {
  width: 100%;
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
  background: #fff;
  position: relative;
}

.cardbox.white {
  background: #fff;
}

.cardbox.blue {
  background: var(--blueSide-light);
  border-color: rgba(37, 99, 235, 0.3);
}

.cardbox .big {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 6px;
  color: var(--accent);
}

.cardbox .sub {
  font-size: 14px;
  color: var(--text-muted);
}

/* Fighter Bars */
.fighterbar { 
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: 16px; 
  margin-top: 16px; 
}

.fighter {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  background: #fff;
}

.fighter .name { 
  font-size: 16px; 
  font-weight: 700;
}

.fighter .side {
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--bg);
  color: var(--text);
  text-transform: uppercase;
}

.fighter.blue {
  border-color: rgba(37, 99, 235, 0.3);
  background: var(--blueSide-light);
}

.fighter.blue .side {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Video */
video {
  border-radius: var(--radius);
  background: #000;
  width: 100%;
}

/* Dialogs */
dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  max-width: 600px;
  width: 90vw;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  :root {
    --pad: 16px;
  }

  .app-header {
    padding: 0 16px;
  }

  .app-header__nav-toggle {
    display: block;
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    transform: translateX(-100%);
    z-index: 90;
    box-shadow: var(--shadow);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-content {
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header__actions {
    width: 100%;
  }

  .page-header__actions button {
    flex: 1;
  }

  .trow {
    grid-template-columns: 1fr 80px 1fr;
    gap: 12px;
  }

  .fighterbar {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 16px;
  }

  h1 {
    font-size: 24px;
  }

  .app-header__user {
    font-size: 12px;
    padding: 4px 8px;
  }

  .app-header__user-badge {
    font-size: 10px;
    padding: 2px 6px;
  }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 8px; }
.mb-1 { margin-bottom: 8px; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }

hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

small { 
  color: var(--text-faint); 
  font-size: 12px;
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state__icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state__title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.empty-state__text {
  font-size: 14px;
  color: var(--text-muted);
}
