/* ========================================================================== */
/*  app.css  |  Mobile-First Responsive Design                               */
/*  Breakpoints: 576px (sm), 768px (md), 992px (lg), 1200px (xl)             */
/* ========================================================================== */

:root {
  /* Colores */
  --clr-bg: #f8fafc;
  --clr-primary: #1e3a8a;
  --clr-card: #fff;
  --clr-main-bg: #f2f2f2;
  --clr-text: #1f2937;
  --clr-border: #e5e7eb;
  --clr-muted: #6b7280;

  /* Espaciado base */
  --space-xs: .25rem;
  --space-s: .5rem;
  --space-m: 1rem;
  --space-l: 2rem;
  --space-xl: 3rem;

  /* Otros */
  --radius: 8px;
  --shadow: 0 4px 8px rgba(0,0,0,.08);
  --shadow-light: 0 2px 4px rgba(0,0,0,.06);
  --header-height: 0px;

  /* Breakpoints como variables (solo documentación) */
  --bp-sm: 576px;
  --bp-md: 768px;
  --bp-lg: 992px;
  --bp-xl: 1200px;

  /* Logo colors */
  --logo-valora: #22D3EE;
  --logo-talento: #FBBF24;
}

/* ========================================================================== */
/* BASE STYLES - Mobile First                                                */
/* ========================================================================== */

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

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  background: var(--clr-bg);
  color: var(--clr-text);
  line-height: 1.5;
  font-size: 16px;
}

/* ========================================================================== */
/* LAYOUT - Mobile First                                                     */
/* ========================================================================== */

/* Contenedor raíz - Mobile */
.app {
  display: grid;
  grid-template-areas:
    "header"
    "main"
    "footer";
  grid-template-rows: auto 1fr auto;
  min-height: 100vh; /* Cambiado de height a min-height para móviles */
}

.app-header { grid-area: header; }
.app-main {
  grid-area: main;
  overflow-y: auto;
  position: relative;
}
.app-footer { grid-area: footer; }

/* Sidebar - Oculto por defecto en móvil */
.app-aside {
  grid-area: aside;
  display: none;
  overflow-y: auto;
  background: var(--clr-primary);
  color: #fff;
  padding: var(--space-m);
  box-shadow: var(--shadow);
  position: relative;
}

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

.app-aside a {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  padding: var(--space-s) 0;
  color: inherit;
  text-decoration: none;
  transition: background .2s;
}

.nav-icon {
  width: 1.5rem;
  text-align: center;
  font-size: 1.1rem;
}

.nav-label {
  white-space: nowrap;
}

.app-aside a:hover {
  background: rgba(255,255,255,.1);
  border-radius: var(--radius);
  padding-left: var(--space-s);
}

/* Desktop - Sidebar visible */
@media (min-width: 768px) {
  .app.has-aside {
    grid-template-areas:
      "header header"
      "aside main"
      "footer footer";
    grid-template-columns: clamp(160px, 14vw, 200px) 1fr;
  }

  .app.has-aside .app-aside {
    display: block;
    padding: var(--space-m);
    padding-top: var(--header-height, var(--space-m));
  }

  /* Sidebar colapsado */
  body.sidebar-collapsed .app.has-aside {
    grid-template-columns: 3.5rem 1fr;
  }

  body.sidebar-collapsed .app-aside {
    width: 3.5rem;
    padding: var(--space-s) 0;
    padding-top: var(--header-height);
  }

  body.sidebar-collapsed .app-aside ul {
    display: block;
  }

  body.sidebar-collapsed .app-aside .menu-toggle {
    right: .35rem;
  }

  body.sidebar-collapsed .app-aside a {
    justify-content: center;
    padding: .6rem 0;
  }

  body.sidebar-collapsed .app-aside .nav-label {
    display: none;
  }

  body.sidebar-collapsed .app-aside .toggle-icon {
    transform: rotate(180deg);
  }
}

/* ========================================================================== */
/* HEADER - Mobile First                                                     */
/* ========================================================================== */

