/* XSkillo Student PWA — Mobile First
   #0A0A0A · #FF5C00 · #FFFFFF · Inter font
*/

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

:root {
  --orange:    #FF5C00;
  --orange-dk: #e04e00;
  --black:     #0A0A0A;
  --dark:      #1a1a1a;
  --mid:       #2a2a2a;
  --border:    #333;
  --muted:     #888;
  --white:     #ffffff;
  --green:     #16a34a;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body { height: 100%; background: var(--black); color: var(--white); }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#xsk-app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.hidden { display: none !important; }

/* ── Offline bar ─────────────────────────────────────────────── */
#xsk-offline-bar {
  background: #333;
  color: #ccc;
  text-align: center;
  padding: 8px;
  font-size: 12px;
}

/* ── Screens ─────────────────────────────────────────────────── */
.xsk-screen { display: none; }
.xsk-screen.active { display: block; }

/* ── Login ───────────────────────────────────────────────────── */
#xsk-login {
  position: fixed; inset: 0;
  background: var(--black);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 100;
}
.xsk-login-wrap { width: 100%; max-width: 380px; }
.xsk-login-brand { text-align: center; margin-bottom: 40px; }
.xsk-login-squirrel { font-size: 64px; margin-bottom: 12px; }
.xsk-login-brand h1 { font-size: 32px; font-weight: 900; color: var(--orange); }
.xsk-login-brand p  { color: var(--muted); margin-top: 6px; font-size: 15px; }
.xsk-login-form { display: flex; flex-direction: column; gap: 16px; }

/* ── App shell layout ────────────────────────────────────────── */
#xsk-app-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#xsk-main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(70px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}
.xsk-screen { padding: 0 16px 24px; }
#screen-home { padding-top: calc(16px + var(--safe-top)); }

/* ── Bottom nav ──────────────────────────────────────────────── */
.xsk-bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(60px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--dark);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 50;
}
.xsk-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  transition: color 0.15s;
  min-height: 44px;
}
.xsk-nav-item.active { color: var(--orange); }
.xsk-nav-icon { font-size: 20px; }

/* ── Screen headers ──────────────────────────────────────────── */
.xsk-screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0 16px;
  position: sticky;
  top: 0;
  background: var(--black);
  z-index: 10;
}
.xsk-screen-header h2 { font-size: 22px; font-weight: 800; flex: 1; }
.xsk-back-btn {
  background: none; border: none; color: var(--orange);
  font-size: 24px; cursor: pointer; padding: 4px 8px 4px 0;
  min-width: 44px; min-height: 44px; display: flex; align-items: center;
}
.xsk-toggle-btn {
  padding: 6px 14px;
  background: var(--dark);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
}

/* ── Home screen ─────────────────────────────────────────────── */
.xsk-home-header { padding: 0 0 20px; }
.xsk-home-greeting { display: flex; align-items: center; gap: 14px; }
.xsk-home-avatar { width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--orange); }
.xsk-home-name  { font-size: 18px; font-weight: 700; }
.xsk-home-level { font-size: 13px; color: var(--orange); text-transform: capitalize; margin-top: 2px; }

