/* Reset y base */
.required { color: #c0392b; font-weight: bold; margin-left: 2px; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  background: #E8EDF3;
  color: #1a1a1a;
  padding: 24px 16px;
  min-height: 100vh;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  overflow: hidden;
}

/* CAMPO FIJO (solo lectura, estilo diferenciado) */
textarea.campo-fijo {
  background: #F0F4FA;
  color: #2c4a8a;
  font-weight: 600;
  cursor: default;
  resize: none;
  border-color: #C5D3E8;
}

/* CABECERA CON LOGO + TÍTULO */
.form-header {
  padding: 12px 20px 8px;
  background: #fff;
}

.form-logo {
  width: 50%;
  max-width: 300px;
  height: auto;
  display: block;
}

.form-title {
  background: #4472C4;
  color: white;
  padding: 16px 24px;
}

.form-title h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-align: center;
}

/* SECCIONES */
section {
  margin: 0;
  border-bottom: 1px solid #dde3ec;
}
section:last-of-type { border-bottom: none; }

.section-header {
  background: #C5D3E8;
  color: #1a1a1a;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 20px;
  border-left: 4px solid #4472C4;
}

.section-header-numbered {
  font-weight: 700;
  font-size: 13px;
  padding: 12px 20px 4px 20px;
  color: #2c2c2c;
  border-bottom: 1px solid #aaa;
  margin-bottom: 0;
}

.section-body {
  padding: 14px 20px;
}

.subsection-title {
  font-weight: 700;
  font-size: 13px;
  color: #2c2c2c;
  margin-bottom: 8px;
}

.divider {
  height: 1px;
  background: #dde3ec;
  margin: 14px 0;
}

/* CAMPOS */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}

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

.field.full {
  width: 100%;
}

label {
  font-size: 11px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

input[type="text"],
input[type="date"],
select,
textarea {
  border: 1px solid #C5D3E8;
  border-radius: 4px;
  padding: 7px 10px;
  font-size: 13px;
  color: #1a1a1a;
  background: #FAFCFF;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  border-color: #4472C4;
  box-shadow: 0 0 0 3px rgba(68,114,196,0.15);
  background: #fff;
}

input[type="text"].campo-ok {
  border-color: #27ae60;
  background: #f4fbf6;
}
input[type="text"].campo-error {
  border-color: #e74c3c;
  background: #fdf2f2;
}

select:disabled {
  background: #f0f0f0;
  color: #999;
  cursor: not-allowed;
}

textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.info-text {
  font-size: 12px;
  color: #666;
  font-style: italic;
  background: #F7F9FF;
  border-left: 3px solid #4472C4;
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: 0 4px 4px 0;
}

/* TABLA DE CERTIFICADOS */
#tablaCertificados {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#tablaCertificados thead tr {
  background: #4472C4;
  color: white;
}

#tablaCertificados th {
  padding: 9px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
}

#tablaCertificados th.col-accion {
  width: 130px;
  text-align: right;
}

#tablaCertificados tbody tr:nth-child(even) {
  background: #F5F7FB;
}

#tablaCertificados tbody tr:hover {
  background: #EBF0FA;
}

#tablaCertificados td {
  padding: 4px 6px;
  border-bottom: 1px solid #dde3ec;
  vertical-align: middle;
}

#tablaCertificados td.td-accion {
  text-align: center;
  width: 50px;
}

#tablaCertificados td input[type="text"] {
  border: 1px solid #C5D3E8;
  border-radius: 3px;
  padding: 5px 8px;
  font-size: 13px;
  width: 100%;
  background: transparent;
}

#tablaCertificados td input[type="text"]:focus {
  border-color: #4472C4;
  box-shadow: 0 0 0 2px rgba(68,114,196,0.15);
  background: #fff;
}

#tablaCertificados td input.campo-error {
  border-color: #e74c3c;
  background: #fdf2f2;
}
#tablaCertificados td input.campo-ok {
  border-color: #27ae60;
}

/* BOTONES */
.btn-add {
  background: #4472C4;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-add:hover { background: #305599; }

.btn-remove {
  background: none;
  border: none;
  color: #c0392b;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 3px;
  transition: background 0.15s;
}
.btn-remove:hover { background: #fde8e6; }

/* DECLARACIÓN */
.declaracion .section-body p {
  font-size: 13px;
  line-height: 1.7;
  color: #333;
}

/* ACCIONES */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px;
  background: #F5F7FB;
  border-top: 2px solid #C5D3E8;
}

.btn-primary {
  background: #4472C4;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: #305599; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { background: #9ab0d8; cursor: not-allowed; }

.btn-firmar {
  background: #1a7a4a;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-firmar:hover { background: #155e38; }
.btn-firmar:active { transform: scale(0.98); }
.btn-firmar:disabled { background: #7ab89a; cursor: not-allowed; }

/* Panel estado firma */
.firma-estado {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: #EBF5FF;
  border-left: 4px solid #4472C4;
  margin: 0 20px 12px;
  border-radius: 0 4px 4px 0;
  font-size: 13px;
  color: #2c4a8a;
  font-weight: 600;
}

.firma-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid #C5D3E8;
  border-top-color: #4472C4;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.firma-ayuda {
  font-size: 12px;
  color: #666;
  padding: 0 20px 12px;
}
.firma-ayuda a { color: #4472C4; font-weight: 600; }

.btn-secondary {
  background: white;
  color: #4472C4;
  border: 2px solid #4472C4;
  border-radius: 5px;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: #EBF0FA; }

/* Notificación */
.notificacion {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #2ecc71;
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 9999;
  animation: slideIn 0.3s ease;
}
.notificacion.error { background: #e74c3c; }

@keyframes slideIn {
  from { transform: translateX(60px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 600px) {
  .field-row { grid-template-columns: 1fr; }
  .form-title h1 { font-size: 13px; }
}
