/* ============================================================
   VajraMoves – Design System & Global Styles
   Color palette: Black #0D0D0D, Dark card #1A1A1A, 
   Accent gold #F5A623, Text white #FFFFFF
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

/* ── CSS Variables ── */
:root {
  --bg:          #0D0D0D;
  --surface:     #161616;
  --card:        #1E1E1E;
  --card-hover:  #252525;
  --border:      #2A2A2A;
  --gold:        #F5A623;
  --gold-dark:   #D4891A;
  --gold-subtle: rgba(245,166,35,0.12);
  --text:        #FFFFFF;
  --text-muted:  #9A9A9A;
  --text-dim:    #555555;
  --success:     #4CAF50;
  --error:       #FF5252;
  --nav-height:  64px;
  --radius:      14px;
  --radius-sm:   8px;
  --transition:  0.2s ease;
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --max-w:        480px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: var(--font-body); }
input, textarea, select { font-family: var(--font-body); }

/* ── Page wrapper ── */
#app {
  max-width: var(--max-w);
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* ── Screens ── */
.screen {
  display: none;
  min-height: 100dvh;
  flex-direction: column;
  background: var(--bg);
  animation: fadeIn 0.25s ease;
}
.screen.active { display: flex; }
@keyframes fadeIn { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform: translateY(0); } }

/* ── Auth screens (no nav) ── */
.auth-screen {
  padding: 0 0 40px;
  justify-content: flex-start;
}

/* ── Real logo images ── */
.auth-logo-img {
  display: block;
  height: 52px;
  width: auto;
  margin: 0 auto 10px;
  object-fit: contain;
}
.topbar-logo-img {
  height: 28px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

/* ── App screens (with nav) ── */
.app-screen {
  padding-bottom: var(--nav-height);
}

/* ── Scrollable content area ── */
.screen-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.screen-content::-webkit-scrollbar { display: none; }

/* ══════════════════════════════════
   AUTH LAYOUT
══════════════════════════════════ */
.auth-logo {
  text-align: center;
  padding: 48px 24px 32px;
}
.auth-logo img { height: 36px; margin: 0 auto 8px; }
.auth-logo .brand {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.auth-logo .brand span { color: var(--gold); }
.auth-tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.auth-card {
  margin: 0 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px 32px;
}
.auth-card h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}
.auth-card .auth-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ── Form Fields ── */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}
.field .input-wrap { position: relative; }
.field input {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.field input::placeholder { color: var(--text-dim); }
.field input:focus { border-color: var(--gold); }
.field input.error { border-color: var(--error); }
.field .toggle-pw {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
}
.field-error {
  font-size: 0.78rem;
  color: var(--error);
  margin-top: 5px;
  display: none;
}
.field-error.visible { display: block; }

.forgot-link {
  display: block;
  text-align: right;
  font-size: 0.85rem;
  color: var(--gold);
  font-weight: 500;
  margin-top: -10px;
  margin-bottom: 24px;
}

/* ── Buttons ── */
.btn-primary {
  display: block;
  width: 100%;
  background: var(--gold);
  color: #000;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 16px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), transform 0.1s;
  text-align: center;
}
.btn-primary:active { transform: scale(0.98); background: var(--gold-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  display: block;
  width: 100%;
  background: transparent;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 15px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  transition: border-color var(--transition);
  text-align: center;
}
.btn-secondary:active { border-color: var(--gold); }

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.auth-switch a, .auth-switch button {
  color: var(--gold);
  font-weight: 600;
  background: none;
  border: none;
  font-size: inherit;
  font-family: inherit;
}

/* ══════════════════════════════════
   TOP BAR
══════════════════════════════════ */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.top-bar .logo-mark {
  width: 36px;
  height: 36px;
  background: var(--gold);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: #000;
}
.top-bar .greeting {
  text-align: right;
}
.top-bar .greeting .hello {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.top-bar .greeting .name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
}

/* ══════════════════════════════════
   BOTTOM NAV
══════════════════════════════════ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-w);
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  display: none; /* shown only when logged in */
}
.bottom-nav.visible { display: flex; }

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 500;
  min-width: 60px;
  background: none;
  border: none;
  font-family: var(--font-body);
  cursor: pointer;
}
.nav-item svg { width: 22px; height: 22px; transition: transform 0.2s; }
.nav-item.active { color: var(--gold); }
.nav-item.active svg { transform: scale(1.1); }

/* ══════════════════════════════════
   HOME SCREEN
══════════════════════════════════ */
.home-content { padding: 0 16px 24px; }