.app-header {
  display: flex;
  flex-direction: column; /* Mobile: Stack vertical */
  align-items: flex-start;
  gap: var(--space-s);
  padding: var(--space-m);
  background: var(--clr-primary);
  color: #fff;
  box-shadow: var(--shadow);
}

.menu-toggle {
  background: none;
  border: 0;
  font-size: 1.5rem;
  cursor: pointer;
  color: #fff;
  padding: var(--space-s);
  min-width: 44px; /* Área táctil mínima */
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-aside .menu-toggle {
  position: absolute;
  bottom: var(--space-m);
  right: var(--space-m);
}

.user-nav {
  display: flex;
  gap: var(--space-s);
  flex-wrap: wrap;
  width: 100%;
}

.user-nav a {
  text-decoration: none;
  color: #fff;
  padding: var(--space-xs) var(--space-s);
  border-radius: var(--radius);
  transition: background .2s;
}

.user-nav a:hover {
  background: rgba(255,255,255,.15);
}

/* Header left section with back button */
.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-m);
  flex: 1;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-s);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  transition: background 0.2s;
  font-size: 0.9rem;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.25);
}

.btn-back i {
  font-size: 1.2rem;
}

/* Mobile: solo mostrar icono */
.btn-back-text {
  display: none;
}

/* Desktop header */
@media (min-width: 576px) {
  .app-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .user-nav {
    width: auto;
  }

  /* Desktop: mostrar texto en el botón */
  .btn-back-text {
    display: inline;
  }
}

/* ========================================================================== */
/* LOGO - Responsive                                                         */
/* ========================================================================== */

.app-header .logo-wrap {
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: 0;
}

.app-header .logo {
  margin: 0;
  display: inline-flex;
  gap: .35ch;
  font-weight: 900;
  letter-spacing: .02em;
  line-height: 1.05;
  text-rendering: geometricPrecision;
  font-size: clamp(1.25rem, 5vw, 2rem); /* Mobile-first responsive */
  white-space: nowrap;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.25));
  text-decoration: none;
}

.app-header .logo .valora { color: var(--logo-valora); }
.app-header .logo .talento {
  color: var(--logo-talento);
  position: relative;
}

.app-header .logo .talento::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -.08em;
  height: .15em;
  background: currentColor;
  opacity: .35;
  border-radius: 999px;
  transition: opacity .2s ease;
}

.app-header .logo:hover .talento::after { opacity: .6; }

.app-header .logo:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: var(--radius);
}

@media (prefers-reduced-motion: reduce) {
  .app-header .logo { filter: none; }
  .app-header .logo .talento::after { transition: none; }
}

@media print {
  .app-header .logo { filter: none; }
}

/* ========================================================================== */
/* BUTTONS & INPUTS - Mobile First                                           */
/* ========================================================================== */

button,
input,
select,
textarea {
  border-radius: var(--radius);
  font-family: inherit;
}

/* Botones - Táctiles en móvil */
button,
.btn {
  background: var(--clr-primary);
  color: #fff;
  border: 0;
  padding: .75rem 1.25rem;
  cursor: pointer;
  min-height: 44px; /* Área táctil iOS/Android */
  font-size: 1rem;
  font-weight: 500;
  transition: opacity .2s;
}

button:hover,
.btn:hover {
  opacity: .9;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

/* Desktop - Botones más compactos */
@media (min-width: 768px) {
  button,
  .btn {
    padding: .6rem 1.2rem;
    min-height: 36px;
    font-size: .9375rem;
  }
}

/* Inputs - Mobile first */
input,
select,
textarea {
  border: 1px solid var(--clr-border);
  padding: .65rem .75rem;
  width: 100%;
  box-sizing: border-box;
  font-size: 1rem; /* Evita zoom en iOS */
  min-height: 44px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--clr-primary);
  outline-offset: 2px;
}

/* ========================================================================== */
/* BADGES                                                                    */
/* ========================================================================== */

