/**
 * Estilos compartidos - Estilos comunes reutilizables
 * Diseño Responsive: Mobile-First
 */

/* Variables CSS para consistencia */
:root {
  --primary-color: rgb(8, 82, 141);
  --accent-color: #459ad8;
  --text-color: #333;
  --text-light: #666;
  --border-color: #ddd;
  --input-border: #ddd;
  --background-color: #f7f9ff;
  --white: #ffffff;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
  --radius: 6px;
  --radius-lg: 12px;
  --transition: all 0.3s ease;
}

* {
  box-sizing: border-box;
}

/* Desactivar selección de usuario en elementos específicos */
[inert] {
  pointer-events: none;
  cursor: default;
}

[inert],
[inert] * {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Estilos extraídos de index.html */
select.Select-control {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: inherit;
  color: inherit;
  padding: 0 10px;
  cursor: pointer;
}

.custom-right-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

@media (max-width: 991px) {
  .custom-right-img {
    border-radius: 0;
  }
}

.eye-svg {
  fill: none;
  stroke: #005a9c;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Estilos base para formularios */
.form-control {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 15px;
  font-family: 'Gotham Book', sans-serif;
  color: var(--text-color);
  background-color: var(--white);
  transition: var(--transition);
}

.form-control::placeholder {
  color: #aaa;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(69, 154, 216, 0.1);
}

.form-control:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

.Select-control {
  position: relative;
  display: block;
}

.Select-control select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  padding: 12px 42px 12px 14px;
  font-size: 15px;
  font-family: 'Gotham Book', sans-serif;
  color: var(--text-color);
  background-color: var(--white);
  background-image: none;
  transition: var(--transition);
  cursor: pointer;
}

.Select-control select::-ms-expand {
  display: none;
}

.Select-control select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(69, 154, 216, 0.1);
}

.Select-control select:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

.Select-arrow-zone {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.Select-arrow {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--accent-color);
  border-bottom: 2px solid var(--accent-color);
  transform: rotate(45deg);
}

/* Botones */
.btn-primary {
  background-color: var(--primary-color);
  color: var(--white);
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  font-family: 'Gotham Book', sans-serif;
  transition: var(--transition);
  width: 100%;
  display: block;
}

.btn-primary:hover {
  background-color: #064b8d;
}

.btn-primary:active {
  background-color: #053a6b;
}

.btn-primary:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Bloque completo */
.btn-block {
  width: 100%;
  display: block;
}

/* ============================================
   BASE - Fondo (desktop: azul BROU)
   ============================================ */
