/*
  Página "Mi perfil"

  Paleta (solo 4 colores):
    #141C26  principal: encabezado, títulos, bordes de campos
    #F24405  acento: botón principal, anillo de foco, íconos de acción
    #FFFFFF  fondo y tarjeta
    #1D1D1F  texto de párrafo y etiquetas

  Contraste (fórmula WCAG 2.x de luminancia relativa, pruebas de WebAIM)
  ┌──────────────────────────────────────────┬─────────┬────────┬────────┬────────┬────────┬────────┐
  │ Combinación (uso)                        │ Ratio   │ Normal │ Normal │ Grande │ Grande │ UI     │
  │                                          │         │ AA 4.5 │ AAA 7  │ AA 3   │ AAA 4.5│ 3:1    │
  ├──────────────────────────────────────────┼─────────┼────────┼────────┼────────┼────────┼────────┤
  │ #1D1D1F / #FFFFFF  párrafos, etiquetas   │ 16.83:1 │ Pasa   │ Pasa   │ Pasa   │ Pasa   │ —      │
  │ #141C26 / #FFFFFF  títulos, botones sec. │ 17.16:1 │ Pasa   │ Pasa   │ Pasa   │ Pasa   │ Pasa   │
  │   y bordes de campos                     │         │        │        │        │        │        │
  │ #FFFFFF / #141C26  encabezado, iniciales,│ 17.16:1 │ Pasa   │ Pasa   │ Pasa   │ Pasa   │ —      │
  │   aviso (toast)                          │         │        │        │        │        │        │
  │ #141C26 / #F24405  texto botón principal │  4.58:1 │ Pasa   │ No     │ Pasa   │ Pasa   │ —      │
  │ #F24405 / #FFFFFF  foco, íconos, borde   │  3.75:1 │ No     │ No     │ Pasa   │ No     │ Pasa   │
  │   de campo con error (nunca texto)       │         │        │        │        │        │        │
  │ #F24405 / #141C26  foco sobre encabezado │  4.58:1 │ —      │ —      │ —      │ —      │ Pasa   │
  │ #FFFFFF / #F24405  (NO se usa: texto     │  3.75:1 │ No     │ No     │ Pasa   │ No     │ —      │
  │   blanco en botón naranja)               │         │        │        │        │        │        │
  └──────────────────────────────────────────┴─────────┴────────┴────────┴────────┴────────┴────────┘
  Todo el texto de párrafo y las etiquetas pasa AAA. El texto del botón principal
  (16 px semibold) pasa AA; AAA no es alcanzable con #F24405 de fondo y esta paleta.
*/

.page-perfil {
  background: #FFFFFF;
  color: #1D1D1F;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 16px;
}
.page-perfil [hidden] { display: none !important; }

