/* ==========================================================
   BASE.CSS — Estilos globales de Cloud Tech System
   Se carga en: templates/base.html (todas las páginas)
   Orden: variables, reset, utilidades, botones, tarjetas (con la
          pastilla .estado y .enlace-flecha), acordeón .faq,
          migas y encabezado de página, header, footer y responsive.
   ========================================================== */


/* ========== 1. VARIABLES ========== */
:root {
  /* Colores de la marca */
  --navy: #1b2a5e;
  --sky: #3bb4ec;
  --sky-light: #e9f5fc;
  --green: #4ade80;
  --muted: #5d6886;
  --border: #e4e9f1;
  --white: #ffffff;
  --navy-dark: #15214b; /* hover de los botones azul marino */
  --amber: #fbbf24; /* pastilla "Próximamente" */

  /* Versiones transparentes de los mismos colores
     (brillos difusos y recuadros sobre fondo azul marino) */
  --sky-glow: rgba(59, 180, 236, 0.28);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --on-navy-muted: rgba(255, 255, 255, 0.72);
  --header-bg: rgba(255, 255, 255, 0.9); /* header blanco translúcido */

  /* Tipografías */
  --font-title: 'Plus Jakarta Sans', sans-serif;
  --font-text: 'Inter', sans-serif;

  /* Medidas */
  --container: 1200px;
  --header-height: 80px;
  --radius: 12px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  /* Sombras y animaciones */
  --shadow-sm: 0 4px 12px rgba(27, 42, 94, 0.06);
  --shadow: 0 14px 30px rgba(27, 42, 94, 0.1);
  --shadow-lg: 0 30px 60px rgba(27, 42, 94, 0.25);
  --transition: 0.25s ease;
}


/* ========== 2. RESET ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.6;
  color: var(--navy);
  background: var(--white);
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-title);
  line-height: 1.2;
}

p, dl, dd {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
  flex-shrink: 0;
}

button {
  font: inherit;
}

/* El atributo hidden siempre oculta, aunque la clase del elemento tenga display: flex */
[hidden] {
  display: none !important;
}

/* Texto solo para lectores de pantalla (etiquetas que no se ven) */
.sr-solo {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Al saltar a una sección con #ancla, deja espacio para el header fijo */
section[id] {
  scroll-margin-top: var(--header-height);
}


/* ========== 3. UTILIDADES (contenedor y encabezados de sección) ========== */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 96px 0;
}

/* Fondo celeste claro para alternar secciones */
.section--alt {
  background: var(--sky-light);
}

/* Bloque centrado: etiqueta + título + subtítulo */
.section-head {
  max-width: 760px;
  margin: 0 auto 48px;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sky);
}

.section-title {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--navy);
}

.section-subtitle {
  margin-top: 16px;
  color: var(--muted);
}


/* ========== 4. BOTONES ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition),
    border-color var(--transition), color var(--transition);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 3px;
}

.btn--primary {
  background: var(--navy);
  color: var(--white);
}

.btn--primary:hover {
  background: var(--navy-dark);
}

.btn--outline {
  background: var(--white);
  border-color: var(--border);
  color: var(--navy);
}

.btn--outline:hover {
  border-color: var(--sky);
  color: var(--sky);
}

.btn--sky {
  background: var(--sky);
  color: var(--white);
}

/* Bordes totalmente redondeados (ej. botón del header) */
.btn--pill {
  border-radius: var(--radius-pill);
}

/* Ocupa todo el ancho disponible */
.btn--block {
  width: 100%;
}


/* ========== 5. TARJETAS E ÍCONOS ========== */
.card {
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform var(--transition), box-shadow var(--transition);
}

/* Al pasar el mouse la tarjeta sube un poco y aparece la sombra.
   Solo en pantallas con mouse: en las táctiles el :hover se queda "pegado"
   después de tocar y la tarjeta no volvía a su lugar. */
@media (hover: hover) {
  .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
  }
}

.card__title {
  margin: 16px 0 8px;
  font-size: 1rem;
  font-weight: 600;
}

.card__text {
  font-size: 0.875rem;
  color: var(--muted);
}

/* Cuadrito que contiene un ícono o un número */
.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--sky-light);
  color: var(--navy);
}

.icon-box svg {
  width: 20px;
  height: 20px;
}

.icon-box--navy {
  background: var(--navy);
  color: var(--white);
}

.icon-box--sky {
  background: var(--sky);
  color: var(--white);
}


/* Pastilla de disponibilidad de un sistema (components/disponibilidad_sistema.html) */
.estado {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--navy);
  white-space: nowrap;
}

.estado--disponible {
  background: var(--green);
}