.badge-green,
.badge-gray,
.badge-blue {
  display: inline-block;
  padding: .25rem .5rem;
  border-radius: var(--radius);
  font-size: .8125rem;
  color: #fff;
  font-weight: 500;
  white-space: nowrap;
}

.badge-green { background: #16a34a; }
.badge-gray { background: #9ca3af; }
.badge-blue { background: #1d4ed8; }

/* ========================================================================== */
/* CARDS - Mobile First                                                      */
/* ========================================================================== */

.card {
  background: var(--clr-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-m);
  transition: transform .2s;
  display: block;
  text-decoration: none;
  color: inherit;
}

.card:hover {
  transform: translateY(-2px);
}

.card .icon {
  width: 2.5rem; /* Cambiado de px fijo */
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-primary);
  border-radius: var(--radius);
  margin-bottom: var(--space-s);
  font-size: 1.5rem;
}

/* Desktop - Iconos más grandes */
@media (min-width: 768px) {
  .card .icon {
    width: 3rem;
    height: 3rem;
    font-size: 1.75rem;
  }
}

/* ========================================================================== */
/* CONTAINERS - Mobile First                                                 */
/* ========================================================================== */

.pagina_completa {
  width: 100%;
  margin: 0;
  padding: var(--space-m);
  background: var(--clr-main-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.pagina_completa > * + * {
  margin-top: var(--space-m);
}

/* Desktop - Más padding */
@media (min-width: 768px) {
  .pagina_completa {
    padding: var(--space-l) var(--space-m);
  }
}

/* Contenedor pequeño (login, etc) */
.contenedor-pequeno {
  width: 100%;
  max-width: 420px;
  margin: var(--space-m) auto;
  padding: var(--space-m);
  background: var(--clr-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-light);
}

.contenedor-pequeno header {
  text-align: center;
}

@media (min-width: 576px) {
  .contenedor-pequeno {
    margin: var(--space-l) auto;
    padding: var(--space-l) var(--space-m);
  }
}

/* ========================================================================== */
/* FORMS - Mobile First                                                      */
/* ========================================================================== */

.login-form,
.new-test fieldset,
.profile fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 var(--space-m);
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}

.new-test label,
.profile label {
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--clr-muted);
  font-size: .875rem;
  font-weight: 500;
}

/* Field row - Mobile: columna, Desktop: fila */
.new-test .field-row,
.profile .field-row {
  display: flex;
  flex-direction: column; /* Mobile first */
  gap: var(--space-m);
}

.new-test .field-row fieldset,
.profile .field-row fieldset {
  flex: 1;
  margin: 0;
}

/* Desktop - Campos en fila */
@media (min-width: 768px) {
  .new-test .field-row,
  .profile .field-row {
    flex-direction: row;
  }
}

/* Field group */
.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  font-size: .9375rem;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

/* ========================================================================== */
/* TABLES - Mobile First (Cards en móvil, Tabla en desktop)                  */
/* ========================================================================== */

.dashboard .tabla_tests {
  overflow-x: auto;
  background: var(--clr-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-light);
  padding: var(--space-s);
}

.dashboard .tabla_tests table {
  width: 100%;
  border-collapse: collapse;
}

.dashboard .tabla_tests th,
.dashboard .tabla_tests td {
  padding: .65rem .8rem;
  border-bottom: 1px solid var(--clr-border);
  text-align: left;
}

.dashboard .tabla_tests tbody tr:hover {
  background: rgba(0, 0, 0, .03);
}

/* Tabla secundaria (tabla_sub) - Mobile: Cards */
.tabla_sub {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-s);
}

/* Mobile: Transformar tabla a cards */
@media (max-width: 767px) {
  .tabla_sub thead {
    display: none;
  }

  .tabla_sub tbody,
  .tabla_sub tr {
    display: block;
  }

  .tabla_sub tr {
    border: 1px solid var(--clr-border);
    border-radius: var(--radius);
    margin-bottom: var(--space-m);
    padding: var(--space-m);
    background: var(--clr-card);
  }

  .tabla_sub td {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--space-s);
    padding: var(--space-s) 0;
    border: none;
    text-align: left;
  }

  .tabla_sub td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--clr-muted);
    font-size: .875rem;
  }

  /* Botones en cards móviles */
  .tabla_sub td form {
    grid-column: 1 / -1;
  }

  .tabla_sub td button,
  .tabla_sub td a {
    display: inline-block;
    margin-top: var(--space-xs);
  }
}

