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

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --border-card: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  
  /* Brand Colors */
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.15);
  --secondary: #a855f7;
  --accent: #ec4899;
  
  /* Status Colors */
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.15);
  
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  overflow-x: hidden;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Typography & Layout */
h1, h2, h3, h4, h5 {
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-card);
}

.logo {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo span {
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-card);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.btn-logout {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-card);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-glow);
}

/* Views & Cards */
.view-section {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0.8;
}

.card-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Forms & Inputs */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input, select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

input:focus, select:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

select option {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.85rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 0.85rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-block {
  display: flex;
  width: 100%;
}

/* Landing Gate Choice */
.gate-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

@media (max-width: 600px) {
  .gate-options {
    grid-template-columns: 1fr;
  }
}

.gate-card {
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-card);
}

.gate-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.15);
}

.gate-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--secondary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Category Grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

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

.category-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}

.category-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

.category-card.selected {
  background: var(--primary-glow);
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.1);
}

.category-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.distance-select {
  margin-top: 1rem;
  width: 100%;
}

/* User Dashboard Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 2rem;
}

@media (max-width: 992px) {
  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.dashboard-main {
  min-width: 0;
}

.profile-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Close button only makes sense inside the mobile/tablet overlay drawer
   (see the @media max-width:992px block below, which reveals it there).
   Without this, an unstyled <button> was stretching full-width due to
   the flex column's default align-items:stretch on the sidebar. */
.profile-close-btn {
  display: none;
}

.profile-card {
  text-align: center;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 800;
  box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

.profile-name {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.profile-email {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.profile-details {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1rem;
  text-align: left;
}

.profile-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.profile-detail-row span:first-child {
  color: var(--text-secondary);
}

/* Connection Badges */
.strava-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

.strava-badge.connected {
  background: var(--success-glow);
  color: var(--success);
  border: 1px solid var(--success);
}

.strava-badge.disconnected {
  background: rgba(240, 90, 40, 0.1);
  color: #f05a28; /* Strava Orange */
  border: 1px solid rgba(240, 90, 40, 0.4);
}

.btn-strava-link {
  background: #f05a28;
  color: white;
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(240, 90, 40, 0.2);
}

.btn-strava-link:hover {
  background: #fc612c;
  transform: translateY(-1px);
}

/* Stats Cards */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 576px) {
  .stats-row {
    grid-template-columns: 1fr;
  }
}

.stat-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
}

.stat-val {
  font-size: 2rem;
  font-family: var(--font-title);
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.stat-lbl {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

/* Verification Checks Badges */
.check-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  text-transform: uppercase;
}

.check-badge.valid {
  background: var(--success-glow);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.check-badge.invalid {
  background: var(--danger-glow);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Leaderboard Filter Panel */
.filter-panel {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-panel select {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* Leaderboard & Activity Tables */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-card);
  border-radius: 10px;
}

/* Mobile Card List (replaces tables on small screens) */
.mobile-card-list {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
}

.activity-card,
.leaderboard-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.activity-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  gap: 0.5rem;
}

.activity-card-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.activity-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 0.75rem;
  font-size: 0.8rem;
  margin-bottom: 0.6rem;
}

/* Each row is a label/value pair of <span>s (Distance, Elapsed time, Speed),
   so target every odd/even child, not :first-child/:last-child -- those
   pseudo-classes only ever match the single true first/last span among
   ALL of them (i.e. just the Speed row), leaving Distance/Elapsed time
   unstyled. */
.activity-card-grid span:nth-child(odd) {
  color: var(--text-secondary);
}

.activity-card-grid span:nth-child(even) {
  text-align: right;
}

.activity-card-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.leaderboard-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.leaderboard-card-rank {
  font-weight: 800;
  font-size: 1.3rem;
  min-width: 32px;
  text-align: center;
}

.leaderboard-card-body {
  flex: 1;
  min-width: 0;
}

.leaderboard-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-card-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.leaderboard-card-stats {
  text-align: right;
  flex-shrink: 0;
}

.leaderboard-card-stat-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-bottom: 0.15rem;
}

.leaderboard-card-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.leaderboard-card-distance {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary);
}

