:root {
  --bg: #0A0A0A;
  --surface: #141414;
  --surface2: #1E1E1E;
  --border: #252525;
  --accent: #F0A500;
  --accent-dim: rgba(240,165,0,.12);
  --text: #F0F0F0;
  --muted: #888;
  --success: #22C55E;
  --error: #EF4444;
  --radius: 12px;
  --header-h: 60px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: .8; }

/* ─── Header ─────────────────────────────────────────────────────────────── */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(10,10,10,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.header-logo { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -.3px; }
.header-logo span { color: var(--accent); }
.header-right { display: flex; align-items: center; gap: 16px; }
.header-user { font-size: 13px; color: var(--muted); }
.header-user b { color: var(--text); }

/* ─── Page wrapper ───────────────────────────────────────────────────────── */
.page { padding-top: calc(var(--header-h) + 32px); padding-bottom: 60px; }
.container { max-width: 900px; margin: 0 auto; padding: 0 20px; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn:hover { opacity: .88; }
.btn-primary { background: var(--accent); color: #000; }
.btn-ghost   { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-danger  { background: var(--error); color: #fff; }
.btn-sm      { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Form ───────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: 13px; color: var(--muted); font-weight: 500; }
.form-control {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 10px 14px; font-size: 14px; width: 100%;
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--accent); }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ─── Card ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.card-body { padding: 20px; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.card-meta { font-size: 13px; color: var(--muted); }

/* ─── Grid ───────────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }

/* ─── Auth page ──────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(240,165,0,.06) 0%, transparent 70%);
}
.auth-card { width: 100%; max-width: 400px; padding: 20px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo h1 { font-size: 28px; font-weight: 800; }
.auth-logo h1 span { color: var(--accent); }
.auth-logo p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.auth-tab {
  flex: 1; padding: 10px; text-align: center; font-size: 14px; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
  transition: all .15s; margin-bottom: -1px;
}
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.auth-form { display: none; }
.auth-form.active { display: block; }

/* ─── Page title ─────────────────────────────────────────────────────────── */
.page-title { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.page-subtitle { color: var(--muted); margin-bottom: 28px; }
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; font-size: 12px; }

/* ─── Course card ────────────────────────────────────────────────────────── */
.course-card { cursor: pointer; transition: border-color .2s; }
.course-card:hover { border-color: var(--accent); }
.course-card-accent { height: 4px; background: var(--accent); }
.course-card-body { padding: 18px; }
.course-card-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.course-card-meta { font-size: 13px; color: var(--muted); }
.course-card-code {
  display: inline-block; margin-top: 12px; padding: 4px 10px;
  background: var(--accent-dim); border-radius: 6px;
  font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: 1px;
}

/* ─── Module / Lesson list ───────────────────────────────────────────────── */
.module-block { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.module-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--surface); cursor: pointer;
  user-select: none;
}
.module-header:hover { background: var(--surface2); }
.module-title { font-weight: 600; font-size: 15px; }
.module-count { font-size: 12px; color: var(--muted); }
.module-chevron { color: var(--muted); transition: transform .2s; }
.module-block.open .module-chevron { transform: rotate(90deg); }
.module-lessons { display: none; border-top: 1px solid var(--border); }
.module-block.open .module-lessons { display: block; }
.lesson-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background .15s;
}
.lesson-row:last-child { border-bottom: none; }
.lesson-row:hover { background: var(--surface2); }
.lesson-dot {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
}
.lesson-dot.done { background: var(--success); border-color: var(--success); }
.lesson-dot.done::after { content: '✓'; font-size: 11px; color: #fff; font-weight: 700; }
.lesson-title-text { flex: 1; font-size: 14px; }
.lesson-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: var(--accent-dim); color: var(--accent); font-weight: 600;
}

/* ─── Lesson view ────────────────────────────────────────────────────────── */
.lesson-hero { margin-bottom: 28px; }
.lesson-hero-title { font-size: 28px; font-weight: 800; line-height: 1.2; margin-bottom: 8px; }
.lesson-hero-meta { font-size: 13px; color: var(--muted); }
.video-wrap { position: relative; padding-bottom: 56.25%; height: 0; border-radius: var(--radius); overflow: hidden; background: #000; margin-bottom: 28px; }
.video-wrap iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }
.lesson-content { color: var(--text); line-height: 1.8; white-space: pre-wrap; margin-bottom: 32px; }
.lesson-nav { display: flex; gap: 12px; margin-bottom: 40px; flex-wrap: wrap; }

/* ─── Assignment ─────────────────────────────────────────────────────────── */
.assignment-block { border: 1px solid var(--accent); border-radius: var(--radius); padding: 24px; margin-top: 32px; }
.assignment-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.assignment-desc { color: var(--muted); margin-bottom: 20px; }
.photo-drop {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 40px 20px; text-align: center; cursor: pointer; transition: border-color .2s;
}
.photo-drop:hover, .photo-drop.drag-over { border-color: var(--accent); }
.photo-drop input { display: none; }
.photo-preview { width: 100%; max-height: 360px; object-fit: contain; border-radius: 8px; margin-bottom: 16px; display: none; }
.submitted-photo { width: 100%; max-height: 400px; object-fit: contain; border-radius: 8px; }
.feedback-box { margin-top: 16px; padding: 16px; background: var(--surface2); border-radius: 8px; border-left: 3px solid var(--accent); }
.feedback-label { font-size: 12px; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }

/* ─── Admin ──────────────────────────────────────────────────────────────── */
.stat-row { display: flex; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.stat-card { flex: 1; min-width: 140px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.stat-val { font-size: 32px; font-weight: 800; color: var(--accent); }
.stat-lbl { font-size: 13px; color: var(--muted); margin-top: 2px; }

.submissions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.sub-thumb { border-radius: var(--radius); overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: border-color .15s; }
.sub-thumb:hover { border-color: var(--accent); }
.sub-thumb img { width: 100%; height: 180px; object-fit: cover; display: block; }
.sub-thumb-info { padding: 10px; background: var(--surface); }
.sub-thumb-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-thumb-meta { font-size: 12px; color: var(--muted); }
.sub-thumb.reviewed { border-color: var(--success); }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.8);
  z-index: 200; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 720px; max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column;
}
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 22px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ─── Admin add form ─────────────────────────────────────────────────────── */
.add-form { background: var(--surface2); border-radius: var(--radius); padding: 20px; margin-top: 12px; display: none; }
.add-form.open { display: block; }
.add-lesson-btn { margin-left: 18px; margin-bottom: 10px; }

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  padding: 12px 20px; border-radius: 8px; font-size: 14px; font-weight: 600;
  color: #fff; transform: translateY(80px); opacity: 0;
  transition: all .25s; pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.ok  { background: var(--success); }
.toast.bad { background: var(--error); }

/* ─── Solicitudes de alumnos ─────────────────────────────────────────────── */
.request-card {
  display: grid;
  grid-template-columns: 1fr 140px 180px;
  gap: 16px;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}
.request-name  { font-weight: 600; font-size: 15px; }
.request-email { font-size: 13px; color: var(--muted); margin-top: 2px; }
.request-proof {
  width: 140px; height: 100px; object-fit: cover;
  border-radius: 8px; cursor: pointer; border: 1px solid var(--border);
  transition: opacity .15s;
}
.request-proof:hover { opacity: .85; }
.request-actions { display: flex; flex-direction: column; }
@media (max-width: 700px) {
  .request-card { grid-template-columns: 1fr; }
  .request-proof { width: 100%; height: 160px; }
}

/* ─── Misc ───────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-accent { background: var(--accent-dim); color: var(--accent); }
.badge-success { background: rgba(34,197,94,.15); color: var(--success); }
.badge-muted { background: var(--surface2); color: var(--muted); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state p { font-size: 15px; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .page-title { font-size: 20px; }
  .lesson-hero-title { font-size: 22px; }
  .stat-row { gap: 10px; }
  .container, .container-wide { padding: 0 14px; }
}
