/* ==========================================================================
   1. ESTILOS GENERALES Y BASE
   ========================================================================== */
body {
  margin: 0;
  padding: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  background-color: #f9fafb;
  color: #1f2937;
}

.main-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

/* ==========================================================================
   2. MENÚ DE NAVEGACIÓN
   ========================================================================== */
.nav-menu {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #ffffff;
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.nav-brand .nav-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: #4b5563;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: #111827;
}

/* Botón Descargar CSV Destacado */
.nav-links a.btn-download-nav {
  color: #22c55e !important;
  font-weight: 600;
}
.nav-links a.btn-download-nav:hover {
  color: #16a34a !important;
}

/* ==========================================================================
   3. SECCIÓN DE BÚSQUEDA
   ========================================================================== */
.search-container {
  margin: 32px 0;
}

.search-wrap {
  display: flex;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}

.search-wrap input {
  flex: 1;
  padding: 12px 16px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: #ffffff;
  outline: none;
  transition: border-color 0.2s;
}

.search-wrap input:focus {
  border-color: #111827;
}

.search-wrap button {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  background-color: #111827;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.search-wrap button:hover {
  background-color: #1f2937;
}

/* ==========================================================================
   4. DETALLE DEL REGISTRO ACTIVO
   ========================================================================== */
.record-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  background: #ffffff;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.record-header h2 {
  margin: 8px 0 0 0;
  font-size: 24px;
  color: #111827;
}

.badge {
  background-color: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
}

.empresa-logo-box img {
  max-height: 45px;
  width: auto;
  object-fit: contain;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  background: #ffffff;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  margin-bottom: 32px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-group label {
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
}

.field-group input,
.field-group select {
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  outline: none;
  background-color: #ffffff;
}

.field-group input:focus,
.field-group select:focus {
  border-color: #111827;
}

.readonly-field {
  background-color: #f3f4f6 !important;
  color: #6b7280;
  cursor: not-allowed;
}

.section-subtitle {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin: 32px 0 16px 0;
}

/* ==========================================================================
   5. GALERÍA DE DOCUMENTOS E IMÁGENES
   ========================================================================== */
.docs-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.doc-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.doc-label {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.input-img {
  font-size: 12px;
  color: #6b7280;
}

.doc-preview-wrapper {
  position: relative;
  width: 100%;
}

.doc-preview {
  width: 100%;
  min-height: 120px;
  background-color: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.doc-preview img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
}

/* Botón Cruz Flotante Eliminar Imagen */
.btn-delete-img {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(239, 68, 68, 0.95);
  color: white;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition:
    transform 0.2s,
    background-color 0.2s;
  line-height: 1;
}
.btn-delete-img:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.btn-submit {
  padding: 12px 32px;
  font-size: 14px;
  font-weight: 600;
  background-color: #111827;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.btn-submit:hover {
  background-color: #1f2937;
}

/* ==========================================================================
   6. SISTEMA DE VENTANAS MODALES POPUP (COMPORTAMIENTO ESTRICTO)
   ========================================================================== */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.5) !important; /* Capa oscura traslúcida */
  backdrop-filter: blur(4px) !important; /* Difumina la interfaz por detrás */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 999999 !important; /* Por encima de cualquier menú o capa */
}

.modal-box {
  background: #ffffff !important;
  padding: 24px !important;
  border-radius: 8px !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2) !important;
  width: 90% !important;
  max-width: 400px !important;
  text-align: center !important;
  box-sizing: border-box !important;
  animation: scaleUp 0.18s ease-out;
}

.modal-box h3 {
  margin-top: 0 !important;
  font-size: 18px !important;
  color: #111827 !important;
  font-weight: 600 !important;
}

.modal-box p {
  font-size: 14px !important;
  color: #4b5563 !important;
  margin: 12px 0 24px 0 !important;
  line-height: 1.5 !important;
}

.modal-actions {
  display: flex !important;
  justify-content: center !important;
  gap: 12px !important;
}

.modal-btn {
  padding: 10px 18px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  border-radius: 6px !important;
  border: none !important;
  cursor: pointer !important;
  transition: background-color 0.2s;
}

.btn-ok {
  background: #111827 !important;
  color: #ffffff !important;
}
.btn-ok:hover {
  background: #1f2937 !important;
}

.btn-danger {
  background: #ef4444 !important;
  color: #ffffff !important;
}
.btn-danger:hover {
  background: #dc2626 !important;
}

.btn-cancel {
  background: #f3f4f6 !important;
  color: #4b5563 !important;
  border: 1px solid #e5e7eb !important;
}
.btn-cancel:hover {
  background: #e5e7eb !important;
}

/* ==========================================================================
   7. REGLA MAESTRA DE OCULTAMIENTO
   ========================================================================== */
.hidden {
  display: none !important;
}

@keyframes scaleUp {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
