/* base.css
   Reset + base layout + accesibilidad
   Mobile-first real
*/

/* -------------------------------------------------------------- */
/* Reset básico                                                    */
/* -------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px; /* Base mínima obligatoria */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-3);
  line-height: var(--lh-3);
  font-weight: var(--fw-regular);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden; /* Nunca scroll horizontal global */
}

/* -------------------------------------------------------------- */
/* Media                                                           */
/* -------------------------------------------------------------- */

img,
picture,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

svg {
  fill: currentColor;
}

/* -------------------------------------------------------------- */
/* Tipografía base                                                 */
/* -------------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--s-3);
  line-height: var(--lh-1);
  font-weight: var(--fw-semibold);
}

h1 { font-size: var(--fs-6); }
h2 { font-size: var(--fs-5); }
h3 { font-size: var(--fs-4); }
h4 { font-size: var(--fs-3); }

p {
  margin: 0 0 var(--s-4);
}

small {
  font-size: var(--fs-2);
  color: var(--muted);
}

/* -------------------------------------------------------------- */
/* Links                                                           */
/* -------------------------------------------------------------- */

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* -------------------------------------------------------------- */
/* Focus visible (accesibilidad real)                             */
/* -------------------------------------------------------------- */

:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-1);
}

/* -------------------------------------------------------------- */
/* Formularios base                                                */
/* -------------------------------------------------------------- */

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--s-3);
  border: var(--border-w) solid var(--border);
  border-radius: var(--r-1);
  background: var(--surface);
  font-size: var(--fs-3);
}

textarea {
  padding: var(--s-3);
  resize: vertical;
}

input:disabled,
select:disabled,
textarea:disabled,
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* -------------------------------------------------------------- */
/* Listas                                                          */
/* -------------------------------------------------------------- */

ul,
ol {
  margin: 0;
  padding-left: var(--s-5);
}

li {
  margin-bottom: var(--s-2);
}

/* -------------------------------------------------------------- */
/* Contenedor principal                                            */
/* -------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--s-4);
  padding-right: var(--s-4);
}

@media (min-width: 769px) {
  .container {
    padding-left: var(--s-6);
    padding-right: var(--s-6);
  }
}

/* -------------------------------------------------------------- */
/* Stack utility (espaciado vertical uniforme)                     */
/* -------------------------------------------------------------- */

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

/* -------------------------------------------------------------- */
/* Grid utility                                                    */
/* -------------------------------------------------------------- */

.grid {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: 1fr;
}

@media (min-width: 769px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

/* -------------------------------------------------------------- */
/* Layout principal                                                */
/* -------------------------------------------------------------- */

.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.layout-main {
  flex: 1;
  padding: var(--s-5) 0;
}

/* -------------------------------------------------------------- */
/* Header básico                                                   */
/* -------------------------------------------------------------- */

.header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--surface);
  border-bottom: var(--border-w) solid var(--border);
  padding: var(--s-3) var(--s-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* -------------------------------------------------------------- */
/* Bottom navigation (mobile-first)                               */
/* -------------------------------------------------------------- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  background: var(--surface);
  border-top: var(--border-w) solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: var(--s-2) 0;
}

.bottom-nav a {
  font-size: var(--fs-2);
  text-align: center;
  min-height: var(--tap);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

@media (min-width: 1025px) {
  .bottom-nav {
    display: none; /* Solo móvil */
  }
}

/* -------------------------------------------------------------- */
/* Modal base (mobile-first bottom sheet)                         */
/* -------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: var(--z-modal);
}

.modal[data-open="true"] {
  display: flex;
}

.modal-content {
  width: 100%;
  max-height: 90vh;
  background: var(--surface);
  border-top-left-radius: var(--r-3);
  border-top-right-radius: var(--r-3);
  padding: var(--s-5);
  overflow-y: auto;
  box-shadow: var(--shadow-3);
}

@media (min-width: 769px) {
  .modal {
    align-items: center;
  }

  .modal-content {
    width: 100%;
    max-width: 640px;
    border-radius: var(--r-3);
  }
}

/* -------------------------------------------------------------- */
/* Prefers reduced motion                                          */
/* -------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
/* =========================================================
   APP HEADER (tu HTML usa .app-header, no .header)
   Pegar al FINAL de base.css
========================================================= */

.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(255,255,255,0.80);
  backdrop-filter: blur(10px);
  border-bottom: var(--border-w) solid rgba(15, 23, 42, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-3) 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

/* Brand nicer */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text);
  text-decoration: none;
  font-weight: var(--fw-semibold);
}
.brand:hover { text-decoration: none; }

.brand-mark { font-size: 20px; }
.brand-name { font-size: var(--fs-4); }

/* Responsive header */
@media (max-width: 768px) {
  .header-inner { align-items: flex-start; }
  .header-actions { justify-content: flex-end; }
}

[hidden]{ display:none !important; }