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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body, 'DM Sans', sans-serif);
  background: var(--bg, #0d0f14);
  color: var(--text, #f0f2f7);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Loading ─────────────────────────────────── */
.app-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
}

.spinner-fullscreen {
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border, #252836);
  border-top-color: var(--primary-color, #00d4aa);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  border-radius: var(--radius-sm, 8px);
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: 0.01em;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--primary-color, #00d4aa);
  color: #0d0f14;
}
.btn-primary:hover:not(:disabled) { opacity: 0.88; }

.btn-ghost {
  background: transparent;
  color: var(--muted, #6b7694);
  border: 1px solid var(--border, #252836);
}
.btn-ghost:hover:not(:disabled) { color: var(--text, #f0f2f7); border-color: var(--text2, #c8ccd8); }

.btn-full { width: 100%; }

.btn-icon {
  background: none;
  border: none;
  color: var(--muted, #6b7694);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm, 8px);
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
.btn-icon:hover {
  color: var(--text, #f0f2f7);
  background: rgba(255,255,255,0.06);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--muted, #6b7694);
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  margin-bottom: 24px;
  transition: color 0.15s;
}
.btn-back:hover { color: var(--text, #f0f2f7); }

/* ── Forms ───────────────────────────────────── */
.form-error {
  background: rgba(255,77,79,0.1);
  border: 1px solid rgba(255,77,79,0.3);
  color: var(--danger, #ff4d4f);
  border-radius: var(--radius-sm, 8px);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ── Error / Empty ───────────────────────────── */
.powered-by {
  font-size: 12px;
  color: var(--muted, #6b7694);
  letter-spacing: 0.03em;
}
.powered-by strong {
  color: var(--primary-color, #00d4aa);
  font-weight: 700;
}

.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  text-align: center;
  padding: 40px 24px;
  gap: 16px;
}
.error-page h1 {
  font-family: var(--font-heading, 'Barlow Condensed', sans-serif);
  font-size: 72px;
  font-weight: 800;
  color: var(--primary-color, #00d4aa);
  opacity: 0.25;
  line-height: 1;
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted, #6b7694);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-sub { font-size: 14px; margin-top: 6px; }

/* ── Lang bar / switcher ─────────────────────── */
.lang-bar, .lang-switcher {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.lang-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border, #252836);
  background: transparent;
  color: var(--muted, #6b7694);
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s;
}
.lang-btn:hover { color: var(--text, #f0f2f7); border-color: var(--text2, #c8ccd8); }
.lang-btn.active {
  background: var(--primary-color, #00d4aa);
  border-color: var(--primary-color, #00d4aa);
  color: #0d0f14;
}

/* ── Tags ────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: capitalize;
  background: rgba(255,255,255,0.06);
  color: var(--muted, #6b7694);
  border: 1px solid rgba(255,255,255,0.07);
}

/* ════════════════════════════════════════════
   TRAINER PROFILE PAGE
   ════════════════════════════════════════════ */
.profile-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
  padding: 0 20px;
  /* subtle noise texture */
  background-image: radial-gradient(ellipse at 60% 0%, rgba(0,212,170,0.05) 0%, transparent 60%);
}

.profile-header {
  text-align: center;
  padding: 64px 0 36px;
  max-width: 420px;
  width: 100%;
  animation: fadeUp 0.5s ease both;
}

.profile-avatar-wrap {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border, #252836);
  box-shadow: 0 0 0 6px rgba(0,212,170,0.06);
}

.profile-initials {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color, #00d4aa), var(--accent-color, #ff7849));
  color: #0d0f14;
  font-size: 30px;
  font-weight: 800;
  font-family: var(--font-heading, 'Barlow Condensed', sans-serif);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.03em;
}

.profile-name {
  font-family: var(--font-heading, 'Barlow Condensed', sans-serif);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin-bottom: 10px;
}

.profile-bio {
  color: var(--text2, #c8ccd8);
  font-size: 15px;
  line-height: 1.65;
}

.profile-body {
  width: 100%;
  max-width: 380px;
  flex: 1;
  animation: fadeUp 0.5s 0.1s ease both;
}

.login-card {
  background: var(--surface, #161921);
  border: 1px solid var(--border, #252836);
  border-radius: var(--radius-lg, 20px);
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-title {
  font-family: var(--font-heading, 'Barlow Condensed', sans-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.login-hint {
  color: var(--muted, #6b7694);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.pin-wrap {
  margin-bottom: 16px;
}

.pin-input {
  width: 100%;
  padding: 16px 20px;
  background: var(--bg, #0d0f14);
  border: 2px solid var(--border, #252836);
  border-radius: var(--radius, 12px);
  color: var(--text, #f0f2f7);
  font-size: 28px;
  font-family: 'Courier New', monospace;
  text-align: center;
  letter-spacing: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.pin-input:focus {
  border-color: var(--primary-color, #00d4aa);
  box-shadow: 0 0 0 4px rgba(0,212,170,0.12);
}
.pin-input::placeholder { letter-spacing: 4px; font-size: 20px; }

.profile-footer {
  padding: 28px 0;
  text-align: center;
}

/* ════════════════════════════════════════════
   STUDENT PAGE
   ════════════════════════════════════════════ */
.student-layout {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.student-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13,15,20,0.85);
  border-bottom: 1px solid var(--border, #252836);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.student-header-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-trainer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hdr-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border, #252836);
}

.hdr-trainer-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text2, #c8ccd8);
  letter-spacing: 0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.student-main {
  flex: 1;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

/* ── Hero ────────────────────────────────────── */
.student-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 36px;
  gap: 20px;
  animation: fadeUp 0.4s ease both;
}

.student-name-wrap { flex: 1; }

.student-name {
  font-family: var(--font-heading, 'Barlow Condensed', sans-serif);
  font-size: 36px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.01em;
  margin-bottom: 6px;
}

.program-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary-color, #00d4aa);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Progress ring ───────────────────────────── */
.overall-progress { flex-shrink: 0; }

.progress-ring-wrap {
  position: relative;
  width: 64px;
  height: 64px;
}

.progress-ring {
  transform: rotate(-90deg);
  filter: drop-shadow(0 0 6px rgba(0,212,170,0.3));
}

.ring-bg { stroke: var(--border, #252836); }
.ring-fill {
  stroke: var(--primary-color, #00d4aa);
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading, 'Barlow Condensed', sans-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #f0f2f7);
}

/* ── Section title ───────────────────────────── */
.section-title {
  font-family: var(--font-heading, 'Barlow Condensed', sans-serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #6b7694);
  margin-bottom: 16px;
}

/* ── Day detail ──────────────────────────────── */
.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.day-title {
  font-family: var(--font-heading, 'Barlow Condensed', sans-serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.day-progress-text {
  font-family: var(--font-heading, 'Barlow Condensed', sans-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-color, #00d4aa);
  letter-spacing: 0.02em;
}

.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeUp 0.35s ease both;
}

.empty-day {
  text-align: center;
  padding: 48px 0;
  color: var(--muted, #6b7694);
  font-size: 16px;
}

/* ── Footer ──────────────────────────────────── */
.student-footer {
  text-align: center;
  padding: 20px;
  border-top: 1px solid var(--border, #252836);
}

/* ── Animations ──────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 480px) {
  .student-name  { font-size: 30px; }
  .day-title     { font-size: 22px; }
  .login-card    { padding: 26px 22px; }
  .profile-header { padding: 48px 0 28px; }
  .student-main  { padding: 20px 16px 48px; }
}