/* Encabezado: texto sólido, sin opacidad */
.page-perfil nav.desktop a,
.page-perfil .mobile-menu a.mobile-link,
.page-perfil .auth-logout { color: #FFFFFF; }
.page-perfil nav.desktop a:hover,
.page-perfil .auth-logout:hover,
.page-perfil .auth-logout[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }

/* Botón principal: mismo color, alto y radio que el resto del sitio; texto #141C26 por contraste */
.page-perfil .btn { color: #141C26; font-family: "Inter", system-ui, sans-serif; font-weight: 600; }
.page-perfil .btn:hover { background: #F24405; text-decoration: underline; text-underline-offset: 3px; }

/* Foco visible en todo lo interactivo */
.page-perfil a:focus-visible,
.page-perfil button:focus-visible,
.page-perfil input:focus-visible {
  outline: 3px solid #F24405;
  outline-offset: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Layout */
.perfil { padding: 2.5rem 1rem 4rem; }
@media (min-width: 640px) { .perfil { padding: 4rem 1.25rem 5rem; } }

.perfil-card {
  max-width: 560px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  background: #FFFFFF;
  border: 1px solid rgba(20, 28, 38, .15);
  border-radius: .5rem;
  box-shadow: 0 1px 3px rgba(20, 28, 38, .08);
}
@media (min-width: 640px) { .perfil-card { padding: 2.5rem; } }

.perfil-card h1 {
  font-family: "Poppins", system-ui, sans-serif;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  color: #141C26;
}
@media (min-width: 768px) { .perfil-card h1 { font-size: 40px; } }

.perfil-sub { margin-top: .5rem; font-size: 18px; color: #1D1D1F; }

/* Carga inicial */
.perfil-cargando { display: flex; align-items: center; gap: .75rem; margin-top: 2.5rem; font-size: 16px; color: #1D1D1F; }
.spinner {
  width: 24px; height: 24px; flex: none;
  border: 3px solid #141C26; border-top-color: #F24405; border-radius: 50%;
  animation: girar .8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* Formulario */
.perfil-form { margin-top: 2.5rem; display: flex; flex-direction: column; gap: 2rem; }
.campo { display: flex; flex-direction: column; }
.etiqueta { display: block; margin-bottom: .5rem; font-size: 16px; font-weight: 600; color: #1D1D1F; }

.campo input[type="text"],
.campo input[type="tel"] {
  width: 100%;
  height: 48px;
  padding: 0 .875rem;
  font: 400 16px "Inter", system-ui, sans-serif;
  color: #1D1D1F;
  background: #FFFFFF;
  border: 1px solid #141C26;
  border-radius: .375rem;
}
.campo input[aria-invalid="true"] { border: 2px solid #F24405; padding: 0 calc(.875rem - 1px); }

.valor-fijo {
  min-height: 48px;
  display: flex; align-items: center;
  padding: 0 .875rem;
  font-size: 16px;
  color: #1D1D1F;
  background: #FFFFFF;
  border: 1px dashed #141C26;
  border-radius: .375rem;
  cursor: not-allowed;
  overflow-wrap: anywhere;
}

.ayuda { margin-top: .375rem; font-size: 14px; color: #1D1D1F; }

.error { display: flex; align-items: flex-start; gap: .5rem; margin-top: .5rem; font-size: 14px; font-weight: 600; color: #1D1D1F; }
.error .icono { width: 18px; height: 18px; flex: none; margin-top: 1px; color: #F24405; }

.estado { font-size: 16px; font-weight: 600; color: #1D1D1F; }
.estado:empty { display: none; }

/* Foto */
.foto { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }
.avatar {
  width: 96px; height: 96px; flex: none;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: #141C26;
  color: #FFFFFF;
  font: 600 32px "Poppins", system-ui, sans-serif;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.foto-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.foto + .ayuda { margin-top: .75rem; }

.icono { width: 20px; height: 20px; color: #F24405; }

/* Botones secundarios */
.btn-accion,
.btn-contorno {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px;
  padding: 0 1rem;
  font: 600 16px "Inter", system-ui, sans-serif;
  color: #141C26;
  background: #FFFFFF;
  border: 1px solid #141C26;
  border-radius: .375rem;
  cursor: pointer;
}
.btn-contorno { height: 3rem; padding: 0 1.5rem; }
.btn-accion:hover,
.btn-contorno:hover { text-decoration: underline; text-underline-offset: 3px; }

.btn-texto {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 44px;
  padding: 0 .25rem;
  font: 600 16px "Inter", system-ui, sans-serif;
  color: #141C26;
  background: none;
  border: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Acciones */
.acciones { display: flex; flex-direction: column; align-items: stretch; gap: .75rem; }
@media (min-width: 640px) { .acciones { flex-direction: row; align-items: center; gap: 1.5rem; } }
.btn-primario { width: 100%; }
@media (min-width: 640px) { .btn-primario { width: auto; } }

/* Deshabilitado: no solo color — borde punteado, sin relleno y cursor not-allowed */
.btn-primario[aria-disabled="true"] {
  background: #FFFFFF;
  color: #1D1D1F;
  border: 2px dashed #141C26;
  cursor: not-allowed;
  text-decoration: none;
}

.salir { padding-top: 2rem; border-top: 1px solid rgba(20, 28, 38, .15); }
.salir .btn-contorno { width: 100%; }
@media (min-width: 640px) { .salir .btn-contorno { width: auto; } }

/* Aviso flotante */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 200;
  transform: translateX(-50%);
  max-width: calc(100% - 2rem);
  padding: .875rem 1.25rem;
  font-size: 16px;
  font-weight: 600;
  color: #FFFFFF;
  background: #141C26;
  border-radius: .5rem;
  box-shadow: 0 1px 3px rgba(20, 28, 38, .2);
}