.estado--proximamente {
  background: var(--amber);
}

/* Enlace de texto celeste con flecha que se mueve al pasar el mouse */
.enlace-flecha {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--sky);
  transition: gap var(--transition), color var(--transition);
}

.enlace-flecha svg {
  width: 16px;
  height: 16px;
}

.enlace-flecha:hover {
  gap: 10px;
  color: var(--navy);
}


/* ========== 5b. ACORDEÓN DE PREGUNTAS (.faq) ==========
   Lo usan el FAQ del Home y el de cada sistema del catálogo.
   Cada pregunta es un <details>; main.js hace que al abrir una se cierren las demás. */
.faq__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
}

.faq__item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow var(--transition);
}

.faq__item[open] {
  box-shadow: var(--shadow-sm);
}

.faq__question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none; /* quita el triángulo por defecto */
}

/* Quita el triángulo por defecto en Safari */
.faq__question::-webkit-details-marker {
  display: none;
}

.faq__question:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: -2px;
  border-radius: var(--radius);
}

/* La flecha gira hacia arriba al abrir la pregunta */
.faq__icon {
  width: 20px;
  height: 20px;
  color: var(--sky);
  transition: transform var(--transition);
}

.faq__item[open] .faq__icon {
  transform: rotate(180deg);
}

.faq__answer {
  padding: 0 24px 20px;
  font-size: 0.9rem;
  color: var(--muted);
}


/* ========== 5c. MIGAS Y ENCABEZADO DE PÁGINA ==========
   Los usan el catálogo y las páginas de core (Servicios, Nosotros, Contacto, legales). */
/* Migas de pan: Inicio / Catálogo / ... */
.migas {
  margin-bottom: 20px;
}

.migas__lista {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--muted);
}

/* En el detalle las migas van alineadas a la izquierda */
.migas--izquierda .migas__lista {
  justify-content: flex-start;
}

/* Separador "/" entre elementos */
.migas__item + .migas__item::before {
  content: "/";
  margin-right: 6px;
  color: var(--border);
}

.migas__item[aria-current="page"] {
  font-weight: 600;
  color: var(--navy);
}

.migas__link:hover {
  color: var(--sky);
}

/* Encabezado centrado sobre fondo celeste claro */
.pagina-head {
  padding: 48px 0 40px;
  background: var(--sky-light);
  text-align: center;
}

.pagina-head__badge {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--sky-glow);
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--sky);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pagina-head__title {
  margin-top: 14px;
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.pagina-head__subtitle {
  max-width: 560px;
  margin: 12px auto 0;
  color: var(--muted);
}


/* ========== 6. HEADER ========== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px); /* difumina el contenido que pasa por detrás */
  border-bottom: 1px solid var(--border);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: var(--header-height);
}

/* Logo: en el header solo el nombre; en el footer y las páginas de acceso, nube en cuadrito celeste claro + nombre */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.logo__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--sky-light);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

.logo__icon svg {
  width: 22px;
  height: 22px;
}

/* Versión pequeña del ícono (footer) */
.logo__icon--small {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: none;
}

.logo__icon--small svg {
  width: 18px;
  height: 18px;
}

.logo__name {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--navy);
}

/* Logo subido en la Configuración del sitio (reemplaza nube + nombre) */
.logo__img {
  display: block;
  width: auto;
  max-width: 220px;
  height: 40px;
  object-fit: contain;
}

/* Versión pequeña del logo subido (footer) */
.logo__img--small {
  height: 32px;
}

/* Panel que agrupa menú + acciones (en escritorio ocupa el resto de la fila) */
.header__menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  gap: 24px;
}

/* Menú de navegación */
.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 0 auto;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  transition: color var(--transition);
}

.nav__link:hover {
  color: var(--navy);
}

/* Página actual */
.nav__link--active {
  font-weight: 600;
  color: var(--navy);
}

/* Pastilla "MARKETPLACE" junto a Catálogo */
.nav__badge {
  padding: 2px 8px;
  border: 1px solid var(--sky-glow);
  border-radius: var(--radius-pill);
  background: var(--sky-light);
  color: var(--sky);
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Selector de idioma EN | ES (un formulario pequeño por idioma) */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.lang-switch__form {
  display: flex;
  margin: 0;
}

.lang-switch__btn {
  padding: 4px;
  background: none;
  border: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--transition);
}

.lang-switch__btn:hover,
.lang-switch__btn--active {
  color: var(--navy);
}

.lang-switch__btn:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
  border-radius: 4px;
}

.lang-switch__sep {
  font-size: 0.75rem;
  color: var(--border);
}

