/* ================================
   PAEZ SPORT — APP STYLES
   (Login, Dashboard, Coach Panel)
================================ */

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

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

:root {
  --bg-base:       #08090e;
  --bg-surface:    #0f1117;
  --bg-card:       #13151f;
  --bg-card-hover: #181b27;
  --border:        rgba(255,255,255,0.07);
  --border-bright: rgba(255,255,255,0.13);
  --cyan:          #00d4ff;
  --cyan-dim:      rgba(0,212,255,0.10);
  --cyan-glow:     rgba(0,212,255,0.25);
  --orange:        #ff6b2b;
  --orange-dim:    rgba(255,107,43,0.12);
  --green:         #22c55e;
  --green-dim:     rgba(34,197,94,0.12);
  --red:           #ef4444;
  --red-dim:       rgba(239,68,68,0.12);
  --text-primary:  #f0f2f8;
  --text-secondary:#8b92a8;
  --text-muted:    #4a5168;
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --font-body:  'Inter', sans-serif;
  --font-head:  'Space Grotesk', sans-serif;
  --nav-h: 64px;
  --sidebar-w: 260px;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img { display: block; max-width: 100%; }
a  { text-decoration: none; color: inherit; }
ul { list-style: none; }
input, textarea, select, button { font-family: var(--font-body); }

.gradient-text {
  background: linear-gradient(90deg, var(--cyan) 0%, #7b9cff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ================================
   BUTTONS
================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  white-space: nowrap;
}
.btn--primary {
  background: linear-gradient(135deg, var(--cyan), #0099cc);
  color: #08090e;
  box-shadow: 0 0 20px var(--cyan-glow);
}
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 0 32px rgba(0,212,255,0.4); }
.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-bright);
}
.btn--ghost:hover { background: var(--bg-card); color: var(--text-primary); }
.btn--danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.25);
}
.btn--sm { padding: 7px 14px; font-size: 13px; }
.btn--full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ================================
   FORM ELEMENTS
================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-input {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color 0.2s;
  width: 100%;
}
.form-input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.08);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input.error { border-color: var(--red); }
textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input { cursor: pointer; }

/* ================================
   APP NAV
================================ */
.app-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(8,9,14,0.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 200;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}
.app-nav__logo { height: 30px; width: auto; }
.app-nav__title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}
.app-nav__spacer { flex: 1; }
.app-nav__user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}
.app-nav__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cyan-dim);
  border: 1px solid rgba(0,212,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
}
.app-nav__plan-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 99px;
}
.badge--basico { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(0,212,255,0.2); }
.badge--pro    { background: var(--orange-dim); color: var(--orange); border: 1px solid rgba(255,107,43,0.25); }
.badge--coach  { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,0.25); }

/* ================================
   SIDEBAR
================================ */
.app-layout {
  display: flex;
  padding-top: var(--nav-h);
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 100;
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar__section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 12px 8px;
  margin-top: 8px;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.sidebar__link:hover { background: var(--bg-card); color: var(--text-primary); }
.sidebar__link.active { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(0,212,255,0.15); }
.sidebar__link svg { flex-shrink: 0; }
.sidebar__spacer { flex: 1; }
.sidebar__logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 8px;
}
.sidebar__logout:hover { color: var(--red); background: var(--red-dim); }

/* ================================
   MAIN CONTENT
================================ */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px 32px 64px;
  min-width: 0;
}
.page-header { margin-bottom: 28px; }
.page-title {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* ================================
   CARDS & SECTIONS
================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}
.card__title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card__title .icon {
  width: 28px;
  height: 28px;
  background: var(--cyan-dim);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  flex-shrink: 0;
}

/* ================================
   STATS GRID
================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}
.stat-card__label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.stat-card__value {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card__delta {
  font-size: 12px;
  font-weight: 500;
}
.stat-card__delta.up { color: var(--green); }
.stat-card__delta.down { color: var(--red); }
.stat-card__delta.neutral { color: var(--text-muted); }

/* ================================
   GRID LAYOUTS
================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ================================
   TABLE
================================ */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 12px; color: var(--text-secondary); }
tbody td.highlight { color: var(--text-primary); font-weight: 600; }
.pb-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--orange);
  background: var(--orange-dim);
  border: 1px solid rgba(255,107,43,0.25);
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: 6px;
}

