/* ==========================================================================
   ESTILOS GENERALES Y RESET
   ========================================================================== */
:root {
  --primary-navy: #0d254c;
  --secondary-navy: #1b3a6b;
  --bg-page: #fefefe;
  --fingerprint-bg: #fefefe;
  --text-dark: #1f2937;
  --text-muted: #4b5563;
  --border-card: #1b3a6b;
  --line-separator: #d1d5db;
  
  /* Paleta de botones inspirada en el diseño de referencia */
  --c-purple: #231f54;
  --c-green: #388e3c;
  --c-blue: #1976d2;
  --c-navy: #28385e;
  --c-indigo: #4a369d;
  --c-gold: #f5a623;
  --c-cyan: #29b6f6;
  --c-red: #d32f2f;
  --c-magenta: #7b1fa2;
  --c-teal: #00897b;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Montserrat', 'Inter', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --shadow-card: 0 4px 14px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-dark);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==========================================================================
   BARRA SUPERIOR
   ========================================================================== */
.top-nav-bar {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: hidden;
}

.top-nav-image {
  display: block;
  width: 100%;
  height: auto;
}

/* ==========================================================================
   WRAPPER PRINCIPAL (MOBILE FIRST)
   ========================================================================== */
.mobile-wrapper {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 38px 22px 34px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ==========================================================================
   GRID DE BOTONES DE GESTIÓN (IDÉNTICO A LA DISPOSICIÓN DE LA IMAGEN)
   ========================================================================== */
.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 0.98fr);
  justify-content: center;
  column-gap: 30px;
  row-gap: 22px;
  padding: 0 8px;
}

.grid-card {
  border: none;
  outline: none;
  cursor: pointer;
  border-radius: 8px;
  padding: 11px 8px;
  aspect-ratio: 189 / 107;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: none;
  transition: transform 0.16s ease, filter 0.16s ease;
  user-select: none;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.grid-card:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.grid-card:active {
  transform: translateY(1px);
  filter: brightness(0.92);
}

.grid-card-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.96;
}

.grid-card-icon svg {
  width: 34px;
  height: 34px;
}

.cta-card-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
}

.grid-card:has(.cta-card-image) .grid-card-icon,
.grid-card:has(.cta-card-image) .grid-card-text {
  visibility: hidden;
}