.leaderboard-card-speed {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

@media (max-width: 600px) {
  .table-wrapper {
    display: none;
  }

  .mobile-card-list {
    display: flex;
  }
}

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

th, td {
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-family: var(--font-title);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: var(--transition);
}

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

.rank-column {
  font-weight: 700;
  font-size: 1.1rem;
  text-align: center;
  width: 60px;
}

.rank-1 { color: #f59e0b; }
.rank-2 { color: #94a3b8; }
.rank-3 { color: #b45309; }

/* Dev Simulator Sidebar Drawer */
.dev-drawer {
  position: fixed;
  right: -360px;
  top: 0;
  width: 360px;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-card);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  z-index: 999;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.dev-drawer.open {
  transform: translateX(-360px);
}

.dev-toggle {
  position: absolute;
  left: -48px;
  top: 80px;
  width: 48px;
  height: 48px;
  background: #a855f7;
  color: white;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: -4px 4px 10px rgba(0, 0, 0, 0.25);
  border: none;
}

.dev-header {
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dev-content {
  padding: 1.5rem;
  overflow-y: auto;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dev-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 1rem;
}

.dev-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.dev-tab.active {
  color: var(--secondary);
  border-bottom-color: var(--secondary);
}

.dev-section-pane {
  display: none;
}

.dev-section-pane.active {
  display: block;
}

.mock-email-card {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.mock-email-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
}

.mock-email-body {
  background: #fff;
  color: #333;
  padding: 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
}

/* Tabs switcher in Dashboard */
.tab-nav {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}

.tab-nav::-webkit-scrollbar {
  display: none; /* Safari and Chrome */
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 1rem;
  font-family: var(--font-title);
  font-weight: 600;
  border-radius: 6px 6px 0 0;
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.leaderboard-subtabs {
  overflow-x: auto;
  scrollbar-width: none;
}

.leaderboard-subtabs::-webkit-scrollbar {
  display: none;
}

.subtab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px 6px 0 0;
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}

.subtab-btn.active {
  color: var(--secondary);
  border-bottom-color: var(--secondary);
}

.tab-content {
  display: none;
}

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

/* Mobile Responsive Optimizations */
@media (max-width: 600px) {
  .dev-toggle {
    top: auto;
    bottom: 1rem;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .dev-drawer {
    width: min(320px, 88vw);
    right: calc(-1 * min(320px, 88vw));
  }

  .dev-drawer.open {
    transform: translateX(calc(-1 * min(320px, 88vw)));
  }


  .app-container {
    padding: 1rem 0.75rem;
  }

  header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    margin-bottom: 1.5rem;
    padding-bottom: 0.85rem;
  }

  .logo {
    font-size: 1.1rem;
    flex-direction: row;
    gap: 0.5rem;
  }

  .logo img {
    width: 34px !important;
    height: 34px !important;
    border-radius: 9px !important;
  }

  /* "Athlete Portal" pill is redundant once inside the app — drop it on mobile to keep the header one slim row */
  .logo span {
    display: none;
  }

  .glass-card {
    padding: 1.25rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
  }

  .card-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }

  .profile-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
  }

  .profile-detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 0.5rem;
    margin-bottom: 0;
  }

  .profile-detail-row span:first-child {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  .profile-detail-row span:last-child {
    font-size: 0.85rem;
    font-weight: 500;
  }

  .stats-row {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.5rem !important;
    margin-bottom: 1.5rem;
  }

  .stat-box {
    padding: 0.75rem 0.5rem;
  }

  .stat-val {
    font-size: 1.25rem;
  }

  .stat-lbl {
    font-size: 0.65rem;
    line-height: 1.2;
  }
}

/* Sidebar Drawer & Backdrop for Mobile/Tablet */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  /* No backdrop-filter here on purpose — on some Android Chrome/GPU
     combinations, blurring this dimming overlay ends up visually
     blurring the sidebar drawn in front of it too (a real-device
     compositor bug, not reproducible in desktop/headless testing).
     A plain darkened scrim avoids the bug entirely. */
  background: rgba(0, 0, 0, 0.75);
  z-index: 998;
  animation: fadeIn 0.2s ease forwards;
}

.sidebar-backdrop.active {
  display: block;
}

/* Header icon button that opens the profile/Strava sidebar on mobile & tablet */
.btn-icon-circle {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-card);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon-circle:hover {
  border-color: var(--primary);
  background: var(--primary-glow);
  color: var(--primary);
}

@media (min-width: 993px) {
  /* Sidebar is always visible inline on desktop, so the toggle is redundant */
  #header-profile-btn {
    display: none !important;
  }
}

@media (max-width: 992px) {
  /* The drawer already has a solid background, so the glass blur-behind
     effect has nothing transparent to show through. Drop it here only.
     !important + a forced opaque background because some Android Chrome
     versions retain a stale GPU blur layer on elements nested inside a
     transform-animated ancestor (.profile-sidebar.open below) even after
     backdrop-filter is set back to none. */
  .profile-sidebar .glass-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--bg-secondary) !important;
  }

  .profile-sidebar {
    position: fixed;
    left: -320px; /* Hidden offscreen */
    top: 0;
    width: 300px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-card);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 999;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 3.5rem 1.25rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /* Forces a fresh isolated compositing layer so a blur composited
       elsewhere (e.g. the dark backdrop behind this drawer) can't bleed
       through onto this element's own paint on affected Android/Chrome
       GPU compositors. */
    isolation: isolate;
  }

  .profile-sidebar.open {
    transform: translateX(320px); /* Slide into view */
  }

  .profile-close-btn {
    display: flex !important;
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-card);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition: var(--transition);
  }

  .profile-close-btn:hover {
    background: var(--danger-glow);
    color: var(--danger);
    border-color: var(--danger);
  }

  .profile-sidebar .profile-details {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  .profile-sidebar .profile-detail-row {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding-bottom: 0.5rem !important;
    margin-bottom: 0 !important;
  }

  .profile-sidebar .profile-detail-row span:first-child {
    font-size: 0.85rem !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    color: var(--text-secondary) !important;
  }

  .profile-sidebar .profile-detail-row span:last-child {
    font-size: 0.9rem !important;
    font-weight: 600 !important;
  }
}

