/*!
 * EAAB ESP — Portal de pagos
 * Hoja de estilo principal
 */

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

:root {
  --brand-primary: #1361c5;
  --brand-primary-hover: #009dff;
  --brand-accent: #0d6efd;
  --brand-muted: #9fa5aa;
  --color-ink: #333333;
  --color-text: #1f2937;
  --color-soft: #6b7280;
  --color-grey-100: #f3f4f6;
  --color-grey-200: #e5e7eb;
  --color-grey-300: #d1d5db;
  --color-grey-600: #4b5563;
  --color-grey-700: #374151;
  --color-grey-800: #1f2937;
  --color-red: #ef4444;
  --color-red-strong: #dc2626;
  --color-green: #16a34a;
  --color-yellow: #eab308;
  --color-blue-focus: #60a5fa;
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-pill: 15px;
  --shadow-card: 0 4px 30px rgba(0, 0, 0, 0.45);
  --shadow-modal: 0 10px 40px rgba(0, 0, 0, 0.2);
  --font-stack-base: 'Montserrat', system-ui, -apple-system, Segoe UI, sans-serif;
  --font-stack-display: 'Poppins', system-ui, -apple-system, Segoe UI, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0;
  background: #fff;
  color: var(--color-ink);
  font-family: sans-serif;
  line-height: 1.5;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }

/* — Tipografías reutilizables — */
.t-display { font-family: var(--font-stack-display); }
.t-body { font-family: var(--font-stack-base); }

/* ─────────── Overlays globales ─────────── */
.ov-shade {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: none;
}

.ov-loader {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
}
.ov-loader[data-show] { display: flex; }
.ov-loader .loader__icon {
  width: 4rem;
  height: 4rem;
  animation: portal-pulse 1.2s infinite;
}
@keyframes portal-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.ov-processing {
  position: fixed;
  inset: 0;
  background: rgba(5, 14, 35, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.ov-processing[data-show] { display: flex; }

.proc-card {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 340px;
  padding: 32px 26px 24px;
  text-align: center;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
  font-family: var(--font-stack-base);
  animation: proc-in 0.3s cubic-bezier(0.22, 0.68, 0, 1.18) both;
}
@keyframes proc-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.proc-loader { position: relative; width: 72px; height: 72px; margin: 0 auto 18px; }
.proc-loader__circle {
  position: absolute; inset: 0;
  border: 6px solid #e5e7eb;
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: proc-spin 1s linear infinite;
}
.proc-loader__icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
@keyframes proc-spin { to { transform: rotate(360deg); } }

.proc-card__title {
  margin: 0 0 4px;
  font-size: 1rem; font-weight: 800; color: #0f1e3d;
  transition: opacity 0.18s ease;
}
.proc-card__sub { margin: 0 0 16px; font-size: 0.8rem; color: var(--color-soft); min-height: 1.1em; }
.proc-card__secure {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.7rem; font-weight: 700; color: #475569;
  background: var(--color-grey-100); border-radius: 999px; padding: 0.3rem 0.75rem;
  letter-spacing: 0.02em;
}
.proc-card__secure i { color: var(--color-green); }

/* ─────────── Modal genérico ─────────── */
.dialog {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.dialog__panel {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 28rem;
  box-shadow: var(--shadow-modal);
  margin: 0;
}
.dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-grey-200);
  padding: 1rem 1.5rem;
}
.dialog__head h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-grey-800);
}
.dialog__title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dialog__warn-icon {
  color: var(--color-yellow);
  font-size: 1.25rem;
}
.dialog__close {
  font-size: 1.5rem;
  color: var(--color-soft);
  line-height: 1;
}
.dialog__close:hover { color: #000; }
.dialog__body {
  padding: 1rem 1.5rem;
  color: var(--color-grey-800);
  font-size: 17px;
}
.dialog[data-dialog="captcha-expired"] .dialog__body {
  font-size: 16px;
  line-height: 1.625;
}
.dialog__body p { margin: 0; }
.dialog__foot {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--color-grey-200);
  padding: 1rem 1.5rem;
}