.grid-card-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-title {
  font-size: clamp(0.74rem, 2.6vw, 1.05rem);
  font-weight: 800;
  line-height: 1.08;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-subtitle {
  font-size: clamp(0.72rem, 2.45vw, 1rem);
  font-weight: 800;
  line-height: 1.08;
  opacity: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Colores institucionales por botón */
.card-purple  { background-color: #2d2766; color: #ffffff; }
.card-green   { background-color: #4caf50; color: #ffffff; }
.card-blue    { background-color: #2478b9; color: #ffffff; }
.card-navy    { background-color: #345590; color: #ffffff; }
.card-indigo  { background-color: #5747c6; color: #ffffff; }
.card-gold    { background-color: #ffb638; color: #ffffff; }
.card-cyan    { background-color: #3c95d4; color: #ffffff; }
.card-red     { background-color: #f12626; color: #ffffff; }
.card-magenta { background-color: #8b008f; color: #ffffff; }
.card-teal    { background-color: #48a9bf; color: #ffffff; }



/* ==========================================================================
   TARJETA PRINCIPAL (RÉPLICA DEL DISEÑO DEL DOCUMENTO DE IDENTIDAD)
   ========================================================================== */
.identity-card-container {
  width: min(70vw, 282px);
  margin: 0 auto;
}

.identity-card {
  background-color: var(--fingerprint-bg);
  border: 0;
  border-radius: 4px;
  padding: 38px 38px 36px;
  min-height: 570px;
  position: relative;
  overflow: visible;
  box-shadow: 0 4px 12px rgba(13, 37, 76, 0.08);
}

.identity-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--border-card);
  border-radius: 4px;
  pointer-events: none;
  z-index: 3;
}

/* Marca de agua de seguridad */
.card-watermark {
  position: absolute;
  left: 0;
  right: calc(-1 * (((100vw - 100%) / 2) + 3.33px));
  bottom: 0;
  overflow: hidden;
  transform: translateX(-3.33px);
  pointer-events: none;
  z-index: 1;
}

.card-watermark img {
  display: block;
  width: 100%;
  height: auto;
  transform: translateY(32px);
}

/* Título central idéntico al documento de referencia */
.card-main-title {
  text-align: center;
  font-size: 1.58rem;
  font-weight: 500;
  color: #444444;
  line-height: 1.16;
  margin-bottom: 24px;
  padding: 0 2px;
  position: relative;
  z-index: 2;
  font-family: 'Roboto', Arial, sans-serif;
  letter-spacing: -0.2px;
}

/* Lista de Campos con espacio y formato exacto a la imagen */
.card-fields-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  position: relative;
  z-index: 2;
}

.card-field-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.field-label {
  font-size: 0.86rem;
  font-weight: 700;
  color: #374151;
  font-family: 'Roboto', Arial, sans-serif;
  letter-spacing: 0.1px;
}

.field-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: #2b3442;
  letter-spacing: 0.2px;
  padding-bottom: 4px;
  border-bottom: 1px solid #cbd5e1;
  font-family: 'Roboto', Arial, sans-serif;
}

.field-value-status {
  font-size: 0.81rem;
  font-weight: 700;
  color: #2b3442;
  line-height: 1.25;
  padding-top: 2px;
  font-family: 'Roboto', Arial, sans-serif;
}

.card-field-row.no-line .field-value-status {
  border-bottom: none;
}



/* ==========================================================================
   PIE DE PÁGINA
   ========================================================================== */
.official-footer {
  background: linear-gradient(180deg, #07193b 0%, #030e22 100%);
  width: 100%;
  border-top: 2px solid #0f2b5a;
  margin-top: auto;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.official-footer-image {
  display: block;
  width: min(100%, 748px);
  height: auto;
}

/* ==========================================================================
   MODALES (ESTILOS Y FORMULARIOS)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #ffffff;
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-box {
  transform: translateY(0);
}

.modal-box-large {
  max-width: 600px;
}

.modal-header {
  background: var(--primary-navy);
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 1rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  padding: 0 4px;
}

.modal-close:hover {
  opacity: 1;
}

.modal-form {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
}

.required {
  color: #dc2626;
}

.form-group input,
.form-group select {
  padding: 8px 10px;
  font-size: 0.88rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary-navy);
  box-shadow: 0 0 0 3px rgba(13, 37, 76, 0.12);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.btn-cancel {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.btn-save {
  background: var(--primary-navy);
  border: none;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(13, 37, 76, 0.2);
}

.btn-save:hover {
  background-color: #173b75;
}

/* ==========================================================================
   ESTILOS DE LA TABLA Y LISTA
   ========================================================================== */
.list-controls-bar {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrap input {
  width: 100%;
  padding: 8px 36px 8px 12px;
  font-size: 0.84rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
}

.search-input-wrap svg {
  position: absolute;
  right: 10px;
  color: #64748b;
  pointer-events: none;
}

.list-summary-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.pill-total { background-color: #e2e8f0; color: #334155; }
.pill-checked { background-color: #dcfce7; color: #166534; }
.pill-pending { background-color: #dbeafe; color: #1e40af; }

.table-responsive {
  max-height: 380px;
  overflow-y: auto;
  overflow-x: auto;
}

.guests-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.guests-table th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 5;
}

.guests-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

.guests-table tr:hover {
  background-color: #f8fafc;
}

.table-action-btns {
  display: flex;
  gap: 6px;
}

.btn-mini-view {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.72rem;
}

.btn-mini-edit {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.72rem;
}

.btn-mini-delete {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.72rem;
}

.modal-footer-toolbar {
  padding: 12px 16px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-tool {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-tool:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.file-import-label {
  display: inline-flex;
  align-items: center;
}

.btn-danger-soft {
  color: #dc2626;
  border-color: #fecaca;
}

.btn-danger-soft:hover {
  background: #fee2e2;
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background-color: #1e293b;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
  white-space: nowrap;
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   RESPONSIVIDAD Y OPTIMIZACIÓN MOBILE
   ========================================================================== */
@media (max-width: 380px) {
  .mobile-wrapper {
    padding: 28px 16px 28px;
  }
  .action-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .grid-card {
    min-height: 58px;
    padding: 6px 4px;
    gap: 4px;
  }
  .card-title {
    font-size: 0.6rem;
  }
  .card-subtitle {
    font-size: 0.55rem;
  }
}