/* ================================
   PROGRESS BAR
================================ */
.progress-bar-wrap { display: flex; flex-direction: column; gap: 10px; }
.progress-item { display: flex; flex-direction: column; gap: 6px; }
.progress-item__header { display: flex; justify-content: space-between; font-size: 13px; }
.progress-item__label { color: var(--text-secondary); }
.progress-item__value { color: var(--text-primary); font-weight: 600; }
.progress-bar {
  height: 6px;
  background: var(--bg-surface);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), #7b9cff);
  border-radius: 99px;
  transition: width 0.6s ease;
}

/* ================================
   RPE / WELLNESS SCALE
================================ */
.scale-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.scale-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-bright);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scale-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.scale-btn.selected { background: var(--cyan); color: #08090e; border-color: var(--cyan); box-shadow: 0 0 12px var(--cyan-glow); }

/* ================================
   QUESTIONS / CHAT STYLE
================================ */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 12px;
}
.question-card.unanswered { border-left: 3px solid var(--orange); }
.question-card.answered   { border-left: 3px solid var(--green); }
.question-card__meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.question-card__text {
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 12px;
  font-weight: 500;
}
.question-card__response {
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 10px;
  border-left: 2px solid var(--cyan);
}
.question-card__response-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cyan);
  margin-bottom: 6px;
}

/* ================================
   ATHLETE LIST (COACH)
================================ */
.athlete-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.athlete-row:hover { background: var(--bg-card-hover); }
.athlete-row:last-child { border-bottom: none; }
.athlete-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--cyan-dim);
  border: 1px solid rgba(0,212,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--cyan);
  flex-shrink: 0;
}
.athlete-info { flex: 1; min-width: 0; }
.athlete-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.athlete-meta { font-size: 12px; color: var(--text-muted); }
.athlete-badge { flex-shrink: 0; }

/* ================================
   NOTIFICATIONS / ALERTS
================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert--success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.alert--error   { background: var(--red-dim);   color: var(--red);   border: 1px solid rgba(239,68,68,0.2); }
.alert--info    { background: var(--cyan-dim);   color: var(--cyan);  border: 1px solid rgba(0,212,255,0.2); }

/* ================================
   LOADING / EMPTY STATES
================================ */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
  gap: 16px;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-bright);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state__icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

/* ================================
   TABS
================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ================================
   MODAL
================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal__title { font-family: var(--font-head); font-size: 17px; font-weight: 600; }
.modal__close {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.15s;
}
.modal__close:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.modal__body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal__footer { padding: 0 24px 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* ================================
   LOGIN PAGE
================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 30% 20%, rgba(0,212,255,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 70% 80%, rgba(255,107,43,0.04) 0%, transparent 60%);
  pointer-events: none;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
}
.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}
.auth-logo img { height: 42px; width: auto; }
.auth-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}
.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 32px;
}
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 20px;
}
.auth-switch a { color: var(--cyan); cursor: pointer; }
.auth-switch a:hover { text-decoration: underline; }
.auth-error {
  padding: 10px 14px;
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--red);
  display: none;
}
.auth-error.show { display: block; }

/* ================================
   CHART CONTAINER
================================ */
.chart-container {
  position: relative;
  height: 220px;
}

/* ================================
   DISTANCE BADGE
================================ */
.dist-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.dist-badge--sprint  { background: rgba(255,107,43,0.12); color: var(--orange); border: 1px solid rgba(255,107,43,0.25); }
.dist-badge--middle  { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(0,212,255,0.2); }
.dist-badge--long    { background: rgba(123,156,255,0.12); color: #7b9cff; border: 1px solid rgba(123,156,255,0.25); }

/* ================================
   RESPONSIVE
================================ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-260px); width: 260px; transition: transform 0.25s; }
  .sidebar.mobile-open { transform: translateX(0); }
  .app-main { margin-left: 0; padding: 20px 16px 48px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .app-nav__menu-btn { display: flex !important; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
}

/* Mobile sidebar toggle */
.app-nav__menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
}
