/* ═══════════════════════════════════════════════════════════
   ARCADEA ACADEMY — Design System
   ═══════════════════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --sand: #F5F0E8;
  --clay: #C4A882;
  --clay-d: #9E7E58;
  --ink: #1A1612;
  --muted: #8A7A68;
  --white: #FDFAF5;
  --green: #2D4A3E;
  --green-l: #3d6354;
  --red: #8B2020;
  --red-l: #a63030;
  --blue: #3B6FA0;
  --border: rgba(196,168,130,.25);
  --border-l: rgba(196,168,130,.12);
  --shadow-sm: 0 1px 3px rgba(26,22,18,.06);
  --shadow-md: 0 4px 12px rgba(26,22,18,.08);
  --shadow-lg: 0 8px 24px rgba(26,22,18,.12);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 100px;
  --sidebar-w: 240px;
  --header-h: 60px;
  --font-display: 'Cormorant Garamond', serif;
  --font-body: 'DM Sans', sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-body); font-weight: 400; color: var(--ink); background: var(--sand); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }

/* ── Header ── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(253,250,245,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-l);
  height: var(--header-h);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; padding: 0 24px;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-logo {
  font-family: var(--font-display); font-size: 20px; font-weight: 400; font-style: italic;
  color: var(--ink); letter-spacing: -.01em;
}
.header-right { display: flex; align-items: center; gap: 16px; }
.header-user-link { display: flex; align-items: center; gap: 10px; }
.header-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.header-avatar-placeholder {
  width: 32px; height: 32px; border-radius: 50%; background: var(--clay);
  color: var(--white); font-size: 11px; font-weight: 600; letter-spacing: .04em;
  display: flex; align-items: center; justify-content: center;
}
.header-user-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.sidebar-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--ink); padding: 4px; }

/* ── Notifications bell ── */
.header-notif { position: relative; }
.header-notif button { background: none; border: none; cursor: pointer; color: var(--muted); padding: 6px; position: relative; transition: color .2s; }
.header-notif button:hover { color: var(--ink); }
.notif-badge {
  position: absolute; top: 2px; right: 0; width: 16px; height: 16px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 9px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.notif-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0; width: 320px;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); max-height: 400px; overflow-y: auto; z-index: 200;
}
.notif-dropdown.open { display: block; }
.notif-item { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border-l); font-size: 13px; color: inherit; text-decoration: none; transition: background .15s; }
.notif-item:hover { background: rgba(196,168,130,.05); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: rgba(196,168,130,.08); }
.notif-item.unread:hover { background: rgba(196,168,130,.14); }
.notif-item-title { font-weight: 500; margin-bottom: 2px; color: var(--ink); }
.notif-item-msg { font-size: 12px; color: var(--muted); line-height: 1.4; margin-bottom: 4px; }
.notif-item-time { font-size: 11px; color: var(--muted); }
.notif-empty { padding: 24px 16px; text-align: center; font-size: 13px; color: var(--muted); }

/* ── Sidebar ── */
.sidebar {
  position: fixed; top: var(--header-h); left: 0; bottom: 0;
  width: var(--sidebar-w); background: var(--white);
  border-right: 1px solid var(--border-l);
  display: flex; flex-direction: column; z-index: 90;
  overflow-y: auto; padding: 20px 0;
}
.sidebar-nav { flex: 1; }
.sidebar-section { margin-bottom: 8px; }
.sidebar-label {
  padding: 8px 24px 4px; font-size: 10px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 24px; font-size: 13px; font-weight: 400; color: var(--muted);
  transition: all .15s;
}
.sidebar-link:hover { color: var(--ink); background: rgba(196,168,130,.08); }
.sidebar-link.active { color: var(--ink); font-weight: 500; background: rgba(196,168,130,.12); border-right: 2px solid var(--clay); }
.sidebar-link svg { flex-shrink: 0; opacity: .6; }
.sidebar-link.active svg { opacity: 1; }
.sidebar-link-muted { color: var(--muted); font-size: 12px; }
.sidebar-footer { padding: 12px 0; border-top: 1px solid var(--border-l); margin-top: auto; }
.sidebar-overlay { display: none; }

/* ── Main ── */
.main {
  margin-left: var(--sidebar-w); padding: 32px 36px;
  min-height: calc(100vh - var(--header-h));
}
.main-full {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 32px;
}

/* ── Page header ── */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-title { font-family: var(--font-display); font-size: 28px; font-weight: 300; color: var(--ink); }
.page-subtitle { font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 10px; }

/* ── Cards ── */
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-sm);
}
.card-compact { padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-family: var(--font-display); font-size: 20px; font-weight: 400; color: var(--ink); }

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