/* ── Streak card ─────────────────────────────────────────────── */
.xsk-streak-card {
  background: linear-gradient(135deg, #FF5C00 0%, #e04e00 100%);
  border-radius: 20px;
  padding: 28px;
  text-align: center;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.xsk-streak-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.xsk-streak-flame { font-size: 36px; margin-bottom: 4px; }
.xsk-streak-num {
  font-size: 72px; font-weight: 900; line-height: 1;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.xsk-streak-label { font-size: 16px; font-weight: 600; opacity: 0.9; margin-top: 4px; }
.xsk-streak-sub   { font-size: 13px; opacity: 0.75; margin-top: 6px; }

/* ── Checkin button (home quick action) ──────────────────────── */
.xsk-checkin-btn {
  width: 100%;
  padding: 16px;
  background: var(--dark);
  border: 2px solid var(--border);
  border-radius: 16px;
  color: var(--white);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
  transition: border-color 0.15s;
  min-height: 56px;
}
.xsk-checkin-btn:hover { border-color: var(--orange); }
.xsk-checkin-btn:active { transform: scale(0.98); }

/* ── Sections ────────────────────────────────────────────────── */
.xsk-section { margin-bottom: 24px; }
.xsk-section h2, .xsk-section h3 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.xsk-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

/* ── Class list ──────────────────────────────────────────────── */
.xsk-class-list { display: flex; flex-direction: column; gap: 10px; }
.xsk-class-item {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.xsk-class-item-top { display: flex; align-items: flex-start; gap: 12px; }
.xsk-class-sport-badge {
  padding: 3px 8px;
  background: var(--orange);
  color: var(--white);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.xsk-class-item-title { font-weight: 700; font-size: 15px; flex: 1; }
.xsk-class-item-time  { font-size: 13px; color: var(--orange); margin-top: 6px; }
.xsk-class-item-loc   { font-size: 12px; color: var(--muted); margin-top: 3px; }
.xsk-attendance-badge {
  font-size: 11px; padding: 3px 8px; border-radius: 4px; flex-shrink: 0;
}
.xsk-attendance-badge.present { background: #16a34a22; color: #16a34a; }
.xsk-attendance-badge.absent  { background: #dc262622; color: #dc2626; }
.xsk-attendance-badge.enrolled{ background: #33333322; color: var(--muted); }

/* ── Checkin form ────────────────────────────────────────────── */
.xsk-checkin-form { padding-top: 8px; }
.xsk-sport-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.xsk-sport-btn {
  padding: 14px 10px;
  background: var(--dark);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--white);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  min-height: 56px;
}
.xsk-sport-btn.selected { border-color: var(--orange); background: #FF5C0015; color: var(--orange); }

.xsk-emoji-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
}
.xsk-emoji-btn {
  font-size: 28px;
  padding: 8px 4px;
  background: var(--dark);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 48px;
}
.xsk-emoji-btn.selected { border-color: var(--orange); background: #FF5C0015; transform: scale(1.1); }

/* ── Progress ────────────────────────────────────────────────── */
.xsk-progress-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 24px;
}
.xsk-pstat {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
}
.xsk-pstat-num   { font-size: 24px; font-weight: 900; color: var(--orange); }
.xsk-pstat-label { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* Heatmap */
.xsk-heatmap {
  display: flex; flex-wrap: wrap; gap: 3px; padding: 4px 0;
}
.xsk-heat-day {
  width: 12px; height: 12px; border-radius: 2px;
  background: var(--border);
}
.xsk-heat-day.d1 { background: #FF5C0040; }
.xsk-heat-day.d2 { background: #FF5C0080; }
.xsk-heat-day.d3 { background: #FF5C00bb; }
.xsk-heat-day.d4 { background: #FF5C00; }

/* Checklist */
.xsk-checklist { display: flex; flex-direction: column; gap: 8px; }
.xsk-check-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.xsk-check-item.done { opacity: 0.6; }
.xsk-check-item.done .xsk-check-title { text-decoration: line-through; }
.xsk-check-icon { font-size: 20px; flex-shrink: 0; }
.xsk-check-title { font-size: 15px; flex: 1; }
.xsk-check-date  { font-size: 11px; color: var(--muted); }

/* ── Profile ─────────────────────────────────────────────────── */
.xsk-profile-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 28px 20px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 20px;
  text-align: center;
}
.xsk-profile-avatar { width: 80px; height: 80px; border-radius: 50%; border: 3px solid var(--orange); margin-bottom: 12px; }
.xsk-profile-name  { font-size: 20px; font-weight: 700; }
.xsk-profile-email { font-size: 13px; color: var(--muted); margin-top: 4px; }
.xsk-profile-level { font-size: 13px; color: var(--orange); margin-top: 4px; text-transform: capitalize; }

.xsk-avatar-picker { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 0; }
.xsk-avatar-opt {
  width: 48px; height: 48px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: border-color 0.15s;
}
.xsk-avatar-opt.selected { border-color: var(--orange); }

/* ── Forms ───────────────────────────────────────────────────── */
.xsk-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.xsk-field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.xsk-field .optional { color: var(--border); font-weight: 400; }
.xsk-input, .xsk-select, .xsk-textarea {
  padding: 14px 16px;
  background: var(--dark);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  color: var(--white);
  font-size: 16px; /* prevent iOS zoom */
  font-family: inherit;
  width: 100%;
}
.xsk-input:focus, .xsk-select:focus, .xsk-textarea:focus {
  outline: none; border-color: var(--orange);
}
.xsk-textarea { resize: none; }

/* ── Buttons ─────────────────────────────────────────────────── */
.xsk-btn-primary {
  padding: 16px 24px;
  background: var(--orange);
  color: var(--white);
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  min-height: 52px;
}
.xsk-btn-primary:hover  { background: var(--orange-dk); }
.xsk-btn-primary:active { transform: scale(0.97); }
.xsk-btn-primary.full   { width: 100%; }

.xsk-btn-outline {
  padding: 14px 24px;
  background: none;
  color: var(--orange);
  border: 2px solid var(--orange);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.xsk-btn-outline.full { width: 100%; }

.xsk-btn-ghost {
  padding: 14px 24px;
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  cursor: pointer;
}
.xsk-btn-ghost.full { width: 100%; }

/* ── Error ───────────────────────────────────────────────────── */
.xsk-error {
  padding: 10px 14px;
  background: #dc262622;
  border: 1px solid #dc2626;
  border-radius: 8px;
  color: #dc2626;
  font-size: 14px;
}

.xsk-empty-state { color: var(--muted); font-size: 14px; text-align: center; padding: 24px 0; }

/* ── Milestone overlay ───────────────────────────────────────── */
#xsk-milestone {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 24px;
}
.xsk-milestone-card {
  background: var(--dark);
  border: 2px solid var(--orange);
  border-radius: 24px;
  padding: 40px 32px;
  text-align: center;
  position: relative;
  z-index: 1;
  max-width: 320px;
  width: 100%;
}
.xsk-milestone-emoji { font-size: 72px; margin-bottom: 16px; }
.xsk-milestone-title { font-size: 28px; font-weight: 900; color: var(--orange); margin-bottom: 8px; }
.xsk-milestone-sub   { font-size: 16px; color: var(--muted); margin-bottom: 24px; }

/* Confetti */
.xsk-confetti { position: fixed; inset: 0; pointer-events: none; }
.xsk-confetti-piece {
  position: absolute;
  width: 10px; height: 10px;
  animation: fall 2s linear forwards;
}
@keyframes fall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ── Responsive (tablet+) ────────────────────────────────────── */
@media (min-width: 480px) {
  .xsk-login-wrap { padding: 40px; background: var(--dark); border-radius: 20px; }
  .xsk-emoji-grid { grid-template-columns: repeat(8, 1fr); }
  .xsk-sport-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 768px) {
  #xsk-main-content { max-width: 480px; margin: 0 auto; }
}