.btn {
  font-size: 1rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  color: #fff;
  transition: background-color 0.2s;
}
.btn--muted { background: #4b5563; }
.btn--muted:hover { background: var(--color-grey-700); }
.btn--primary { background: var(--brand-primary); }
.btn--primary:hover { background: #0d4ea1; }

/* ─────────── Banner superior (logo) ─────────── */
.site-banner {
  background: var(--brand-primary);
}
.site-banner__inner {
  width: 100%;
  padding: 1.5rem 1rem;
  display: flex;
  justify-content: flex-end;
  padding-right: 8rem;
}
.site-banner__logo {
  height: 2.5rem;
  width: auto;
}
@media (min-width: 768px) {
  .site-banner__inner {
    justify-content: flex-end;
    padding-right: 16rem;
  }
}

/* ─────────── Hero / landing ─────────── */
.hero__media {
  width: 100%;
  height: 40vh;
  margin: 0;
}
.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero__shell {
  max-width: 85%;
  margin: 0 auto;
  padding: 2rem 2rem 1.5rem;
}
@media (min-width: 768px) {
  .hero__shell { max-width: 75%; }
}
.hero__columns {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
@media (min-width: 768px) {
  .hero__columns {
    flex-direction: row;
    align-items: center;
    justify-content: center;
  }
}
.hero__copy { width: 100%; }
@media (min-width: 768px) {
  .hero__copy { width: 60%; }
}
.hero__title {
  font-family: var(--font-stack-display);
  font-weight: 700;
  font-size: 50px;
  line-height: 1.1;
  color: var(--color-grey-600);
  margin: 0 0 1rem;
}
.hero__lead {
  font-size: 20px;
  color: var(--color-grey-700);
  line-height: 1.5;
  margin: 0 0 1.5rem;
}
@media (min-width: 768px) {
  .hero__lead { font-size: 18px; }
}

.hero__actions {
  font-family: var(--font-stack-base);
  display: flex;
  flex-direction: column;
  justify-items: center;
}
@media (min-width: 768px) {
  .hero__actions {
    width: 220px;
    display: flex;
  }
}

.action-pill {
  cursor: pointer;
  margin: 1rem 0;
  width: 200px;
  font-size: 18px;
  background: var(--brand-primary);
  color: #fff;
  font-weight: 500;
  text-align: center;
  padding: 0.75rem 0;
  border-radius: var(--radius-pill);
  white-space: normal;
  transition: background 0.2s;
}
.action-pill:hover { background: var(--brand-primary-hover); }
@media (min-width: 768px) {
  .action-pill {
    font-size: 16px;
    width: 100%;
    padding: 2rem 0;
  }
}
@media (min-width: 1280px) {
  .action-pill { width: 300px; }
}

/* ─────────── Workspace ─────────── */
.workspace {
  width: 100%;
  padding: 1rem 0.75rem;
  margin: 0 auto;
  font-family: var(--font-stack-base);
  font-size: 14px;
}
@media (min-width: 576px)  { .workspace { max-width: 540px; } }
@media (min-width: 768px)  { .workspace { max-width: 720px; } }
@media (min-width: 992px)  { .workspace { max-width: 960px; } }
@media (min-width: 1200px) { .workspace { max-width: 1140px; } }
@media (min-width: 1400px) { .workspace { max-width: 1320px; } }

.workspace > * + * { margin-top: 1rem; }

.workspace__title {
  font-family: var(--font-stack-display);
  color: var(--color-grey-800);
  font-size: 35px;
  line-height: 1.1;
  margin: 0 0 1rem;
}
@media (min-width: 768px) {
  .workspace__title { font-size: 46px; }
}

.workspace__inputs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
@media (min-width: 640px) {
  .workspace__inputs { flex-direction: row; }
}

.input-group { flex: 1; }
.input-group__icon { height: 1.5rem; width: auto; }
.input-group__control {
  width: 100%;
  font-size: 1.125rem;
  border: 1px solid var(--color-grey-300);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  margin-top: 0.25rem;
  background: #fff;
  color: var(--color-ink);
  font-family: inherit;
  outline: none;
}
.input-group__control:focus {
  border-color: var(--color-blue-focus);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.35);
}

.captcha-wrap { margin: 1rem 0; }

.add-btn {
  cursor: pointer;
  font-size: 1.125rem;
  text-align: center;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  margin-top: 2rem;
  color: #fff;
  user-select: none;
}
.add-btn--disabled { background: var(--brand-muted); }
.add-btn--enabled {
  background: var(--brand-accent);
  font-size: 1.25rem;
}
.add-btn__chevron { font-size: 0.75rem; }

.upload-hint {
  font-size: 1.125rem;
  color: var(--color-grey-700);
  margin: 0;
}
.upload-hint__link {
  color: #2563eb;
  text-decoration: underline;
}

/* ─────────── Tabla de facturas ─────────── */
.ledger { display: block; }

.switch-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 1.125rem;
  color: var(--color-grey-800);
}
.switch-row__input { display: none; }

.switch {
  width: 2.5rem;
  height: 1.25rem;
  border-radius: 9999px;
  border: 1px solid var(--color-grey-300);
  background: #fff;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.switch[data-on] {
  background: #006eff;
  border-color: #006eff;
}
.switch__handle {
  width: 1rem;
  height: 1rem;
  border-radius: 9999px;
  background: #9ca3af;
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  transition: transform 0.2s, background 0.2s;
}
.switch[data-on] .switch__handle {
  background: #fff;
  transform: translateX(1.375rem);
}

.ledger__table-wrap {
  overflow-x: auto;
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-md);
  margin: 2rem 0;
}