.header__login {
  padding: 8px 4px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: color var(--transition);
}

.header__login:hover {
  color: var(--navy);
}

.header__signup {
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Menú del usuario con sesión (components/menu_usuario.html): un <details> con lista desplegable */
.usuario-menu {
  position: relative;
}

.usuario-menu__boton {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--white);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none; /* quita el triángulo del <summary> */
}

.usuario-menu__boton::-webkit-details-marker {
  display: none;
}

.usuario-menu__boton:hover {
  border-color: var(--sky);
}

.usuario-menu__boton:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
}

.usuario-menu__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy);
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--white);
}

.usuario-menu__nombre {
  max-width: 140px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.usuario-menu__flecha {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform var(--transition);
}

.usuario-menu[open] .usuario-menu__flecha {
  transform: rotate(180deg);
}

/* Lista desplegable (en escritorio flota debajo del botón) */
.usuario-menu__lista {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 110;
  min-width: 240px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.usuario-menu__datos {
  padding: 8px 10px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.usuario-menu__titulo {
  font-weight: 700;
}

.usuario-menu__correo {
  font-size: 0.8rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.usuario-menu__salir {
  margin: 0;
}

.usuario-menu__opcion {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--navy);
  text-align: left;
  cursor: pointer;
}

.usuario-menu__opcion svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.usuario-menu__opcion:hover,
.usuario-menu__opcion[aria-current="page"] {
  background: var(--sky-light);
}

.usuario-menu__opcion:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: -2px;
}

/* Botón hamburguesa: oculto en escritorio */
.header__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  margin-left: auto;
  padding: 0 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.header__toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--navy);
  transition: transform var(--transition), opacity var(--transition);
}

/* Cuando el menú está abierto, las 3 rayitas forman una X */
.header__toggle[aria-expanded="true"] .header__toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.header__toggle[aria-expanded="true"] .header__toggle-bar:nth-child(2) {
  opacity: 0;
}

.header__toggle[aria-expanded="true"] .header__toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}


/* ========== 7. FOOTER ========== */
.footer {
  padding: 64px 0 48px;
  background: var(--white);
  border-top: 1px solid var(--border);
}

/* Parte superior: marca (más ancha) + 3 columnas de enlaces */
.footer__top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--border);
}

/* Con redes sociales hay una columna más ("Síguenos") */
.footer__top--redes {
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
}

.footer__brand .logo__name {
  font-size: 1.05rem;
}

.footer__text {
  max-width: 360px;
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--muted);
}

.footer__contact {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.footer__contact-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--muted);
}

.footer__contact-item svg {
  width: 16px;
  height: 16px;
  color: var(--sky);
}

.footer__title {
  margin-bottom: 14px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy);
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer__link {
  font-size: 0.875rem;
  color: var(--muted);
  transition: color var(--transition);
}

.footer__link:hover {
  color: var(--sky);
}

.footer__link--strong {
  font-weight: 600;
  color: var(--navy);
}

/* Línea inferior con los derechos reservados */
.footer__bottom {
  padding-top: 28px;
  font-size: 0.75rem;
  color: var(--muted);
}


/* ========== 8. RESPONSIVE ========== */

/* Pantallas medianas: el header no cabe en una fila y pasa a menú hamburguesa */
@media (max-width: 1024px) {
  .header__toggle {
    display: inline-flex;
  }

  /* El panel (menú + idioma + cuenta) baja debajo del header */
  .header__menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 8px 24px 24px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

  /* Clase que agrega main.js al tocar la hamburguesa */
  .header__menu--open {
    display: flex;
  }

  .nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
  }

  .nav__link {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }

  .header__actions {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .header__signup {
    flex: 1 1 100%;
  }

  /* En el panel móvil, el menú del usuario ocupa todo el ancho y la lista se abre debajo, sin flotar */
  .usuario-menu {
    flex: 1 1 100%;
  }

  .usuario-menu__lista {
    position: static;
    margin-top: 8px;
    box-shadow: none;
  }
}

/* Tablet: el footer pasa a marca arriba y enlaces en 3 columnas */
@media (max-width: 860px) {
  .footer__top {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer__brand {
    grid-column: 1 / -1;
  }
}

/* Móvil */
@media (max-width: 600px) {
  .container {
    padding: 0 16px;
  }

  .section {
    padding: 64px 0;
  }

  .header__menu {
    padding: 8px 16px 20px;
  }

  .footer {
    padding: 48px 0 32px;
  }

  .footer__top {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  .footer__bottom {
    text-align: center;
  }

  .faq__question {
    padding: 16px 18px;
  }

  .faq__answer {
    padding: 0 18px 18px;
  }
}