/* Desktop: Tabla normal */
@media (min-width: 768px) {
  .dashboard .tabla_tests {
    padding: var(--space-m);
  }

  .tabla_sub th,
  .tabla_sub td {
    padding: .65rem .8rem;
    border-bottom: 1px solid var(--clr-border);
    text-align: left;
    white-space: nowrap;
  }
}

/* Tabla genérica (.tabla) */
.tabla {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-m);
  overflow-x: auto;
  display: block;
}

.tabla th,
.tabla td {
  border: 1px solid var(--clr-border);
  padding: .6rem;
  text-align: left;
}

@media (min-width: 768px) {
  .tabla {
    display: table;
  }
}

/* ========================================================================== */
/* DASHBOARD & GRIDS - Mobile First                                          */
/* ========================================================================== */

.grid-cards {
  display: grid;
  grid-template-columns: 1fr; /* Mobile: 1 columna */
  gap: var(--space-m);
}

@media (min-width: 576px) {
  .grid-cards {
    grid-template-columns: repeat(2, 1fr); /* Tablet: 2 columnas */
  }
}

@media (min-width: 992px) {
  .grid-cards {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); /* Desktop: auto */
  }
}

.dashboard.grafico {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-m);
  margin-top: var(--space-l);
}

.dashboard.grafico .card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  text-align: center;
  min-height: 140px;
}

.dashboard.grafico .card .icon {
  width: 3rem;
  height: 3rem;
  font-size: 1.75rem;
  margin-bottom: var(--space-s);
}

.dashboard.grafico .card .count {
  font-size: 1.5rem;
  font-weight: 600;
}

.dashboard.grafico .card p {
  margin: 0;
  font-size: .875rem;
}

@media (min-width: 768px) {
  .dashboard.grafico {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .dashboard.grafico .card {
    min-height: 180px;
  }
}

/* ========================================================================== */
/* PROFILE - Mobile First                                                    */
/* ========================================================================== */

.profile-card {
  background: var(--clr-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-light);
  padding: var(--space-m);
  margin-bottom: var(--space-m);
}

.profile-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}

.profile-header-content h2 {
  margin: 0 0 var(--space-xs);
  font-size: 1.25rem;
}

.profile-header-content p {
  color: var(--clr-muted);
  margin: 0;
  font-size: .875rem;
}

.profile-header-info {
  display: flex;
  gap: var(--space-m);
  align-items: center;
}

.profile-header-info img {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-light);
}

.profile-header-details h3 {
  margin: 0 0 var(--space-xs);
  color: var(--clr-text);
  font-size: 1rem;
}

.profile-header-details .email {
  font-size: .8125rem;
  color: var(--clr-muted);
  margin: var(--space-xs) 0;
}

.profile-header-details .meta {
  font-size: .75rem;
  color: var(--clr-muted);
  margin: 0.125rem 0;
}

/* Desktop */
@media (min-width: 768px) {
  .profile-card {
    padding: var(--space-l);
  }

  .profile-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-m);
  }

  .profile-header-content h2 {
    font-size: 1.5rem;
  }

  .profile-header-content p {
    font-size: .9rem;
  }

  .profile-header-info img {
    width: 3.5rem;
    height: 3.5rem;
  }

  .profile-header-details h3 {
    font-size: 1.1rem;
  }

  .profile-header-details .email {
    font-size: .875rem;
  }
}

.profile fieldset {
  background: var(--clr-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-light);
  padding: var(--space-m);
  border: 0;
  margin: 0;
}

