/* ESTILOS GENERALES Y LAYOUT */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #f1f4f8;
  color: #333;
  min-height: 100vh;
}

.app-container {
  display: flex;
  min-height: 100vh;
}

/* PANEL LATERAL DE CONTROL */
.control-panel {
  width: 440px;
  min-width: 400px;
  background-color: #ffffff;
  border-right: 1px solid #e2e8f0;
  padding: 24px;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 10;
}

.panel-header h2 {
  font-size: 1.25rem;
  color: #004481;
  font-weight: 700;
  margin-bottom: 4px;
}

.panel-header .subtitle {
  font-size: 0.85rem;
  color: #64748b;
}

.form-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
}

.form-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 12px;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title-row h3 {
  margin-bottom: 0;
}

.form-group {
  margin-bottom: 12px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}

.date-input-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.date-input-group input[type="date"] {
  width: 140px;
  flex-shrink: 0;
}

.help-text {
  display: block;
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 4px;
}

.form-group input,
.editor-table input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: border-color 0.15s ease;
  background: #fff;
}

.form-group input:focus,
.editor-table input:focus {
  outline: none;
  border-color: #004481;
  box-shadow: 0 0 0 2px rgba(0, 68, 129, 0.15);
}

/* TABLA DE EDICIÓN DE MOVIMIENTOS */
.table-editor-wrapper {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  margin-bottom: 10px;
}

.editor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.editor-table th {
  background: #f1f5f9;
  padding: 8px 6px;
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 2;
}

.editor-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #f1f5f9;
}

.editor-table input {
  padding: 4px 6px;
  font-size: 0.78rem;
}

.btn-remove-row {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

.btn-remove-row:hover {
  background: #fee2e2;
}

.row-actions {
  display: flex;
  gap: 8px;
}

/* BOTONES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: #004481;
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #002d57;
}

.btn-secondary {
  background-color: #e2e8f0;
  color: #1e293b;
}

.btn-secondary:hover {
  background-color: #cbd5e1;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.78rem;
  border-radius: 4px;
}

.btn-xs {
  background: transparent;
  border: 1px solid #cbd5e1;
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 4px;
  color: #475569;
  cursor: pointer;
}

.btn-xs:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ÁREA DE VISTA PREVIA */
.preview-area {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #525659; /* Fondo visor PDF */
}

/* HOJA DE DOCUMENTO IDÉNTICA AL ORIGINAL */
.page-sheet {
  background-color: #ffffff;
  width: 210mm;
  min-height: 297mm;
  padding: 22mm 24mm;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
  color: #000000;
  display: flex;
  flex-direction: column;
}

/* ENCABEZADO BBVA */
.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 25px;
}

.header-right-info {
  text-align: right;
  font-size: 12px;
  color: #222;
  padding-top: 5px;
}

.header-date-text {
  font-family: Arial, Helvetica, sans-serif;
}

.bbva-brand {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}

.bbva-logo-svg {
  width: 145px;
  height: auto;
  display: block;
}

.bbva-tagline {
  margin-top: 3px;
  margin-left: 102px; /* Alineado debajo de las letras VA */
}

.tag-creando {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #199ddb;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

/* CUERPO DEL DOCUMENTO */
.doc-body {
  font-size: 13px;
  line-height: 1.4;
}

.client-info-block {
  margin-bottom: 22px;
}

.client-greeting {
  font-size: 14.5px;
  margin-bottom: 4px;
  color: #111;
}

.client-address-line {
  font-size: 13px;
  color: #222;
  margin-bottom: 2px;
}

.section-heading {
  font-size: 14px;
  font-weight: normal;
  color: #222;
  margin-bottom: 12px;
}

/* TABLA DE MOVIMIENTOS BBVA */
.account-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 35px;
  font-size: 11px;
}

.account-table th,
.account-table td {
  border: 1px solid #333333;
  padding: 4px 6px;
  text-align: left;
  vertical-align: middle;
}

.account-table th {
  background-color: #ffffff;
  font-weight: normal;
  color: #111;
}

.account-table td {
  font-family: Arial, Helvetica, sans-serif;
  color: #000;
}

/* DESPEDIDA Y FIRMA */
.doc-signoff {
  margin-bottom: 25px;
  font-size: 13.5px;
}

.saludo-title {
  margin-bottom: 4px;
  color: #111;
}

.saludo-brand {
  font-size: 14.5px;
}

.bbva-bold {
  font-weight: bold;
  color: #004481;
}

.bbva-blue {
  font-weight: bold;
  color: #199ddb;
}

/* PIE DE PÁGINA Y NOTAS LEGALES */
.doc-footer-notes {
  font-size: 9.5px;
  line-height: 1.35;
  color: #111;
}

.note-text {
  margin-bottom: 16px;
  text-align: justify;
}

.legal-separator {
  margin-top: 10px;
  margin-bottom: 4px;
  font-family: "Courier New", Courier, monospace, Arial;
  font-size: 9.5px;
  font-weight: bold;
}

.legal-separator-end {
  margin-top: 4px;
  font-family: "Courier New", Courier, monospace, Arial;
  font-size: 9.5px;
  font-weight: bold;
}

.legal-text {
  font-size: 8.8px;
  line-height: 1.3;
  text-align: justify;
  margin-bottom: 10px;
}

/* ESTILOS PARA IMPRESIÓN Y PDF */
@media print {
  body {
    background-color: #ffffff;
    margin: 0;
    padding: 0;
  }

  .no-print,
  .control-panel {
    display: none !important;
  }

  .preview-area {
    padding: 0;
    background: transparent;
    display: block;
  }

  .page-sheet {
    box-shadow: none;
    width: 100%;
    min-height: auto;
    padding: 15mm 20mm;
    margin: 0;
  }

  @page {
    size: A4 portrait;
    margin: 0;
  }
}
