@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

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

html {
  font-size: 16px;
}

body {
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: #004f50;
  background: #fff;
  min-height: 100vh;
}

body.login-page {
  display: flex;
  flex-direction: column;
  background: #024e4e;
}

img {
  max-width: 100%;
  height: auto;
}

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

/* Header */
.header {
  background: #024e4e;
  width: 100%;
  min-height: 70px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.header-inner {
  width: 100%;
  max-width: 960px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.logo {
  width: 100px;
  height: auto;
  object-fit: contain;
}

.actions-header {
  display: flex;
  align-items: center;
}

.actions-header .ac {
  display: flex;
  gap: 30px;
  align-items: center;
}

.pv-container {
  width: 103px;
}

.pv,
.be,
.cd {
  display: block;
  height: 35px;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
}

.pv {
  width: 103px;
  background-image: url('imagenes/acceso-primera-vez-v2.png');
  background-size: 103px 35px;
}

.be {
  width: 125px;
  background-image: url('imagenes/banca-electronica.webp');
  background-size: 125px 35px;
}

.cd {
  width: 103px;
  background-image: url('imagenes/cuenta-digital.webp');
  background-size: 103px 35px;
}

.pv:hover,
.be:hover {
  background-image: url('imagenes/banca-electronica_2.webp');
  background-size: 125px 35px;
}

.cd:hover {
  background-image: url('imagenes/cuenta-digital_2.webp');
}

/* Main layout */
.page-content {
  flex: 1;
  width: 100%;
  margin: 0;
  padding: 48px 20px 80px;
  background: #f4f4f4;
  border-bottom-left-radius: 160px;
}

.login-layout {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 48px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 12px;
}

.welcome-panel {
  flex: 1 1 460px;
  max-width: 500px;
}

.welcome-panel .title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 1rem;
}

.welcome-panel .title-bim {
  font-size: 28px;
  font-weight: 800;
}

.welcome-panel p {
  text-align: justify;
  margin-bottom: 1rem;
}

.welcome-panel ul {
  padding-left: 18px;
  margin-bottom: 1rem;
}

.welcome-panel li {
  margin-bottom: 0.4rem;
}

.welcome-panel li::marker {
  color: #00b451;
}

.welcome-panel .banner {
  display: block;
  width: 100%;
  margin: 10px 0;
  border-radius: 8px;
}

/* Login card */
.login-card {
  flex: 1 1 420px;
  max-width: 500px;
  background: #fff;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  margin-top: 8px;
}

.login-form {
  position: relative;
}

.login-card p {
  text-align: justify;
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  font-family: 'Montserrat', sans-serif;
  color: #495057;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  height: calc(1.5em + 0.75rem + 2px);
}

.form-control:focus {
  outline: none;
}

.form-control:not(.show-box):focus {
  border-color: #00b451;
  background: #fff;
  box-shadow: 0 0 0 0.2rem rgba(0, 180, 81, 0.25);
}

.form-control.show-box {
  background-color: #f5f7fa;
  border: 1px solid #e3e6ea;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.form-control.show-box:focus {
  outline: none;
  border-color: #e3e6ea;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.form-control::placeholder {
  color: #999;
  font-size: 0.9rem;
}

.autofill-trap {
  position: absolute;
  left: -9999px;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.form-control:-webkit-autofill,
.form-control:-webkit-autofill:hover,
.form-control:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #f8f9fa inset;
  -webkit-text-fill-color: #495057;
  transition: background-color 99999s ease-out;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  color: #fff;
  background: #00b451;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.btn-primary:hover:not(:disabled) {
  background: #009a45;
}

.btn-primary:disabled {
  background: #ccc;
  cursor: default;
}

.remember {
  color: #717171;
  font-size: 14px;
  margin-top: 2rem;
}

/* Footer */
.footer {
  background: #024e4e;
  color: #fff;
  margin-top: auto;
  padding: 2.5rem 1rem 2rem;
  text-align: center;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 1rem;
}

.footer-links a {
  color: #7dcea0;
  font-size: 13px;
  font-weight: 500;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-sep {
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
}

.footer-addr,
.footer-copy {
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  line-height: 1.6;
  margin: 0.25rem 0;
}

/* Bienvenida / token */
.bg-header {
  background: #024e4e;
  height: 70px;
  display: flex;
  align-items: center;
  padding: 0 40px;
}

.bg-header img {
  height: 45px;
}

.bg-content {
  max-width: 700px;
  margin: 40px auto;
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.bg-content h2 {
  color: #024e4e;
  font-size: 22px;
  margin-bottom: 5px;
}

.bg-content .frase {
  color: #888;
  font-size: 14px;
  margin-bottom: 15px;
}

.bg-content .bienvenido {
  color: #00b451;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 15px;
}

.bg-content .ebim-logo {
  font-size: 32px;
  font-weight: 800;
  color: #024e4e;
  margin-bottom: 15px;
}

.bg-content .ebim-logo span {
  color: #00b451;
}

.bg-content .seguridad {
  font-size: 13px;
  color: #555;
  text-align: left;
  margin-top: 25px;
  line-height: 1.6;
}

.bg-content .seguridad b {
  color: #024e4e;
}

.bg-content .seguridad-list {
  margin: 8px 0 0 20px;
}

.dark-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.token-box {
  background: #fff;
  border-radius: 12px;
  max-width: 480px;
  width: 90%;
  padding: 30px 35px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.token-box .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.token-box .top h2 {
  font-size: 18px;
  font-weight: 700;
  color: #024e4e;
}

.token-box .top h2 span {
  color: #00b451;
  margin-right: 8px;
}

.token-box hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin-bottom: 18px;
}

.token-box .msg {
  font-size: 14px;
  color: #555;
  margin-bottom: 22px;
  line-height: 1.5;
}

.token-inputs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.token-inputs input {
  width: 46px;
  height: 56px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #f5f5f5;
  font-family: 'Montserrat', sans-serif;
  -moz-appearance: textfield;
}

.token-inputs input:focus {
  outline: none;
  border: 2px solid #024e4e;
  background: #fff;
}

.token-inputs input::-webkit-outer-spin-button,
.token-inputs input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.timer {
  text-align: center;
  font-size: 28px;
  font-weight: 600;
  color: #024e4e;
  margin: 12px 0;
}

.btn-accept {
  display: block;
  width: 65%;
  margin: 12px auto;
  padding: 10px;
  background: #00b451;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
}

.btn-accept:hover:not(:disabled) {
  background: #009a45;
}

.btn-accept:disabled {
  background: #ccc;
  cursor: default;
}

.sms-links {
  text-align: center;
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

.sms-links span {
  color: #999;
  font-size: 13px;
}

/* Dashboard / datos */
.dashboard-header {
  background: linear-gradient(90deg, #00b44f 0%, #004f50 100%);
  min-height: 10rem;
  border-bottom-left-radius: 5em;
  box-shadow: 0 0 9px 5px #e2e2e4;
  padding: 1rem 2rem 0;
}

.dashboard-header-top {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-header-top img {
  width: 100px;
}

.dashboard-header-top .user-info {
  color: #fff;
  text-align: right;
  font-size: 0.85rem;
}

.dashboard-nav {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 1rem 0;
  flex-wrap: wrap;
}

.dashboard-nav a {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
}

.dashboard-nav a.active {
  font-weight: 700;
}

.dashboard-section {
  max-width: 960px;
  margin: 150px auto 40px;
  padding: 0 20px;
}

.dashboard-section h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #015750;
  margin-bottom: 2rem;
}

.data-form {
  max-width: 600px;
}

.data-form p {
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
}

.data-table {
  width: 100%;
  border-spacing: 0 12px;
  margin: 25px 0;
}

.data-table td:first-child {
  font-weight: 700;
  padding: 8px 15px 8px 0;
  vertical-align: middle;
  width: 120px;
}

.data-table label {
  font-weight: 700;
  cursor: pointer;
}

.data-table input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Montserrat', sans-serif;
}

.data-table input.input-uppercase {
  text-transform: uppercase;
}

.data-table input:user-invalid {
  border-color: #c0392b;
}

.data-table input:user-invalid:focus {
  outline: none;
  border-color: #c0392b;
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.2);
}

/* Loading */
.loading-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.loading-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px 20px;
}

.loading-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  padding: 50px 60px;
  text-align: center;
  max-width: 500px;
  width: 100%;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e0e0e0;
  border-top: 4px solid #00b451;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 30px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-card h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 15px;
  color: #024e4e;
}

.loading-card p {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  margin-top: 25px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00b451, #024e4e);
  border-radius: 3px;
  animation: fill 8s ease-in-out forwards;
}

@keyframes fill {
  to { width: 100%; }
}

/* Error modal */
.err-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.err-overlay.show {
  display: flex;
}

.err-box {
  background: #fff;
  border-radius: 12px;
  padding: 40px 50px;
  text-align: center;
  max-width: 420px;
  width: 90%;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.err-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  background: #024e4e;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.err-icon {
  display: block;
  width: 70px;
  height: 70px;
  margin: 0 auto 18px;
  object-fit: contain;
}

.err-box h3 {
  color: #024e4e;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.err-box p {
  color: #00b451;
  font-size: 14px;
}

.err-box .err-retry {
  margin-top: 12px;
  font-weight: 600;
  color: #024e4e;
}

/* Spinner en botones */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
  margin-left: 6px;
}

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    height: auto;
    padding: 10px 20px;
    gap: 10px;
  }

  .header {
    height: auto;
    padding: 10px 0;
  }

  .actions-header .ac {
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .login-layout {
    flex-direction: column;
    align-items: stretch;
  }
}