.ledger__table {
  width: 100%;
  background: #fff;
  border: 1px solid var(--color-grey-200);
  text-align: left;
  border-collapse: collapse;
}
.ledger__table thead {
  border-bottom: 1px solid var(--color-grey-300);
}
.ledger__table thead tr {
  white-space: nowrap;
  vertical-align: bottom;
  font-size: 15px;
}
.ledger__table thead th {
  padding: 0.5rem;
  font-weight: 700;
  color: #000;
}
.ledger__table tbody {
  font-size: 16px;
  color: var(--color-grey-800);
  font-weight: 500;
}
.ledger__table tbody tr + tr { border-top: 1px solid var(--color-grey-200); }
.ledger__table tbody td {
  padding: 0.5rem;
  max-width: 90px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}
.ledger__table tbody td:nth-child(3) { min-width: 105px; }
.ledger__table tbody td:nth-child(12) { min-width: 100px; }
.ledger__table tbody tr:last-child td {
  border-bottom: 1px solid var(--color-grey-300);
  padding-bottom: calc(0.75rem + 10px);
}

.ledger__cell--address { color: var(--color-red); }
.ledger__cell--status { color: var(--color-red); font-weight: 700; }
.ledger__cell--delete {
  text-align: center;
  cursor: pointer;
}

/* ─────────── Bloque medio de pago / pagador ─────────── */
.payment-method,
.payer-block { margin-top: 1rem; }
.payment-method > * + *,
.payer-block__fields > * + * { margin-top: 1rem; }
.payment-method__heading { height: 1.75rem; padding-top: 0.5rem; }
.payer-block__heading { height: 2.25rem; padding-top: 0.5rem; }

.floating-field { position: relative; }
.floating-field input,
.floating-field select {
  width: 100%;
  font-size: 0.9375rem;
  border: 1px solid var(--color-grey-300);
  border-radius: var(--radius-sm);
  padding: 2rem 1rem 0.5rem;
  outline: none;
  appearance: none;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  color: var(--color-ink);
}
.floating-field input:focus,
.floating-field select:focus {
  border-color: var(--color-blue-focus);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.35);
}
.floating-field label {
  position: absolute;
  left: 1rem;
  top: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-soft);
  pointer-events: none;
}
.floating-field__caret {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--color-soft);
}
.floating-field__caret svg { width: 1rem; height: 1rem; }
.floating-field[data-error] input,
.floating-field[data-error] select { border-color: var(--color-red); }
.floating-field__err {
  position: absolute;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-red-strong);
  font-size: 0.75rem;
  width: 1.25rem;
  height: 1.25rem;
  border: 1px solid var(--color-red-strong);
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.payer-block__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 768px) {
  .payer-block__grid { grid-template-columns: 1fr 1fr; }
}
.payer-block__full {
  grid-column: 1 / -1;
}

.payer-block__opts {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 0.5rem;
}

.total-row {
  padding-top: 1.5rem;
}
.total-row > * + * { margin-top: 1rem; }
.total-row__amount {
  background: var(--color-grey-100);
  color: var(--color-grey-600);
  font-size: 19px;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-grey-200);
}
.total-row__cta { text-align: center; }
.pay-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: var(--font-stack-base);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #fff;
  background: var(--brand-primary);
  padding: 0.9rem 3rem;
  border-radius: var(--radius-pill);
  box-shadow: 0 6px 16px rgba(19, 97, 197, 0.35);
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.1s;
}
.pay-button:hover {
  background: var(--brand-primary-hover);
  box-shadow: 0 8px 20px rgba(0, 157, 255, 0.4);
}
.pay-button:active { transform: translateY(1px); }
.pay-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.5);
}
.pay-button__icon { font-size: 1.1rem; }
