/* ==========================================================================
   LupoTrail Athlete Portal & Rides Telemetry Hub Stylesheet
   Theme: Canyon Clay & Charcoal Glassmorphism
   ========================================================================== */

/* ── Top Bar & Breadcrumb ── */
.portal-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(22, 20, 19, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(224, 99, 67, 0.18);
  padding: 14px 0;
}

.portal-nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.portal-tag {
  background: rgba(224, 99, 67, 0.15);
  border: 1px solid rgba(224, 99, 67, 0.35);
  color: var(--terracotta-light);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.portal-user-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-stone);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--terracotta);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

/* ── Lifetime Summary Hero ── */
.dashboard-hero {
  padding: 40px 0 20px;
}

.dashboard-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.dashboard-heading {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
}

.dashboard-heading span {
  color: var(--terracotta);
}

.dashboard-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

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

/* ── Lifetime Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(250, 247, 244, 0.08);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(224, 99, 67, 0.5), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(224, 99, 67, 0.3);
  box-shadow: 0 10px 25px -8px rgba(0, 0, 0, 0.6);
}

.stat-card:hover::after {
  opacity: 1;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-val {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 4px;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Backup Import Dropzone Banner ── */
.backup-dropzone {
  background: rgba(34, 30, 28, 0.65);
  border: 2px dashed rgba(224, 99, 67, 0.35);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-bottom: 30px;
  position: relative;
}

.backup-dropzone.drag-active {
  border-color: var(--terracotta);
  background: rgba(224, 99, 67, 0.12);
  transform: scale(1.008);
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.dropzone-icon {
  font-size: 32px;
  margin-bottom: 2px;
}

.dropzone-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.dropzone-desc {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 540px;
}

.dropzone-pills {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.format-pill {
  background: rgba(250, 247, 244, 0.06);
  border: 1px solid rgba(250, 247, 244, 0.1);
  color: var(--sand-dune);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: monospace;
}

/* ── Main Workspace: 2-Column Split View ── */
.workspace-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  margin-bottom: 60px;
  align-items: start;
}

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

/* ── Left Column: Activities List & Filters ── */
.activities-panel {
  background: var(--bg-card);
  border: 1px solid rgba(250, 247, 244, 0.08);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  max-height: 860px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.count-chip {
  background: rgba(224, 99, 67, 0.15);
  color: var(--terracotta-light);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.search-input-wrap {
  position: relative;
  margin-bottom: 12px;
}

.search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-dark);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 10px 14px 10px 36px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  border-color: var(--terracotta);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
}

/* Sport Filter Tabs */
.filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 12px;
  scrollbar-width: thin;
}

.filter-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-dark);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.filter-btn.active, .filter-btn:hover {
  background: rgba(224, 99, 67, 0.2);
  border-color: var(--terracotta);
  color: var(--text-primary);
}

/* Activity Items Scroll List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
  max-height: 640px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-stone) transparent;
}

.activity-card {
  background: var(--bg-surface);
  border: 1px solid rgba(250, 247, 244, 0.06);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.activity-card:hover {
  background: var(--bg-surface-elevated);
  border-color: rgba(224, 99, 67, 0.25);
  transform: translateX(2px);
}

.activity-card.selected {
  border-color: var(--terracotta);
  background: rgba(224, 99, 67, 0.08);
  box-shadow: 0 4px 18px -4px rgba(224, 99, 67, 0.2);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-sport-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--sand-dune);
}

.card-date {
  font-size: 11px;
  color: var(--text-muted);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.25;
}

.card-metrics-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid rgba(250, 247, 244, 0.05);
  padding-top: 8px;
}

.card-metric-item {
  display: flex;
  flex-direction: column;
}

.card-metric-val {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-primary);
  font-size: 13px;
}

.card-metric-lbl {
  font-size: 10px;
  color: var(--text-muted);
}

/* ── Right Column: Telemetry & Interactive Map Inspection ── */
.telemetry-panel {
  background: var(--bg-card);
  border: 1px solid rgba(250, 247, 244, 0.08);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.telemetry-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  border-bottom: 1px solid rgba(250, 247, 244, 0.08);
  padding-bottom: 18px;
}

.telemetry-title-block {
  flex: 1;
  min-width: 240px;
}

.telemetry-sport-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(224, 99, 67, 0.15);
  border: 1px solid rgba(224, 99, 67, 0.3);
  color: var(--terracotta-light);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.telemetry-title {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.telemetry-time-stamp {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

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

/* Interactive Leaflet Map Box */
.map-container {
  height: 380px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-dark);
  position: relative;
  background: #11100f;
}

#routeMap {
  width: 100%;
  height: 100%;
  background: #11100f;
}

.map-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  color: var(--text-muted);
  gap: 8px;
}

/* Elevation Chart Card */
.chart-card {
  background: var(--bg-surface);
  border: 1px solid rgba(250, 247, 244, 0.08);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.chart-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-stats-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.canvas-chart-wrap {
  width: 100%;
  height: 170px;
  position: relative;
}

.canvas-chart-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Telemetry Curves Tabs & View */
.telemetry-tabs-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-dark);
  padding-bottom: 8px;
}

.tel-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tel-tab-btn.active {
  background: rgba(224, 99, 67, 0.15);
  color: var(--terracotta-light);
}

/* Deep Metrics Grid */
.metrics-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.detail-metric-box {
  background: var(--bg-surface);
  border: 1px solid rgba(250, 247, 244, 0.05);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.detail-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.detail-val {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.detail-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Buttons */
.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

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

.btn-terracotta:hover {
  background: var(--terracotta-dark);
  box-shadow: 0 4px 15px var(--terracotta-glow);
}

.btn-dark {
  background: var(--bg-surface);
  border: 1px solid var(--border-stone);
  color: var(--text-primary);
}

.btn-dark:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--terracotta);
}

.btn-danger {
  background: rgba(224, 72, 72, 0.15);
  border: 1px solid rgba(224, 72, 72, 0.35);
  color: #f87171;
}

.btn-danger:hover {
  background: rgba(224, 72, 72, 0.25);
}

/* ── Modal Dialogs ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid rgba(224, 99, 67, 0.25);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 28px;
  box-shadow: var(--shadow-hud);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-overlay.open .modal-box {
  transform: translateY(0);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  border-color: var(--terracotta);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* Toast Notifications */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--terracotta);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-msg.show {
  transform: translateY(0);
  opacity: 1;
}
