/* Swimming Academy — refined design system */

[x-cloak] {
  display: none !important;
}

:root {
  --bg-gradient-start: #dbeafe;
  --bg-gradient-mid: #ecfeff;
  --bg-gradient-end: #f0fdfa;
  --orb-1: rgba(14, 165, 233, 0.18);
  --orb-2: rgba(20, 184, 166, 0.12);
  --orb-3: rgba(6, 182, 212, 0.14);
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(14, 165, 233, 0.14);
  --shadow-soft: 0 2px 8px -2px rgba(15, 23, 42, 0.06), 0 16px 40px -12px rgba(14, 165, 233, 0.14);
  --shadow-elevated: 0 25px 50px -12px rgba(15, 23, 42, 0.12);
  --radius-card: 1.25rem;
}

html.dark {
  --bg-gradient-start: #0a0f1a;
  --bg-gradient-mid: #0f172a;
  --bg-gradient-end: #0c4a6e;
  --orb-1: rgba(34, 211, 238, 0.08);
  --orb-2: rgba(45, 212, 191, 0.06);
  --orb-3: rgba(56, 189, 248, 0.07);
  --glass-bg: rgba(15, 23, 42, 0.72);
  --glass-border: rgba(34, 211, 238, 0.12);
  --shadow-soft: 0 2px 12px -2px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(34, 211, 238, 0.05);
  --shadow-elevated: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
}

body.page-bg {
  background: linear-gradient(
    165deg,
    var(--bg-gradient-start) 0%,
    var(--bg-gradient-mid) 42%,
    var(--bg-gradient-end) 100%
  );
  background-attachment: fixed;
  min-height: 100vh;
}

/* Ambient mesh — fixed behind UI */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-mesh::before {
  content: "";
  position: absolute;
  width: 140%;
  height: 60%;
  top: -20%;
  inset-inline-start: -20%;
  background: radial-gradient(ellipse 80% 60% at 70% 20%, var(--orb-1), transparent 55%);
}

.bg-mesh::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 70%;
  bottom: -10%;
  inset-inline-end: -15%;
  background: radial-gradient(ellipse 70% 50% at 80% 80%, var(--orb-2), transparent 50%),
    radial-gradient(ellipse 50% 40% at 15% 60%, var(--orb-3), transparent 45%);
}

/* Subtle grid overlay */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(14, 165, 233, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 165, 233, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 85% 70% at 50% 40%, black 20%, transparent 75%);
}

html.dark .bg-grid {
  background-image: linear-gradient(rgba(34, 211, 238, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.035) 1px, transparent 1px);
}

.app-shell {
  position: relative;
  z-index: 1;
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(1.35);
  -webkit-backdrop-filter: blur(24px) saturate(1.35);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius-card);
}

.glass-panel-tight {
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
}

.card-hover {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-elevated);
}

/* Stat / KPI card */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  opacity: 0.95;
}