.profile legend {
  font-weight: 600;
  margin-bottom: var(--space-m);
  color: var(--clr-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: .9375rem;
  padding: 0 0 var(--space-s) 0;
  border-bottom: 1px solid var(--clr-border);
}

.profile legend label {
  font-weight: 500;
  font-size: .875rem;
  color: var(--clr-text);
  display: flex;
  align-items: center;
  gap: .375rem;
  cursor: pointer;
  margin: 0;
}

.profile legend input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--clr-primary);
}

.form-grid {
  display: grid;
  gap: var(--space-m);
  grid-template-columns: 1fr; /* Mobile: 1 columna */
}

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.form-field,
.profile select,
.profile input[type="text"],
.profile input[type="url"] {
  width: 100%;
  padding: .5rem .65rem;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  background: var(--clr-card);
  color: var(--clr-text);
  box-sizing: border-box;
  font-size: .875rem;
}

.profile textarea {
  min-height: 70px;
  resize: vertical;
  font-family: 'Courier New', Courier, monospace;
  font-size: .8125rem;
  line-height: 1.4;
}

.profile select {
  cursor: pointer;
}

.profile fieldset > .form-field,
.profile fieldset > input,
.profile fieldset > select,
.profile fieldset > textarea {
  margin-bottom: var(--space-s);
}

.profile fieldset > .form-field:last-child,
.profile fieldset > input:last-child,
.profile fieldset > select:last-child,
.profile fieldset > textarea:last-child {
  margin-bottom: 0;
}

.ok {
  color: #15803d;
  font-weight: 500;
  margin: var(--space-m) 0;
  font-size: .875rem;
  padding: var(--space-s) var(--space-m);
  background: #f0fdf4;
  border-left: 3px solid #15803d;
  border-radius: var(--radius);
}

.profile button {
  display: inline-block;
  padding: .6rem 1rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--clr-primary);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-light);
  width: auto;
  min-height: 40px;
  font-size: .9375rem;
}

/* ========================================================================== */
/* FORMULARIO CREACIÓN (Procesos) - Mobile First                             */
/* ========================================================================== */

.formulario-creacion {
  margin-top: var(--space-m);
  background: rgba(255, 255, 255, .9);
  padding: var(--space-m);
  border-radius: var(--radius);
  box-shadow: var(--shadow-light);
}

.formulario-creacion fieldset {
  border: none;
  padding: 0;
  margin-bottom: var(--space-m);
}

.formulario-creacion label {
  display: block;
  margin-top: var(--space-m);
  font-weight: 500;
  margin-bottom: var(--space-xs);
}

.formulario-creacion input,
.formulario-creacion textarea {
  width: 100%;
  padding: .65rem;
  border-radius: var(--radius);
  border: 1px solid var(--clr-border);
  margin-top: var(--space-xs);
  min-height: 44px;
}

.formulario-creacion button {
  margin-top: var(--space-m);
  padding: .75rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  background-color: var(--clr-primary);
  color: white;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  width: 100%;
}

@media (min-width: 576px) {
  .formulario-creacion {
    padding: var(--space-l);
  }

  .formulario-creacion button {
    width: auto;
  }
}

/* ========================================================================== */
/* LANDING PAGE - Mobile First                                               */
/* ========================================================================== */

.hero {
  text-align: center;
  padding: var(--space-l) var(--space-m);
  background: var(--clr-card);
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 var(--space-s);
  font-size: 1.75rem;
}

.hero p {
  margin-bottom: var(--space-m);
  color: #475569;
}

.cta {
  display: inline-block;
  padding: .75rem 1.25rem;
  background: var(--clr-primary);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  transition: background-color .2s;
  min-height: 44px;
  font-weight: 500;
}

.cta:hover {
  background: #162e63;
}

@media (min-width: 768px) {
  .hero {
    padding: 4rem var(--space-m);
  }

  .hero h1 {
    font-size: 2.5rem;
  }
}

