:root {
  --azul: #1e3a5f;
  --azul-claro: #2c5f8a;
  --acento: #d4a72c;
  --fondo: #f4f6f9;
  --texto: #1c2530;
  --borde: #dfe4ea;
  --rojo: #c0392b;
  --verde: #1f8a4c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--fondo);
  color: var(--texto);
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background: #0f2643;
}

.auth-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background-image:
    linear-gradient(160deg, rgba(10,25,45,0.72), rgba(15,38,67,0.55)),
    url("fondo-login.jpg");
  background-size: cover;
  background-position: center;
}

.auth-card {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  width: 100%;
  max-width: 420px;
  padding: 32px;
}

.correo-preview {
  font-size: 12px;
  color: #6b7785;
  margin-top: 5px;
}

.correo-preview strong { color: var(--azul); }

.marca {
  text-align: center;
  margin-bottom: 20px;
}

.marca h1 {
  color: var(--azul);
  font-size: 22px;
  margin: 8px 0 2px;
}

.marca p {
  color: #6b7785;
  font-size: 13px;
  margin: 0;
}

.tabs {
  display: flex;
  border-bottom: 2px solid var(--borde);
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  cursor: pointer;
  color: #8a95a3;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab.activo {
  color: var(--azul);
  border-bottom-color: var(--azul);
}

.campo { margin-bottom: 14px; }

.campo label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #4a5568;
}

.campo input, .campo select, .campo textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-size: 14px;
}

.telefono-grupo {
  display: flex;
  gap: 8px;
}

.telefono-prefijo {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  border: 1px solid #c9dcf5;
  border-radius: 999px;
  background: #eaf1fb;
  color: var(--azul);
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
}

.bandera-cu {
  width: 22px;
  height: 15px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
  flex-shrink: 0;
}

.bandera-chevron {
  font-size: 10px;
  color: #7a8ba3;
  margin-right: 1px;
}

.btn {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 8px;
  background: var(--azul);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  margin-top: 6px;
}

.btn:hover { background: var(--azul-claro); }

.btn-secundario {
  background: #fff;
  color: var(--azul);
  border: 1px solid var(--azul);
}

.msg {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  display: none;
}

.msg.error { background: #fdecea; color: var(--rojo); display: block; }
.msg.ok { background: #e9f8ef; color: var(--verde); display: block; }

/* App */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background: var(--azul);
  color: #fff;
  padding: 20px 0;
  flex-shrink: 0;
}

.sidebar .marca-app {
  padding: 0 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  margin-bottom: 12px;
}

.sidebar .marca-app strong { font-size: 17px; }
.sidebar .marca-app div { font-size: 12px; opacity: 0.75; margin-top: 2px; }

.marca-app-fila { display: flex; align-items: center; gap: 10px; }
.logo-confin { width: 34px; height: 34px; flex-shrink: 0; }

/* Mis cursos — grid tipo tarjetas */
.cursos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.curso-card {
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(30,58,95,0.06);
  transition: transform .15s, box-shadow .15s;
}

.curso-card:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(30,58,95,0.14); }

.curso-card-header {
  height: 62px;
  background: linear-gradient(135deg, var(--azul), var(--azul-claro));
  position: relative;
}

