/* ============================================================
   AL Plataformas — estilos a mano
   Paleta oficial del logo Active Learning.
   ============================================================ */
:root {
  --brand-red: #E2001A;
  --brand-blue: #29ABE2;
  --brand-green: #95C11F;
  --brand-yellow: #FFD500;
  --brand-black: #111111;
  --cream: #EFEBE1;

  --ink: #2b2b2b;
  --muted: #8a8578;
  --line: #d9d3c6;
  --card: #ffffff;

  --radius: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --maxw: 1320px;

  /* Paleta "portal" usada en el nuevo home (header, hero, cards). */
  --ink-2: #1E2433;
  --ink-soft: #5B5F73;
  --hairline: #EEF0F5;
  --shadow-soft: 0 10px 30px -18px rgba(30, 41, 59, 0.2);
  --shadow-card: 0 6px 18px -10px rgba(30, 41, 59, 0.18);
  --shadow-card-hover: 0 18px 32px -14px rgba(30, 41, 59, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.5;
}

a { color: inherit; }

/* El home tiene su propio fondo y vive dentro de un "app shell" centrado
   (tarjeta grande con esquinas redondeadas); el resto de las páginas
   (admin, error) conservan el fondo crema original sin shell. */
.page-home { background: #E9EDF6; padding: 28px 20px; min-height: 100vh; }
.app-shell {
  max-width: var(--maxw);
  margin: 0 auto;
  background: #fff;
  border-radius: 28px;
  border: 1px solid var(--hairline);
  box-shadow: 0 30px 60px -30px rgba(30, 41, 59, 0.28);
  overflow: hidden;
}

/* ---------------- Header ---------------- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--hairline);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}
.site-header__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 40px;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 30px;
  text-decoration: none;
}
.brand__logo { height: 46px; width: auto; display: block; }
.brand__sub {
  color: var(--ink-soft);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.1px;
  line-height: 1;
}

.site-nav { display: flex; align-items: center; gap: 40px; }
.site-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  color: var(--ink-soft);
  padding: 10px 2px;
  line-height: 1;
}
.site-nav__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}
.site-nav__icon svg { width: 21px; height: 21px; display: block; }
.site-nav__link:hover { color: #2952E3; }
.site-nav__link.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -13px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #4F6DF5, #6366F1);
}

.site-nav__profile {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding-left: 0;
  cursor: default;
}
.site-nav__avatar {
  width: 43px;
  height: 43px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #EDE4FB;
  color: #7C4FE0;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.2px;
  flex-shrink: 0;
}
.site-nav__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.site-nav__chevron svg { width: 16px; height: 16px; display: block; }

/* ---------------- Hero ---------------- */
.hero {
  background: linear-gradient(120deg, #EEF2FF 0%, #F3EEFE 55%, #EAF6FE 100%);
  overflow: hidden;
}
.hero__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 56px 40px;
  min-height: 340px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 32px;
}
.hero__title {
  margin: 0 0 16px;
  font-size: clamp(2.1rem, 3.4vw, 2.85rem);
  line-height: 1.2;
  font-weight: 800;
  color: var(--ink-2);
}
.hero__brand { color: #4338CA; }
.hero__text {
  margin: 0 0 24px;
  max-width: 480px;
  color: var(--ink-soft);
  font-size: 1.1rem;
  line-height: 1.65;
}
.hero__accent-line {
  display: block;
  width: 64px;
  height: 5px;
  border-radius: 4px;
  background: linear-gradient(90deg, #4F6DF5, #38BDF8);
}

.hero__art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
}

/* Nubes suaves detrás de la tarjeta flotante. */
.hero-decor__cloud {
  position: absolute;
  background: #fff;
  border-radius: 50px;
  opacity: 0.85;
}
.hero-decor__cloud--a {
  width: 120px;
  height: 44px;
  top: 2%;
  left: 2%;
  box-shadow: 34px 8px 0 -8px #fff, -18px 10px 0 -12px #fff;
}
.hero-decor__cloud--b {
  width: 84px;
  height: 34px;
  bottom: 10%;
  right: 0;
  opacity: 0.65;
}

/* Hojas decorativas (formas simples con radios asimétricos). */
.hero-decor__leaf {
  position: absolute;
  border-radius: 0 100% 0 100%;
}
.hero-decor__leaf--a {
  width: 72px;
  height: 112px;
  left: 2%;
  bottom: -6%;
  background: linear-gradient(160deg, #A7E3C4, #5FBE8B);
  transform: rotate(-18deg);
  opacity: 0.9;
}
.hero-decor__leaf--b {
  width: 50px;
  height: 82px;
  left: 15%;
  bottom: 0%;
  background: linear-gradient(160deg, #BFD9F7, #6FA3EA);
  transform: rotate(12deg);
  opacity: 0.85;
}

/* Avioncito de papel con línea punteada. */
.hero-decor__plane {
  position: absolute;
  top: 4%;
  right: 4%;
  width: 96px;
  height: 48px;
  color: #94A3B8;
}
.hero-decor__dash { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-decor__plane-icon {
  position: absolute;
  top: -2px;
  right: 0;
  width: 26px;
  height: 26px;
}
.hero-decor__plane-icon svg { width: 100%; height: 100%; }

.hero-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 26px 50px -20px rgba(30, 41, 59, 0.28);
  transform: rotate(-2deg);
}
.hero-card__bar {
  height: 8px;
  border-radius: 6px;
  margin-bottom: 20px;
  background: linear-gradient(
    to right,
    var(--brand-red) 0 25%,
    var(--brand-blue) 25% 50%,
    var(--brand-green) 50% 75%,
    var(--brand-yellow) 75% 100%
  );
}
.hero-card__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.hero-mini {
  aspect-ratio: 1;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px -8px rgba(30, 41, 59, 0.22);
}
.hero-mini svg { width: 32px; height: 32px; display: block; }
.hero-mini--rose    { background: #FCEEE3; }
.hero-mini--indigo  { background: #EDF1FE; }
.hero-mini--emerald { background: #EAF3FE; }
.hero-mini--amber   { background: #FDF6E1; }
.hero-mini--violet  { background: #F2EFFE; }
.hero-mini--sky     { background: #FDEEF5; }

/* ---------------- Catálogo público ---------------- */
.catalog {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 40px 40px;
}

.categories {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
/* Si el número de categorías es impar, la última ocupa el ancho completo
   en vez de quedar sola en la columna izquierda con un vacío al lado. */
.categories > *:last-child:nth-child(odd) { grid-column: 1 / -1; }
.categories > *:last-child:nth-child(odd) .platform-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.category {
  border: 1px solid var(--hairline);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  padding: 24px;
}
.category__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.category__icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.category__icon svg { width: 19px; height: 19px; }
.category__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.category--indigo { background: #EEF0FE; border-color: #DBDFFC; }
.category--indigo .category__icon { background: linear-gradient(135deg, #818CF8, #4338CA); }
.category--indigo .category__title { color: #4338CA; }

.category--sky { background: #E9F7FE; border-color: #D3EEFC; }
.category--sky .category__icon { background: linear-gradient(135deg, #38BDF8, #0369A1); }
.category--sky .category__title { color: #0369A1; }

.category--violet { background: #F5F1FE; border-color: #E8DFFC; }
.category--violet .category__icon { background: linear-gradient(135deg, #C4B5FD, #7C3AED); }
.category--violet .category__title { color: #7C3AED; }

.category--green { background: #EDFBF2; border-color: #D3F3DE; }
.category--green .category__icon { background: linear-gradient(135deg, #6EE7B7, #15803D); }
.category--green .category__title { color: #15803D; }

.category--amber { background: #FEF6E7; border-color: #FBE8C6; }
.category--amber .category__icon { background: linear-gradient(135deg, #FBBF24, #B45309); }
.category--amber .category__title { color: #B45309; }

.platform-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
/* Categoría con una sola plataforma (ej. Formación Integral): la card ocupa
   todo el ancho interno en vez de quedar pegada a la izquierda. */
.platform-card--wide { grid-column: 1 / -1; }

.platform-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  padding: 22px 18px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.platform-card:hover,
.platform-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}
.platform-card__logo {
  height: 64px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.platform-card__logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.platform-card__placeholder {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #F3F4F8;
  color: var(--muted);
}
.platform-card__placeholder svg { width: 22px; height: 22px; }
.platform-card__name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-2);
  text-align: center;
}

/* ---------------- Botones ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
  color: var(--brand-black);
}
.btn:hover { filter: brightness(0.94); }
.btn:active { transform: translateY(1px); }
.btn--sm { padding: 7px 12px; font-size: 0.85rem; }

.btn--yellow { background: var(--brand-yellow); color: var(--brand-black); }
.btn--blue   { background: var(--brand-blue);   color: #fff; }
.btn--green  { background: var(--brand-green);  color: #fff; }
.btn--red    { background: var(--brand-red);    color: #fff; }
.btn--ghost  { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn--primary {
  background: linear-gradient(90deg, #4F6DF5, #2952E3);
  color: #fff;
  border-radius: 999px;
  padding: 12px 24px;
}
.btn--primary:hover { filter: brightness(1.06); }

/* ---------------- ABM ---------------- */
.admin {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 24px 64px;
}
.admin__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.admin__head h1 { margin: 0; font-size: 1.6rem; }

.flash {
  background: #eaf7d8;
  border: 1px solid var(--brand-green);
  color: #3d5000;
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.errors {
  background: #fde3e6;
  border: 1px solid var(--brand-red);
  color: #7a0010;
  padding: 8px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.errors ul { margin: 6px 0; padding-left: 20px; }

/* Tabla */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.table th, .table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table th { background: #faf8f2; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }
.table__actions { white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.table__url a { color: var(--brand-blue); }
.thumb {
  width: 56px; height: 56px; object-fit: contain;
  background: #faf8f2; border-radius: 6px; border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
}
.thumb--empty { font-size: 1.2rem; }
.tag {
  background: var(--brand-yellow);
  color: var(--brand-black);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.muted { color: var(--muted); }
.inline { display: inline; margin: 0; }

/* Formulario */
.form {
  background: #fff;
  padding: 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 620px;
}
.field { margin-bottom: 20px; display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; }
.field input[type="text"],
.field input[type="url"] {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 1rem;
}
.field input:focus { outline: 2px solid var(--brand-blue); border-color: transparent; }
.field small { color: var(--muted); }
.current-image { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.current-image img {
  width: 80px; height: 80px; object-fit: contain;
  background: #faf8f2; border: 1px solid var(--line); border-radius: 6px; padding: 6px;
}
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.form__actions { display: flex; gap: 12px; margin-top: 8px; }

/* ---------------- Vacío / footer ---------------- */
.empty {
  text-align: center;
  padding: 64px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.site-footer__bar {
  height: 6px;
  background: linear-gradient(
    to right,
    var(--brand-red) 0 25%,
    var(--brand-blue) 25% 50%,
    var(--brand-green) 50% 75%,
    var(--brand-yellow) 75% 100%
  );
}
.site-footer p { text-align: center; color: var(--muted); padding: 14px; margin: 0; font-size: 0.9rem; }

@media (max-width: 900px) {
  .page-home { padding: 16px; }
  .hero__inner {
    grid-template-columns: 1fr;
    padding: 36px 24px;
    min-height: auto;
  }
  .hero__art { order: -1; max-width: 280px; min-height: 200px; margin: 0 auto 8px; }
  .hero-decor__cloud, .hero-decor__plane { display: none; }
  .hero__content { text-align: center; }
  .hero__text { margin-left: auto; margin-right: auto; }
  .hero__accent-line { margin: 0 auto; }
  .categories { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .page-home { padding: 0; }
  .app-shell { border-radius: 0; border: none; box-shadow: none; }
  .site-header__inner { padding: 10px 16px; min-height: 56px; gap: 10px; }
  .brand { gap: 8px; }
  .brand__logo { height: 26px; }
  .brand__sub { font-size: 0.78rem; }
  .site-nav { gap: 14px; }
  .admin__head { flex-direction: column; align-items: flex-start; }
  .table__actions { flex-direction: column; align-items: stretch; }
  .catalog { padding: 28px 20px 40px; }
  .category { padding: 16px; }
  .platform-grid { grid-template-columns: 1fr; }
  .hero-decor__leaf { display: none; }
}

@media (max-width: 480px) {
  .site-header__inner { padding: 10px 12px; gap: 6px; }
  .site-nav { gap: 10px; }
  .site-nav__label { display: none; }
  .site-nav__link { padding: 6px; }
  .site-nav__avatar { width: 24px; height: 24px; font-size: 0.6rem; }
  .site-nav__profile { padding-left: 0; gap: 4px; }
}

/* ---------------- Login / Auth ---------------- */
.page-auth {
  background: #E9EDF6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth__card {
  background: #fff;
  width: 100%;
  max-width: 420px;
  border-radius: 24px;
  border: 1px solid var(--hairline);
  box-shadow: 0 30px 60px -30px rgba(30, 41, 59, 0.28);
  padding: 40px 36px;
  text-align: center;
}
.auth__logo { height: 52px; width: auto; margin-bottom: 20px; }
.auth__title { margin: 0 0 10px; font-size: 1.5rem; color: var(--ink-2); }
.auth__text { margin: 0 0 24px; color: var(--ink-soft); line-height: 1.6; }
.auth__error {
  background: #fde3e6;
  border: 1px solid var(--brand-red);
  color: #7a0010;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 0.92rem;
  line-height: 1.5;
  text-align: left;
}
.auth__google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 13px 18px;
  border: 1px solid #DADCE0;
  border-radius: 12px;
  background: #fff;
  color: #3c4043;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.auth__google:hover { background: #F7F8FA; box-shadow: 0 2px 8px rgba(30,41,59,0.1); }
.auth__google-icon { display: inline-flex; }
.auth__google-icon svg { width: 20px; height: 20px; display: block; }
.auth__back {
  display: inline-block;
  margin-top: 20px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.92rem;
}
.auth__back:hover { color: #2952E3; }

/* Botón de cerrar sesión en el header */
.site-nav__logout { display: inline-flex; margin: 0; }
.site-nav__logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.site-nav__logout-btn:hover { background: #FDE8EC; color: var(--brand-red); }
.site-nav__logout-btn svg { width: 19px; height: 19px; display: block; }