/* ── Stats ── */
.stat { text-align: center; padding: 20px; }
.stat-value { font-family: var(--font-display); font-size: 36px; font-weight: 300; color: var(--ink); line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 6px; letter-spacing: .04em; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; }
th {
  text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
td { padding: 12px 14px; font-size: 13px; border-bottom: 1px solid var(--border-l); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(196,168,130,.04); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  padding: 10px 24px; border: none; cursor: pointer;
  border-radius: var(--radius-pill); transition: all .2s; text-decoration: none;
}
.btn-sm { padding: 7px 16px; font-size: 12px; }
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-secondary { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.btn-secondary:hover { background: rgba(196,168,130,.1); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-l); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: var(--green-l); }
.btn-ghost { background: none; border: none; color: var(--muted); padding: 6px 12px; font-size: 12px; }
.btn-ghost:hover { color: var(--ink); }
.btn svg { flex-shrink: 0; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .03em; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px;
  background: var(--sand); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 400;
  color: var(--ink); outline: none; transition: border-color .2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--clay); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-select { -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A7A68' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input { width: 16px; height: 16px; accent-color: var(--clay-d); }
.form-hint { font-size: 11px; color: var(--muted); }
.form-error { font-size: 11px; color: var(--red); }

/* ── Alerts ── */
.alert { padding: 14px 20px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 13px; font-weight: 400; }
.alert-success { background: rgba(45,74,62,.08); color: var(--green); border: 1px solid rgba(45,74,62,.2); }
.alert-error { background: rgba(139,32,32,.06); color: var(--red); border: 1px solid rgba(139,32,32,.15); }
.alert-info { background: rgba(196,168,130,.1); color: var(--clay-d); border: 1px solid var(--border); }
.alert-warning { background: rgba(196,168,130,.15); color: var(--clay-d); border: 1px solid var(--border); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 10px; border-radius: var(--radius-pill);
}
.badge-admin { background: rgba(26,22,18,.1); color: var(--ink); }
.badge-instructor { background: rgba(59,111,160,.12); color: var(--blue); }
.badge-alumno { background: rgba(45,74,62,.1); color: var(--green); }
.badge-activo { background: rgba(45,74,62,.1); color: var(--green); }
.badge-inactivo { background: rgba(139,32,32,.08); color: var(--red); }
.badge-pendiente { background: rgba(196,168,130,.2); color: var(--clay-d); }
.badge-borrador { background: rgba(196,168,130,.2); color: var(--clay-d); }
.badge-publicado { background: rgba(45,74,62,.1); color: var(--green); }
.badge-archivado { background: rgba(138,122,104,.15); color: var(--muted); }
.badge-basico { background: rgba(45,74,62,.1); color: var(--green); }
.badge-intermedio { background: rgba(59,111,160,.12); color: var(--blue); }
.badge-avanzado { background: rgba(139,32,32,.08); color: var(--red); }
.badge-no_iniciado { background: rgba(138,122,104,.12); color: var(--muted); }
.badge-en_progreso { background: rgba(59,111,160,.12); color: var(--blue); }
.badge-completado { background: rgba(45,74,62,.1); color: var(--green); }
.badge-suspenso { background: rgba(139,32,32,.08); color: var(--red); }

/* ── Progress bar ── */
.progress { height: 6px; background: var(--border-l); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--green); border-radius: 3px; transition: width .3s; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab {
  padding: 10px 20px; font-size: 13px; font-weight: 400; color: var(--muted);
  border-bottom: 2px solid transparent; cursor: pointer; transition: all .2s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 500; border-bottom-color: var(--clay); }

/* ── Empty state ── */
.empty { text-align: center; padding: 48px 24px; }
.empty-icon { margin: 0 auto 16px; color: var(--muted); opacity: .4; }
.empty-title { font-family: var(--font-display); font-size: 20px; font-weight: 300; color: var(--ink); margin-bottom: 8px; }
.empty-text { font-size: 13px; color: var(--muted); margin-bottom: 20px; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 24px; }
.pagination a, .pagination span {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; font-size: 13px; border-radius: 8px; transition: all .15s;
}
.pagination a { color: var(--muted); }
.pagination a:hover { background: rgba(196,168,130,.12); color: var(--ink); }
.pagination .current { background: var(--ink); color: var(--white); font-weight: 500; }

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(26,22,18,.5);
  z-index: 300; align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius); padding: 32px;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-title { font-family: var(--font-display); font-size: 22px; font-weight: 300; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ── Course cards (student view) ── */
.course-card { display: flex; flex-direction: column; overflow: hidden; transition: transform .2s, box-shadow .2s; }
.course-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.course-card-img { height: 160px; background: var(--sand); overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; display: flex; align-items: center; justify-content: center; }
.course-card-img img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.course-card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.course-card-cat { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--clay-d); margin-bottom: 8px; }
.course-card-title { font-family: var(--font-display); font-size: 18px; font-weight: 400; line-height: 1.3; margin-bottom: 8px; }
.course-card-meta { font-size: 12px; color: var(--muted); display: flex; gap: 12px; margin-top: auto; padding-top: 12px; }

/* ── Login page ── */
.login-wrap { width: 100%; max-width: 400px; }
.login-header { text-align: center; margin-bottom: 36px; }
.login-logo { font-family: var(--font-display); font-size: 28px; font-style: italic; color: var(--ink); margin-bottom: 8px; }
.login-sub { font-size: 14px; color: var(--muted); font-weight: 300; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%); transition: transform .25s; position: fixed;
    top: var(--header-h); left: 0; bottom: 0; z-index: 95;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(26,22,18,.3); z-index: 94; }
  .sidebar-toggle { display: block; }
  .main { margin-left: 0; padding: 24px 16px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .header-user-name { display: none; }
}

@media (max-width: 480px) {
  .main { padding: 16px 12px; }
  .card { padding: 20px 16px; }
}

/* ── Utilities ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