.curso-card-icono {
  position: absolute;
  bottom: -16px;
  left: 14px;
  width: 38px;
  height: 38px;
  background: #fff;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

.curso-card-body { padding: 24px 14px 14px; }
.curso-card-body h4 { margin: 0 0 4px; font-size: 14px; color: var(--texto); }
.curso-card-body .meta { font-size: 12px; color: #8a95a3; }

/* Contenidos estilo Drive */
.tabla-drive { width: 100%; border-collapse: collapse; }
.tabla-drive th {
  text-align: left;
  font-size: 12px;
  color: #8a95a3;
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--borde);
}
.tabla-drive td {
  padding: 10px;
  border-bottom: 1px solid var(--borde);
  font-size: 13.5px;
  vertical-align: middle;
}
.tabla-drive tr:hover td { background: #f8f9fb; }
.tabla-drive .icono-archivo { font-size: 18px; margin-right: 8px; }
.tabla-drive a { color: var(--azul); text-decoration: none; font-weight: 600; }

/* Correo estilo Gmail */
.correo-shell { display: flex; min-height: calc(100vh - 40px); gap: 0; }
.correo-nav { width: 200px; flex-shrink: 0; padding-right: 18px; }
.btn-redactar {
  width: 100%;
  padding: 12px;
  border-radius: 24px;
  border: none;
  background: var(--acento);
  color: #3a2e00;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(212,167,44,0.4);
  margin-bottom: 16px;
}
.correo-nav-item {
  padding: 9px 14px;
  border-radius: 0 20px 20px 0;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: #4a5568;
  display: flex;
  justify-content: space-between;
}
.correo-nav-item.activo { background: #d7e6fb; color: var(--azul); }
.correo-nav-item .contador { background: var(--rojo); color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 7px; }
.correo-main { flex: 1; min-width: 0; }
.correo-fila {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--borde);
  cursor: pointer;
}
.correo-fila:hover { box-shadow: inset 0 0 0 999px #f8f9fb; }
.correo-fila.no-leido { font-weight: 700; }
.correo-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--azul); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.correo-fila .cf-asunto { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.correo-fila .cf-remitente { width: 160px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.correo-fila .cf-fecha { width: 110px; text-align: right; flex-shrink: 0; font-size: 12px; color: #8a95a3; }

.amigo-fila {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--borde);
}

.anio-grupo { margin-bottom: 6px; }

.anio-titulo {
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.anio-titulo:hover { background: rgba(255,255,255,0.08); }

.asignatura-item {
  padding: 8px 20px 8px 34px;
  font-size: 13.5px;
  cursor: pointer;
  color: #d7e2ee;
}

.asignatura-item:hover, .asignatura-item.activo { background: rgba(255,255,255,0.14); color: #fff; }

.mini-foto-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 16px;
}

.mini-foto-wrap img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-footer {
  margin-top: 20px;
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 13px;
}

.sidebar-footer button {
  background: none;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 8px;
  width: 100%;
}

.main {
  flex: 1;
  padding: 28px 36px;
  overflow-y: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.topbar h2 { margin: 0; color: var(--azul); }
.pill {
  background: var(--acento);
  color: #3a2e00;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.subtabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--borde);
}

.subtab {
  padding: 9px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  color: #6b7785;
  border-bottom: 2px solid transparent;
}

.subtab.activo { color: var(--azul); border-bottom-color: var(--azul); }

.card {
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

.card h4 { margin: 0 0 4px; color: var(--azul); }
.card p { margin: 4px 0; font-size: 13.5px; color: #4a5568; }
.card .meta { font-size: 12px; color: #8a95a3; }

.card-acciones { margin-top: 10px; display: flex; gap: 8px; }
.card-acciones a, .card-acciones button {
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--borde);
  background: #f8f9fb;
  cursor: pointer;
  text-decoration: none;
  color: var(--texto);
}

.vacio { color: #8a95a3; font-size: 14px; padding: 20px 0; }

.panel-nuevo {
  background: #fff;
  border: 1px dashed var(--azul-claro);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 18px;
}

.panel-nuevo h4 { margin-top: 0; color: var(--azul); }

.fila { display: flex; gap: 10px; }
.fila .campo { flex: 1; }

/* Perfil */
.perfil-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}

.perfil-foto-card { text-align: center; }

.foto-wrap {
  width: 130px;
  height: 130px;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: #eef1f5;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--azul);
}

.foto-wrap img { width: 100%; height: 100%; object-fit: cover; }
.foto-placeholder { color: #8a95a3; font-size: 12.5px; }

.dato-fila {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--borde);
  font-size: 13.5px;
}

.dato-fila:last-of-type { border-bottom: none; }
.dato-fila span { color: #6b7785; }

.pregunta-bloque {
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fafbfc;
}

/* ---------- Responsive: menú móvil (sidebar off-canvas) ---------- */
.menu-toggle-fixed {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 70;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  border: none;
  background: var(--azul);
  color: #fff;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(30,58,95,0.35);
}

.menu-toggle-fixed svg { pointer-events: none; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,38,67,0.45);
  z-index: 55;
  opacity: 0;
  transition: opacity .2s ease;
}

.sidebar-overlay.activo { display: block; opacity: 1; }

.sidebar-cerrar-movil {
  display: none;
}

@media (max-width: 880px) {
  .menu-toggle-fixed { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    max-width: 82vw;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 34px rgba(0,0,0,0.4);
    overflow-y: auto;
  }

  .sidebar.abierto { transform: translateX(0); }

  .sidebar-cerrar-movil {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
  }

  .sidebar-cerrar-movil:hover { background: rgba(255,255,255,0.28); }

  .main {
    width: 100%;
    padding: 70px 16px 30px;
  }

  .perfil-grid { grid-template-columns: 1fr; }
  .fila { flex-direction: column; gap: 0; }
  .fila .campo { width: 100%; }
  .tabla-drive { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 600px) {
  .main { padding: 66px 12px 26px; }
  .topbar { flex-wrap: wrap; gap: 8px; }
  .topbar h2 { font-size: 18px; }
  .cursos-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .auth-wrap { padding: 16px; }
  .auth-card { padding: 24px 20px; }
}

@media (max-width: 400px) {
  .cursos-grid { grid-template-columns: 1fr; }
}
