/* =============================================================
   DISEÑO DE FORMULARIO ERP (ESTILO SIIGO/ALEGRA)
   ============================================================= */

body {
    background-color: #f4f6f8; /* Fondo gris muy suave para toda la app */
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #333;
}

.contenedor-principal {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px 80px; /* Espacio para footer */
}

/* --- HEADER DEL DOCUMENTO --- */
.header-doc {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-doc h1 {
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.btn-secundario {
    background: white;
    border: 1px solid #d1d5db;
    padding: 8px 16px;
    border-radius: 6px;
    color: #4b5563;
    font-weight: 500;
    cursor: pointer;
}

/* --- PANEL BLANCO PRINCIPAL --- */
.panel-formulario {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 30px;
}

/* --- GRID SYSTEM PARA FORMULARIO --- */
.fila-form {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.grupo-input {
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Columnas flexibles */
.col-1 { flex: 1; }
.col-2 { flex: 2; }
.col-3 { flex: 3; }
.col-4 { flex: 4; }
.col-5 { flex: 5; }
.spacer { flex: 1; } /* Espacio vacío */

/* Estilos de Label e Input */
label {
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 6px;
}

label.required::after {
    content: " *";
    color: #ef4444;
}

input, select, textarea {
    height: 36px;
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #1f2937;
    transition: border-color 0.2s;
    background-color: #fff;
}

input:focus, select:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Input Group (para prefijos como CV) */
.input-group {
    display: flex;
    align-items: center;
}
.input-group .prefijo {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-right: none;
    padding: 0 10px;
    height: 36px;
    line-height: 34px;
    border-radius: 6px 0 0 6px;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
}
.input-group input {
    border-radius: 0 6px 6px 0;
    flex: 1;
}

/* --- TABLA DE DETALLES --- */
.seccion-detalle {
    margin-top: 30px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.tabla-items {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tabla-items thead th {
    background-color: #f9fafb;
    color: #374151;
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.tabla-items tbody td {
    padding: 8px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}

/* Inputs dentro de la tabla (sin bordes hasta hover) */
.input-tabla {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 6px;
}
.input-tabla:hover { border-color: #e5e7eb; background: #fff; }
.input-tabla:focus { border-color: #2563eb; background: #fff; }

.btn-icon-delete {
    background: none; border: none; cursor: pointer; color: #ef4444; font-size: 16px;
}

.btn-agregar-item {
    background: none;
    border: none;
    color: #2563eb;
    font-weight: 600;
    padding: 15px;
    cursor: pointer;
    display: block;
    width: 100%;
    text-align: left;
    border-top: 1px solid #e5e7eb;
}
.btn-agregar-item:hover { background-color: #f0f9ff; }

/* --- FOOTER Y TOTALES --- */
.footer-doc {
    display: flex;
    margin-top: 30px;
    gap: 40px;
}

.observaciones { flex: 6; }
.observaciones textarea {
    width: 100%; height: 100px; resize: vertical;
}

.panel-totales {
    flex: 4;
    background: #f9fafb;
    padding: 20px;
    border-radius: 8px;
}

.fila-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    color: #4b5563;
}

.fila-total.gran-total {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    border-top: 1px solid #d1d5db;
    padding-top: 10px;
    margin-top: 10px;
}

/* --- BARRA INFERIOR FLOTANTE --- */
.barra-acciones {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.btn-guardar {
    background-color: #2563eb;
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(37,99,235,0.2);
}
.btn-guardar:hover { background-color: #1d4ed8; }

.btn-cancelar {
    background: transparent;
    color: #6b7280;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

/* Autocomplete Flotante */
.autocomplete-list {
    position: absolute; top: 100%; left: 0; width: 100%;
    background: white; border: 1px solid #e5e7eb;
    border-radius: 6px; box-shadow: 0 10px 15px rgba(0,0,0,0.1);
    z-index: 50; max-height: 200px; overflow-y: auto;
}
.autocomplete-item { padding: 10px; cursor: pointer; font-size: 13px; }
.autocomplete-item:hover { background-color: #f3f4f6; color: #2563eb; }
/* =============================================================
   ESPACIADO: más aire entre las secciones del documento
   (encabezado, datos, detalle, forma de pago, totales y botones)
   ============================================================= */
.contenedor-principal { margin-top: 36px; }
.header-doc { margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.panel-formulario { padding: 36px 40px; border-radius: 12px; box-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 10px 28px rgba(15, 23, 42, .05); }
.fila-form { gap: 24px; margin-bottom: 26px; }
.seccion-detalle { margin-top: 40px; }
.tabla-items thead th { padding: 12px 14px; }
.tabla-items tbody td { padding: 10px 8px; }
.btn-agregar-item { padding: 16px 18px; }
.footer-doc { margin-top: 40px; gap: 48px; padding-top: 32px; border-top: 1px solid #edf0f4; }
.panel-totales { padding: 24px 26px; border-radius: 10px; }
.fila-total { margin-bottom: 12px; }
.barra-acciones { margin-top: 36px; padding-top: 24px; border-top: 1px solid #edf0f4; align-items: center; }
@media (max-width: 760px) {
    .contenedor-principal { margin-top: 20px; }
    .panel-formulario { padding: 22px 16px; }
    .fila-form { gap: 16px; margin-bottom: 18px; }
    .seccion-detalle { margin-top: 28px; }
    .footer-doc { gap: 24px; margin-top: 28px; padding-top: 24px; }
}