/* Practice Period Selector */
.period-selector {
  margin-bottom: 20px;
}
.period-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  font-family: var(--font-body);
  cursor: pointer;
}
.period-btn svg { width: 16px; height: 16px; color: var(--gold); }
.period-dropdown {
  position: absolute;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 6px;
  overflow: hidden;
  z-index: 50;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: none;
}
.period-dropdown.open { display: block; animation: fadeIn 0.15s ease; }
.period-option {
  padding: 14px 18px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background var(--transition);
}
.period-option:hover, .period-option.active { background: var(--gold-subtle); color: var(--gold); }

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
}
.stat-card .stat-icon {
  width: 32px;
  height: 32px;
  background: var(--gold-subtle);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.stat-card .stat-icon svg { width: 16px; height: 16px; color: var(--gold); }
.stat-card .stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-bottom: 4px;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
}
.stat-card .stat-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Mini bar chart */
.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 36px;
  margin-top: 4px;
}
.mini-bar {
  flex: 1;
  background: var(--gold);
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  opacity: 0.8;
  transition: height 0.4s ease;
}
.mini-bar.today { opacity: 1; }

/* Section Header */
.section-header {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 14px;
}

/* Category Chips */
.category-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 0 16px 4px;
  margin-bottom: 16px;
}
.category-scroll::-webkit-scrollbar { display: none; }
.cat-chip {
  white-space: nowrap;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.cat-chip.active {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
  font-weight: 700;
}

/* Video Grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}
.video-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 1px solid var(--border);
}
.video-card:active { transform: scale(0.97); }

.video-thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--border);
  overflow: hidden;
}
.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.video-thumb .play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
}
.video-thumb .play-btn svg {
  width: 40px;
  height: 40px;
  color: #fff;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
}
.video-thumb .duration-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.video-info { padding: 10px 10px 12px; }
.video-info .v-title {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-info .v-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* What is VajraMoves video section */
.what-section { margin-top: 8px; padding-bottom: 8px; }
.what-section h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 6px;
}
.what-section p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}
/* Click-to-play thumbnail wrapper */
.what-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  cursor: pointer;
}
.what-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.what-play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.what-play-btn:active { transform: scale(0.93); }
.what-play-btn svg { width: 72px; height: 72px; }

/* ══════════════════════════════════
   MOVES SCREEN
══════════════════════════════════ */
.moves-content { padding: 16px; }
.search-bar {
  position: relative;
  margin-bottom: 24px;
}
.search-bar input {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 13px 20px 13px 46px;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.search-bar input:focus { border-color: var(--gold); }
.search-bar input::placeholder { color: var(--text-dim); }
.search-bar .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 18px; height: 18px;
}

/* ══════════════════════════════════
   PROFILE SCREEN
══════════════════════════════════ */
.profile-content { padding: 20px 16px 32px; }

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.avatar-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
}
.profile-name-email .p-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}
.profile-name-email .p-email {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.profile-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.profile-card-header h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}
.edit-link {
  color: var(--gold);
  font-size: 0.875rem;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
}

/* Profile form grid */
.profile-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ══════════════════════════════════
   VIDEO PLAYER MODAL
══════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 200;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.open { display: flex; }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px; height: 40px;
  background: var(--card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  color: var(--text);
}
.modal-close svg { width: 20px; height: 20px; }
.modal-video-wrap {
  width: 100%;
  max-width: 440px;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.modal-video-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.modal-video-title {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  max-width: 440px;
}
.modal-video-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: center;
}

/* ══════════════════════════════════
   TOAST NOTIFICATION
══════════════════════════════════ */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 12px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 300;
  opacity: 0;
  transition: all 0.3s ease;
  white-space: nowrap;
  max-width: calc(var(--max-w) - 32px);
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--error); color: var(--error); }

/* ══════════════════════════════════
   SPINNER
══════════════════════════════════ */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════
   FORGOT PASSWORD MODAL
══════════════════════════════════ */
.fp-modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.fp-modal.open { display: flex; animation: fadeIn 0.2s ease; }
.fp-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 28px 24px 40px;
  width: 100%;
  max-width: var(--max-w);
}
.fp-sheet h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.fp-sheet p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}
.fp-close-btn {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  cursor: pointer;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--card-hover) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* No results */
.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.no-results svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: 0.3; }

/* Responsive – tablets get wider */
@media (min-width: 480px) {
  #app { box-shadow: 0 0 80px rgba(0,0,0,0.8); }
}