.features {
  display: grid;
  gap: var(--space-m);
  padding: var(--space-l) var(--space-m);
  grid-template-columns: 1fr;
}

.feature {
  background: var(--clr-card);
  border-radius: var(--radius);
  padding: var(--space-m);
  box-shadow: var(--shadow);
}

.feature h2 {
  margin-top: 0;
  margin-bottom: var(--space-s);
  font-size: 1.25rem;
}

@media (min-width: 768px) {
  .features {
    grid-template-columns: repeat(3, 1fr);
    max-width: 1080px;
    margin: 0 auto;
  }
}

/* ========================================================================== */
/* MODAL - Mobile First                                                      */
/* ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: var(--space-m);
}

.modal {
  background: var(--clr-card);
  padding: var(--space-m);
  border-radius: var(--radius);
  width: 100%;
  max-width: 28rem; /* Mobile: más ancho */
  position: relative;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}

.close-modal {
  position: absolute;
  top: var(--space-s);
  right: var(--space-s);
  background: var(--clr-primary);
  color: #fff;
  border: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  cursor: pointer;
  transition: filter .2s;
  font-size: 1.5rem;
}

.url-container {
  display: flex;
  flex-direction: column; /* Mobile: vertical */
  gap: var(--space-s);
  margin-top: var(--space-m);
}

.url-container input {
  flex: 1;
  font-size: .875rem;
  word-break: break-all;
  min-height: 44px;
}

.copy-btn {
  background: var(--clr-primary);
  color: #fff;
  border: 0;
  padding: var(--space-s) var(--space-m);
  border-radius: var(--radius);
  cursor: pointer;
  transition: filter .2s;
  min-height: 44px;
  font-weight: 500;
}

.copy-btn:hover,
.close-modal:hover {
  filter: brightness(.9);
}

@media (min-width: 576px) {
  .url-container {
    flex-direction: row; /* Desktop: horizontal */
  }

  .modal {
    padding: var(--space-l);
    max-width: 36rem; /* Desktop: más ancho aún */
  }
}

/* ========================================================================== */
/* ACTION BAR (Footer de acciones) - Mobile First                            */
/* ========================================================================== */

/* Action bar container - static footer within main */
.action-bar {
  margin-top: var(--space-l);
  padding: var(--space-m) 0;
  border-top: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  align-items: center;
}

@media (min-width: 576px) {
  .action-bar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* Button styling for action bar */
.btn-floating {
  background: var(--clr-primary);
  color: #fff;
  border: 0;
  padding: .6rem 1.25rem;
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 40px;
  font-size: .9375rem;
  font-weight: 500;
  transition: opacity .2s;
  width: 100%;
}

.btn-floating:hover {
  opacity: .9;
}

@media (min-width: 576px) {
  .btn-floating {
    width: auto;
    padding: .5rem 1rem;
    min-height: 36px;
  }
}

/* Back link styling - only within action-bar */
.action-bar .volver {
  margin: 0;
  text-align: left;
}

.action-bar .volver a {
  display: inline-block;
  padding: .5rem var(--space-m);
  background: transparent;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--clr-primary);
  font-size: .9rem;
  transition: background .2s;
}

.action-bar .volver a:hover {
  background: rgba(0,0,0,.05);
}

/* Standalone back links (outside action-bar) */
.volver {
  margin: var(--space-m) 0;
  text-align: center;
}

.volver a {
  color: var(--clr-primary);
  text-decoration: none;
  font-size: .875rem;
}

.volver a:hover {
  text-decoration: underline;
}

/* ========================================================================== */
/* PANTALLA iOS (Home alternativo) - Mobile First                            */
/* ========================================================================== */