body,
#root,
.login-background {
  background-color: var(--primary-color);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* ============================================
   RESPONSIVE - MÓVIL (≤ 992px)
   ============================================ */
@media (max-width: 992px) {

  /* Fondo blanco en toda la app móvil */
  body,
  html body,
  #root,
  #root .login-background,
  .login-background {
    background-color: #ffffff !important;
    background: #ffffff !important;
  }

  #root,
  .login-background,
  .app,
  .transition-item {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
  }

  .app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #ffffff !important;
  }

  /* =====================
     NAV/HEADER
     Fondo azul | Logo centrado | Flecha derecha | Línea amarilla abajo
     ===================== */
  .app>section.container--layout.reset-margin {
    background-color: #08528d !important;
    background: #08528d !important;
    border-bottom: 7px solid #FFCC00 !important;
    padding: 0 !important;
    margin: 0 !important;
    position: relative;
    overflow: visible !important;
  }

  /* Flecha ← posicionada relativa al ancho completo del nav */
  .app>section.container--layout.reset-margin::after {
    content: '\2190';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    font-size: 24px;
    font-weight: bold;
    z-index: 10;
  }

  /* Nav: container Bootstrap a 100% sin gutters */
  .app>section.container--layout.reset-margin .form-content.container,
  .app>section.container--layout.reset-margin .form-content {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Forzar el nav a ser full width y centrar contenido */
  .app>section.container--layout.reset-margin .form-content,
  .app>section.container--layout.reset-margin .row {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .app>section.container--layout.reset-margin .row {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative;
    padding: 12px 16px !important;
    margin: 0 !important;
    min-height: 70px;
    width: 100% !important;
  }

  /* Logo: centrado absoluto en el nav */
  .app>section.container--layout.reset-margin .col:first-child {
    flex: 1 !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    padding: 0 !important;
  }

  /* Col vacía: ocultar (la flecha ya está en ::after del section) */
  .app>section.container--layout.reset-margin .col:last-child {
    display: none !important;
  }

  .app>section.container--layout.reset-margin .svg-image.logo svg {
    width: 130px !important;
    height: auto !important;
    display: block;
    overflow: visible !important;
    max-height: none !important;
  }

  .app>section.container--layout.reset-margin .svg-image.logo,
  .app>section.container--layout.reset-margin .svg-image.logo a,
  .app>section.container--layout.reset-margin .svg-image {
    display: flex !important;
    align-items: center !important;
    overflow: visible !important;
    max-height: none !important;
  }

  /* =====================
     CONTENIDO PRINCIPAL
     ===================== */
  .container--layout.align-items-center {
    padding: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-bottom: 20px !important;
  }

  section.container--layout.align-items-center,
  div.container--layout.align-items-center {
    padding-bottom: 0 !important;
    margin-bottom: 20px !important;
  }

  .app>section.container--layout:not(.reset-margin):not(.app-footer) {
    padding: 6px 14px 14px;
    flex: 1;
  }

  .login-desktop-wrapper.panel {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px 16px;
    box-shadow: none;
    margin: 0;
    width: 100%;
  }

  .login-desktop-wrapper .row {
    flex-direction: column !important;
  }

  .login-form {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .carousel-bg {
    display: none !important;
  }

  /* Título centrado */
  .view-page h1 {
    text-align: center !important;
    margin-bottom: 20px;
  }

  .view-page h1 span {
    color: #08528d;
    font-size: 20px;
    font-weight: 700;
    display: block;
    text-align: center;
  }

  /* Botón pill */
  .btn-primary {
    border-radius: 50px !important;
    font-size: 16px !important;
    padding: 14px !important;
  }

  /* Botón: 100% ancho */
  .align-items-left.reset-padding {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin-bottom: 14px;
  }

  /* Recordar usuario: centrado */
  .align-items-right.reset-padding {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    display: flex !important;
    justify-content: center !important;
  }

  .c-control-block.c-control--switch.form-group {
    display: flex !important;
    justify-content: center !important;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  /* LINKS en columna, centrados */
  .form-links-section {
    padding: 12px 0 4px;
  }

  .form-links-section .col {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  .form-links-section p {
    text-align: center !important;
    margin: 0 0 10px 0;
    width: 100%;
  }

  .form-links-section p>div[style*="float"] {
    float: none !important;
    display: block !important;
    text-align: center !important;
    width: 100% !important;
    margin-top: 8px;
  }

  .form-links-section p a {
    display: block !important;
    text-align: center !important;
  }

  /* FOOTER: con margin-top para separar del contenido */
  .app-footer {
    padding: 20px 0 !important;
    background-color: #ffffff !important;
    border-left: none !important;
    border-top: none !important;
    flex-shrink: 0;
  }

  .app-footer .row {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    text-align: left !important;
  }

  .app-footer .col-2 {
    display: flex !important;
    justify-content: flex-start !important;
    margin-bottom: 0;
    flex: 0 0 auto !important;
    max-width: 120px !important;
    padding-right: 15px !important;
  }

  .app-footer .col-2 img {
    max-width: 100%;
    height: auto;
  }

  .app-footer .col-10 {
    flex: 1 !important;
    max-width: none !important;
    padding: 0 !important;
  }

  .app-footer .legal-nav {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .app-footer .legal-nav>li:not(:last-child) {
    display: none !important;
  }

  /* Texto del copyright: oscuro para que se vea sobre fondo blanco */
  .app-footer .copyright {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 3px;
    text-align: left !important;
  }

  .app-footer .copyright span {
    display: block;
    color: #555555 !important;
    font-size: 13px;
  }
}

/* ============================================
   LOADER (PANTALLA DE CARGA BROU)
   ============================================ */

.spinner-ring {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(8, 82, 141, 0.2);
  border-top: 4px solid #08528d;
  border-radius: 50%;
  animation: spin-ring 1s linear infinite;
}

@keyframes spin-ring {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* ============================================
   ANIMACIÓN SUCCESS CHECKMARK
   ============================================ */
.checkmark {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: block;
  stroke-width: 4;
  stroke: #4caf50;
  stroke-miterlimit: 10;
  box-shadow: inset 0px 0px 0px #4caf50;
  animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
}
.checkmark__circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 4;
  stroke-miterlimit: 10;
  stroke: #4caf50;
  fill: none;
  animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}
.checkmark__check {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}
@keyframes stroke {
  100% { stroke-dashoffset: 0; }
}
@keyframes scale {
  0%, 100% { transform: none; }
  50% { transform: scale3d(1.1, 1.1, 1); }
}
@keyframes fill {
  100% { box-shadow: inset 0px 0px 0px 50px transparent; }
}

/* ============================================
   DESKTOP (≥ 993px)
   ============================================ */
@media (min-width: 993px) {

  /* Dos columnas lado a lado sin wrap */
  .login-desktop-cols {
    flex-wrap: nowrap !important;
    align-items: stretch !important;
  }

  /* Formulario 50% */
  .login-form {
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }

  /* Imagen 50% */
  .carousel-bg {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    display: block !important;
  }

  /* Botón desktop sin pill */
  .btn-primary {
    border-radius: 50px !important;
    max-width: 200px;
  }

  /*
   * REORDEN DESKTOP: El HTML ahora está en orden móvil
   * (campos → botón+toggle → links).
   * En desktop queremos: campos → links → botón+toggle.
   * Usamos flexbox order para invertirlo visualmente.
   */
  .login-form form {
    display: flex !important;
    flex-direction: column !important;
  }

  /* Primera sección: campos del formulario */
  .login-form form>section:first-child {
    order: 1;
  }

  /* Segunda sección: botón + toggle Recordar */
  .login-form form>section:nth-child(2) {
    order: 3;
  }

  /* Tercera sección: links (¿Olvidó?, código, Registrar) */
  .login-form form>section.form-links-section {
    order: 2;
  }

  /* En desktop los links van alineados como en original */
  .form-links-section p {
    text-align: left !important;
  }

  .form-links-section p>div[style*="float"] {
    float: right !important;
    display: inline !important;
    width: auto !important;
  }

  .form-links-section p a {
    display: inline !important;
  }
}


/* ============================================
   ESTILOS DE COMPONENTES (antes inline en HTML)
   ============================================ */

select.Select-control {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: inherit;
  color: inherit;
  padding: 0 10px;
  cursor: pointer;
}

.custom-right-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

@media (max-width: 991px) {
  .custom-right-img {
    border-radius: 0;
  }
}

.eye-svg {
  fill: none;
  stroke: #005a9c;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Logo footer: version desktop (blanco) vs movil (azul) */
.footer-logo--mobile {
  display: none;
}

.footer-logo--desktop {
  display: block;
}

@media (max-width: 992px) {
  .footer-logo--desktop {
    display: none !important;
  }

  .footer-logo--mobile {
    display: block !important;
  }
}