/* ==========================================================================
   ALTHEA — HOJA DE ESTILOS DEL DASHBOARD (área de miembros)
   Paleta Arcilla & Salvia · glassmorphism orgánico · tema claro
   ========================================================================== */

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

:root {
  /* This is a light-only design. Without this, some mobile browsers apply
     automatic dark-mode styling to native form controls (inputs, selects)
     when the device is in system dark mode — which can render input text
     white-on-white against our light .form-control background. */
  color-scheme: light;

  /* ---- Paleta ARCILLA & SALVIA -------------------------------------------
     Terrosa, femenina y contemporánea. Los tonos "profundos" (accent, tag,
     ochre) son los que llevan texto y cumplen contraste AA sobre blanco;
     los "soft" son puramente decorativos (blobs, rellenos, bordes).
     ---------------------------------------------------------------------- */
  --color-bg: #FCFAF7;              /* blanco cálido */
  --color-bg-soft: #F1EBE4;         /* arcilla clara */
  --color-surface: rgba(255, 255, 255, 0.55);
  --color-surface-strong: rgba(255, 255, 255, 0.80);
  --color-surface-solid: #FFFFFF;
  --color-border: rgba(42, 37, 33, 0.10);
  --color-border-strong: rgba(42, 37, 33, 0.18);
  --color-text-primary: #2A2521;    /* tierra oscura */
  --color-text-secondary: #736A62;

  --color-accent: #9C5C3C;          /* terracota profunda — botones, 5.2:1 sobre blanco */
  --color-accent-contrast: #FFFFFF;
  --color-accent-hover: #834B2F;
  --color-clay: #B5714F;            /* terracota clara — decorativo */

  --color-tag: #63735A;             /* salvia profunda — eyebrows, texto, 5.1:1 */
  --color-sage: #7C8B6F;            /* salvia — decorativo */

  --color-ochre: #A8871F;           /* ocre legible */
  --color-ochre-soft: #C9A227;      /* ocre — decorativo */

  --color-danger: #C1524A;
  --color-success: #5F7A52;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-editorial: 'Fraunces', Georgia, serif;
  --radius: 22px;
  --radius-sm: 14px;
  --radius-pill: 999px;
  --blur: blur(22px) saturate(160%);
}

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  position: relative;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(680px circle at 8% 12%, rgba(124, 139, 111, 0.16), transparent 60%),
    radial-gradient(620px circle at 92% 18%, rgba(201, 162, 39, 0.13), transparent 60%),
    radial-gradient(780px circle at 50% 95%, rgba(181, 113, 79, 0.14), transparent 60%);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   AUTH PAGES (login / register)
   -------------------------------------------------------------------------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--color-border);
  box-shadow: 0 20px 60px rgba(42, 37, 33, 0.10);
  border-radius: calc(var(--radius) + 6px);
  padding: 48px 40px;
}

.auth-logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.01em;
  text-align: center;
  margin-bottom: 8px;
  display: block;
}

.auth-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
}

.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  background: var(--color-surface-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color 0.2s ease;
}
.form-control:focus { border-color: var(--color-text-primary); outline: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.btn-gold {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  width: 100%;
  box-shadow: 0 6px 20px rgba(42, 37, 33, 0.18);
}
.btn-gold:hover { background: var(--color-accent-hover); }
.btn-outline {
  background: var(--color-surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}
.btn-outline:hover { border-color: var(--color-text-primary); background: var(--color-surface-strong); }

.auth-alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
}
.auth-alert.error { background: rgba(193, 82, 74, 0.12); color: var(--color-danger); border: 1px solid var(--color-danger); }
.auth-alert.success { background: rgba(95, 122, 82, 0.12); color: var(--color-success); border: 1px solid var(--color-success); }

.auth-footer-link {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--color-text-secondary);
}
.auth-footer-link a { color: var(--color-text-primary); text-decoration: underline; }

/* --------------------------------------------------------------------------
   DASHBOARD SHELL
   -------------------------------------------------------------------------- */

.dashboard-shell {
  display: flex;
  min-height: 100vh;
}

.dashboard-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--color-surface-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-right: 1px solid var(--color-border);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.avatar-initial {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 14px;
  font-weight: 600;
}
.sidebar-user-email {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.sidebar-nav {
  border-top: 1px solid var(--color-border);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
}

.sidebar-nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin: 12px 0 4px;
}

.sidebar-nav a, .sidebar-nav .sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: background 0.2s ease, color 0.2s ease;
}
.sidebar-nav a:hover, .sidebar-nav .sidebar-link:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
}
.sidebar-nav a.active {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.sidebar-nav form { margin: 0; }
.sidebar-nav form button {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  font-family: inherit;
}

/* Minimalist line icons — sidebar nav, locked/status states everywhere else */
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.6;
}
.icon-inline {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke-width: 1.8;
  vertical-align: -2px;
  margin-right: 4px;
}

