/* =========================
   BASE / LAYOUT GENERAL
   ========================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background: #f0f2f5;
    color: #222;
}

/* Contenedor general de página (opcional si luego quieres header/footer) */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =========================
   HEADER (opcionales)
   ========================= */
.main-header {
    background-color: #003366;
    color: white;
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

.logo {
    font-size: 24px;
    font-weight: bold;
}

.nav-menu a {
    color: #dddddd;
    text-decoration: none;
    margin-left: 20px;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background 0.3s, color 0.3s;
}

.nav-menu a:hover {
    background-color: #0055aa;
    color: #fff;
}

/* =========================
   CARD / CONTENEDOR CENTRAL
   ========================= */
.card {
    max-width: 900px;
    margin: 30px auto;
    background: #ffffff;
    padding: 24px 28px;
    border-radius: 14px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.12);
    border-top: 5px solid #003366;
}

.card h1 {
    font-size: 22px;
    color: #003366;
    margin-bottom: 6px;
}

.card h3 {
    font-size: 18px;
    color: #003366;
    margin-top: 22px;
    margin-bottom: 8px;
}

.small {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 12px;
}

/* =========================
   FORMULARIOS / CAMPOS
   ========================= */

form {
    margin-top: 10px;
}

/* Etiquetas */
label {
    display: block;
    font-weight: bold;
    margin: 10px 0 4px 0;
    color: #1a2b4c;
}

/* Inputs y textareas compartidos */
input[type="text"],
input[type="email"],
input[type="date"],
input[type="file"],
textarea {
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid #cbd2e0;
    font-size: 14px;
    transition: border 0.2s, box-shadow 0.2s, background 0.2s;
    background-color: #ffffff;
}

input[type="file"] {
    padding: 6px;
}

textarea {
    min-height: 70px;
    resize: vertical;
}

/* Focus visual */
input:focus,
textarea:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0,102,204,0.18);
}

/* Checkbox de consentimiento */
.consent {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff9e6;
    border: 1px solid #ffe6a3;
    font-size: 0.99rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.consent input[type="checkbox"] {
    transform: scale(1.1);
}

/* Agrupación de campos en el formulario largo */
.form-section {
    margin-top: 16px;
    padding-top: 8px;
    border-top: 1px solid #e2e6f0;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
}

.form-row .field {
    flex: 1 1 220px;
}

/* =========================
   PREVIEW DE IMÁGENES (INE)
   ========================= */

.previews {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
}

.preview-img {
    max-width: 280px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
    border: 1px solid #dde3ef;
    display: none; /* Se cambia a block desde JS */
}

/* Estado OCR */
#ocrStatus {
    font-size: 0.88rem;
    color: #333;
    margin-top: 6px;
}

/* =========================
   BOTONES
   ========================= */

.btn {
    padding: 9px 16px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95rem;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: #0066cc;
    color: #ffffff;
    box-shadow: 0 3px 6px rgba(0,102,204,0.4);
}

.btn-primary:hover {
    background: #0055aa;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,85,170,0.4);
}

.btn-secondary {
    background: #e6ecf5;
    color: #003366;
    border: 1px solid #c5d0e3;
}

.btn-secondary:hover {
    background: #d3ddf0;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Contenedor de botones (OCR o formulario) */
.actions,
.button-bar {
    display: flex;
    flex-wrap: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* =========================
   BLOQUES DE TEXTO (JSON / LOGS)
   ========================= */

pre,
#previewData,
#raw {
    background: #ffffff;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d8dfec;
    font-size: 0.85rem;
    color: #333;
    overflow-x: auto;
    margin-top: 6px;
}

/* =========================
   INE GRID / PLACEHOLDERS
   ========================= */

.ine-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 16px;
    justify-content: center;
}

.ine-card {
    flex: 1 1 260px;
    max-width: 360px;
    background: #f7f9fc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

/* Imagen tipo marca de agua */
.ine-img {
    width: 100%;
    max-height: 170px;
    object-fit: contain;
    opacity: 0.6;  /* efecto “marca de agua” */
    margin-bottom: 12px;
}

/* Barra inferior con texto y botón */
.ine-upload-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ine-upload-bar span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
}

/* Ocultamos el input nativo dentro de la tarjeta;
   el label actúa como botón */
.ine-card input[type="file"] {
    display: none;
}

/* =========================
   FOOTER / PIE (opcional)
   ========================= */

footer,
.mega-footer {
    background-color: #003366;
    color: #ccc;
    padding: 18px 20px;
    text-align: center;
    margin-top: auto;
    font-size: 13px;
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 768px) {
    .card {
        margin: 16px;
        padding: 18px 16px;
    }

    .main-header {
        padding: 10px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .nav-menu {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .nav-menu a {
        margin-left: 0;
    }

    .form-row {
        flex-direction: column;
    }

    .actions,
    .button-bar {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .preview-img {
        max-width: 100%;
    }

    .ine-grid {
        flex-direction: column;
    }

    .ine-card {
        max-width: 100%;
    }
}

/* =========================
   OVERLAY OCR (SPINNER)
   ========================= */

.ocr-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55); /* fondo oscuro translúcido */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.ocr-overlay--hidden {
  display: none;
}

/* Círculo girando */
.ocr-spinner {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 6px solid #e5e7eb;     /* gris claro */
  border-top-color: #0066cc;     /* azul principal */
  animation: ocr-spin 0.8s linear infinite;
}

@keyframes ocr-spin {
  to {
    transform: rotate(360deg);
  }
}