.stat-accent-sky::before {
  background: linear-gradient(90deg, #0ea5e9, #22d3ee);
}
.stat-accent-teal::before {
  background: linear-gradient(90deg, #14b8a6, #2dd4bf);
}
.stat-accent-amber::before {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}
.stat-accent-rose::before {
  background: linear-gradient(90deg, #f43f5e, #fb7185);
}
.stat-accent-violet::before {
  background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}
.stat-accent-emerald::before {
  background: linear-gradient(90deg, #10b981, #34d399);
}
.stat-accent-cyan::before {
  background: linear-gradient(90deg, #06b6d4, #22d3ee);
}

.section-eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgb(14 165 233 / 0.85);
}

html.dark .section-eyebrow {
  color: rgb(34 211 238 / 0.85);
}

/* Forms */
.form-input {
  width: 100%;
  border-radius: 0.875rem;
  border: 1px solid rgb(226 232 240);
  background: rgb(255 255 255);
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: rgb(14 165 233 / 0.55);
  box-shadow: 0 0 0 3px rgb(14 165 233 / 0.18);
}

html.dark .form-input {
  border-color: rgb(255 255 255 / 0.1);
  background: rgb(15 23 42 / 0.85);
  color: #f1f5f9;
}

html.dark .form-input:focus {
  border-color: rgb(34 211 238 / 0.45);
  box-shadow: 0 0 0 3px rgb(34 211 238 / 0.12);
}

.kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: rgb(100 116 139);
}

html.dark .kbd-hint {
  color: rgb(148 163 184);
}

.kbd-key {
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  border: 1px solid rgb(203 213 225);
  background: rgb(248 250 252);
  font-family: ui-monospace, monospace;
}

html.dark .kbd-key {
  border-color: rgb(51 65 85);
  background: rgb(30 41 59 / 0.8);
}

/* Nav */
.nav-pill {
  position: relative;
  transition: background 0.2s, color 0.2s;
}

.nav-pill-active {
  background: linear-gradient(135deg, rgb(14 165 233 / 0.14), rgb(6 182 212 / 0.1)) !important;
  color: rgb(3 105 161) !important;
  box-shadow: inset 0 0 0 1px rgb(14 165 233 / 0.2);
}

html.dark .nav-pill-active {
  background: linear-gradient(135deg, rgb(34 211 238 / 0.12), rgb(6 182 212 / 0.08)) !important;
  color: rgb(165 243 252) !important;
  box-shadow: inset 0 0 0 1px rgb(34 211 238 / 0.15);
}

.nav-indicator {
  position: absolute;
  top: 50%;
  inset-inline-start: 0;
  width: 3px;
  height: 60%;
  border-radius: 0 4px 4px 0;
  transform: translateY(-50%) scaleY(0);
  background: linear-gradient(180deg, #0ea5e9, #06b6d4);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

html.dark .nav-indicator {
  background: linear-gradient(180deg, #22d3ee, #14b8a6);
}

.nav-pill-active .nav-indicator {
  transform: translateY(-50%) scaleY(1);
}

/* Tabs — segment control */
.segment-tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 0.875rem;
  background: rgb(15 23 42 / 0.04);
  border: 1px solid rgb(255 255 255 / 0.35);
}

html.dark .segment-tabs {
  background: rgb(0 0 0 / 0.25);
  border-color: rgb(255 255 255 / 0.06);
}

.segment-tab {
  padding: 0.4rem 0.85rem;
  border-radius: 0.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgb(100 116 139);
  transition: background 0.2s, color 0.2s;
}

.segment-tab:hover {
  color: rgb(51 65 85);
}

html.dark .segment-tab {
  color: rgb(148 163 184);
}

html.dark .segment-tab:hover {
  color: rgb(226 232 240);
}

.segment-tab-active {
  background: rgb(255 255 255 / 0.95);
  color: rgb(3 105 161) !important;
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.08);
}

html.dark .segment-tab-active {
  background: rgb(30 41 59 / 0.95);
  color: rgb(103 232 249) !important;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.2);
}

/* Chart card chrome */
.chart-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.pill-muted {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  background: rgb(14 165 233 / 0.08);
  color: rgb(3 105 161);
}

html.dark .pill-muted {
  background: rgb(34 211 238 / 0.1);
  color: rgb(165 243 252);
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.12) 25%,
    rgba(148, 163, 184, 0.22) 50%,
    rgba(148, 163, 184, 0.12) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 0.75rem;
}

html.dark .skeleton {
  background: linear-gradient(
    90deg,
    rgba(51, 65, 85, 0.35) 25%,
    rgba(71, 85, 105, 0.5) 50%,
    rgba(51, 65, 85, 0.35) 75%
  );
  background-size: 200% 100%;
}

@keyframes glow-success {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4), 0 0 28px rgba(34, 197, 94, 0.2);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12), 0 0 40px rgba(34, 197, 94, 0.35);
  }
}

.glow-success {
  animation: glow-success 2.2s ease-in-out infinite;
}

@keyframes pulse-danger {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.32);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.1), 0 0 24px rgba(239, 68, 68, 0.22);
  }
}

.glow-danger {
  animation: pulse-danger 1.6s ease-in-out infinite;
}

.page-enter {
  animation: pageIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast-enter {
  animation: toastIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

html.dark .modal-backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.modal-panel {
  animation: modalIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.barcode-input:focus {
  outline: none;
  border-color: rgba(14, 165, 233, 0.55);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);
}

.scrollbar-thin {
  scrollbar-width: thin;
  scrollbar-color: rgba(14, 165, 233, 0.3) transparent;
}

.scrollbar-thin::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
  background: rgba(14, 165, 233, 0.35);
  border-radius: 999px;
}

html.dark .scrollbar-thin::-webkit-scrollbar-thumb {
  background: rgba(34, 211, 238, 0.25);
}

/* Activity list row */
.activity-row {
  transition: background 0.2s, transform 0.2s;
}

.activity-row:hover {
  transform: translateX(-2px);
}

html[dir="rtl"] .activity-row:hover {
  transform: translateX(2px);
}