/* Sidebar language switch */
.sidebar-lang-switch {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}
.sidebar-lang-switch button {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.sidebar-lang-switch button.active { color: var(--color-tag); border-color: var(--color-border-strong); }
.sidebar-lang-switch button:hover { color: var(--color-text-primary); }

/* Mobile sidebar toggle */
.sidebar-mobile-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--color-surface-strong);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.sidebar-mobile-toggle {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dashboard-main {
  flex-grow: 1;
  padding: 48px;
  max-width: 1100px;
}

/* --------------------------------------------------------------------------
   PROGRAM OVERVIEW
   -------------------------------------------------------------------------- */

.dashboard-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 38px;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

.dashboard-intro {
  background: var(--color-surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 32px;
}
.dashboard-intro p {
  margin: 0 0 14px;
  color: var(--color-text-secondary);
  font-size: 15px;
}
.dashboard-intro p:last-child { margin-bottom: 0; }
.dashboard-intro strong { color: var(--color-text-primary); }
.dashboard-intro-subtitle {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 20px 0 12px;
}
.dashboard-intro-list {
  margin: 0 0 16px;
  padding-left: 20px;
  color: var(--color-text-secondary);
  font-size: 15px;
}
.dashboard-intro-list li { margin-bottom: 8px; }
.dashboard-intro-list li:last-child { margin-bottom: 0; }
.dashboard-intro-highlight { font-weight: 600; color: var(--color-text-primary) !important; }

.progress-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.progress-bar-track {
  flex-grow: 1;
  max-width: 320px;
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--color-tag);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.module-card {
  background: var(--color-surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.module-card.is-locked { opacity: 0.55; }
.module-card:not(.is-locked):hover {
  border-color: var(--color-border-strong);
  box-shadow: 0 14px 40px rgba(42, 37, 33, 0.08);
  transform: translateY(-3px);
}

.module-thumb {
  aspect-ratio: 16/9;
  background: var(--color-bg-soft);
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  overflow: hidden;
}
.module-thumb-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(12, 12, 12, 0.32);
  transition: background 0.2s ease;
}
.module-card.is-locked .module-thumb-overlay { background: rgba(12, 12, 12, 0.55); }
.module-card:not(.is-locked):hover .module-thumb-overlay { background: rgba(12, 12, 12, 0.45); }

.module-thumb-play {
  position: relative;
  z-index: 1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.module-thumb-lock {
  position: relative;
  z-index: 1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.module-body { padding: 20px; }

.module-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
}
.module-status.completed { background: rgba(95, 122, 82, 0.14); color: var(--color-success); }
.module-status.current { background: rgba(124, 139, 111, 0.14); color: var(--color-tag); }
.module-status.locked { background: var(--color-border); color: var(--color-text-secondary); }

.module-card-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.module-card-desc { font-size: 13px; color: var(--color-text-secondary); }

/* --------------------------------------------------------------------------
   MODULE PLAYER VIEW
   -------------------------------------------------------------------------- */

.player-breadcrumb {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}
.player-breadcrumb a { color: var(--color-text-primary); text-decoration: underline; }

.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: 0 20px 60px rgba(42, 37, 33, 0.14);
}
.video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.player-module-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.player-module-desc {
  color: var(--color-text-secondary);
  max-width: 640px;
  margin-bottom: 28px;
}
.player-module-desc p { margin: 0 0 16px; }
.player-module-desc ul.module-desc-list { margin: 0 0 16px; padding-left: 20px; }
.player-module-desc ul.module-desc-list li { margin-bottom: 8px; }
.player-module-desc p:last-child,
.player-module-desc ul.module-desc-list:last-child { margin-bottom: 0; }
.player-module-desc ul.module-desc-list li:last-child { margin-bottom: 0; }

.player-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.player-nav {
  display: flex;
  gap: 12px;
}

/* --------------------------------------------------------------------------
   ACCOUNT SETTINGS
   -------------------------------------------------------------------------- */

.settings-card {
  background: var(--color-surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 480px;
}

/* --------------------------------------------------------------------------
   RESPONSIVE
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .dashboard-shell { flex-direction: column; }
  .dashboard-sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100vh;
    z-index: 200;
    transition: left 0.25s ease;
    width: 260px;
  }
  .dashboard-sidebar.open { left: 0; }
  .sidebar-mobile-bar { display: flex; }
  .dashboard-main { padding: 24px; }
  .dashboard-title { font-size: 28px; }
}