.pantalla-ios {
  display: flex;
  flex-direction: column; /* Mobile: vertical */
  min-height: 100vh;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(to right top, #f8f9fc, #ffffff);
  color: #1c1c1e;
}

.zona-lateral {
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  padding: var(--space-m);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.logo-box {
  width: 100%;
  margin-bottom: var(--space-m);
}

.logo {
  max-width: 100%;
  height: auto;
}

.saludo {
  font-size: 1.2rem;
  margin-bottom: var(--space-m);
  line-height: 1.4;
}

.menu-lateral {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.menu-lateral li {
  margin: 0;
}

.menu-lateral a {
  text-decoration: none;
  color: #1c1c1e;
  font-weight: 500;
  padding: .6rem .8rem;
  border-radius: var(--radius);
  display: block;
  transition: background .2s ease;
}

.menu-lateral a:hover {
  background: rgba(0, 0, 0, 0.05);
}

.zona-cards {
  flex-grow: 1;
  padding: var(--space-m);
  overflow-y: auto;
}

.card-ios {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-m);
  text-decoration: none;
  color: #1c1c1e;
  transition: transform .2s ease, box-shadow .2s ease;
  display: block;
  margin-bottom: var(--space-m);
}

.card-ios:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.card-ios h3 {
  margin-bottom: var(--space-s);
  font-size: 1.2rem;
}

.card-ios p {
  font-size: .95rem;
  color: #4c4c4e;
  margin: 0;
}

.toggle-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  margin-bottom: var(--space-m);
  min-width: 44px;
  min-height: 44px;
}

/* Desktop */
@media (min-width: 768px) {
  .pantalla-ios {
    flex-direction: row;
  }

  .zona-lateral {
    width: clamp(240px, 25vw, 320px);
    padding: var(--space-l);
  }

  .saludo {
    font-size: 1.3rem;
    margin-bottom: var(--space-l);
  }

  .zona-cards {
    padding: var(--space-xl);
  }

  .pantalla-ios.sidebar-collapsed .zona-lateral {
    width: 64px;
    overflow: hidden;
    padding: var(--space-m);
  }

  .pantalla-ios.sidebar-collapsed .zona-lateral .saludo,
  .pantalla-ios.sidebar-collapsed .zona-lateral .menu-lateral li a {
    display: none;
  }
}

/* ========================================================================== */
/* ACCIONES & MISC                                                           */
/* ========================================================================== */

.dashboard .actions {
  display: flex;
  gap: var(--space-s);
  flex-wrap: wrap;
  margin-bottom: var(--space-m);
}

.dashboard .ir {
  display: inline-block;
  padding: .6rem 1rem;
  background: var(--clr-primary);
  color: #fff;
  border-radius: var(--radius);
  text-decoration: none;
  box-shadow: var(--shadow-light);
  transition: opacity .2s;
  min-height: 44px;
  line-height: 1.5;
}

.dashboard .ir:visited {
  color: #fff;
}

.dashboard .ir:hover {
  opacity: .85;
}

.accion {
  margin-top: var(--space-s);
  text-align: right;
  font-size: .875rem;
}

.accion a {
  color: var(--clr-primary);
  text-decoration: none;
}

.accion a:hover {
  text-decoration: underline;
}

/* ========================================================================== */
/* FOOTER                                                                    */
/* ========================================================================== */

.app-footer {
  margin-top: auto;
  text-align: center;
  padding: var(--space-m);
  font-size: .875rem;
  color: #64748b;
}

@media (min-width: 768px) {
  .app-footer {
    padding: var(--space-m);
  }
}

/* ========================================================================== */
/* ICON PLACEHOLDERS (legacy)                                                */
/* ========================================================================== */

.icon-chart::before { content: "\1F4CA"; }
.icon-plus::before { content: "\2795"; }
.icon-file::before { content: "\1F4C4"; }
.icon-user::before { content: "\1F464"; }
.icon-mail::before { content: "\2709"; }
.icon-book::before { content: "\1F4D8"; }
.icon-puzzle::before { content: "\1F9E9"; }

/* ========================================================================== */
/* ACCESSIBILITY & PRINT                                                     */
/* ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .app-header,
  .app-aside,
  .app-footer,
  .btn-floating,
  .volver,
  button {
    display: none;
  }
}
