﻿/* ==========================================================================
   TEMA CORPORATIVO GLOBAL - FLAT & MINIMALISTA
   ========================================================================== */
:root {
    --empresa-primario: #0843CC;
    --empresa-primario-hover: #0044eb;
    --empresa-secundario: #f8f9fa;
    /* NUEVO: Variable para botones de confirmación/guardar */
    --empresa-exito: #2dce89;
    --empresa-exito-hover: #24a46d;
    --empresa-texto-claro: #ffffff;
    --empresa-texto-oscuro: #344767;
    --empresa-borde: #e9ecef;
    --borde-radio-flat: 4px;
    --empresa-fuente: 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Clase para el fondo del banner superior del Layout */
.bg-corporativo {
    background-color: var(--empresa-primario) !important;
}

/* ==========================================================================
   TIPOGRAFÍA GLOBAL (Estandarización)
   ========================================================================== */
body, h1, h2, h3, h4, h5, h6, p, span, a, button, input, select, table, th, td, .badge-flat {
    font-family: var(--empresa-fuente) !important;
}

/* ==========================================================================
   ESTILOS COMPONENTES (FLAT DESIGN)
   ========================================================================== */

/* 1. BOTONES MINIMALISTAS FLAT */
.btn-corporativo {
    background-color: var(--empresa-primario) !important;
    color: var(--empresa-texto-claro) !important;
    border-radius: var(--borde-radio-flat) !important;
    border: none;
    box-shadow: none !important;
    background-image: none !important;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    transition: background-color 0.2s ease;
}

    .btn-corporativo:hover {
        background-color: var(--empresa-primario-hover) !important;
    }

.btn-outline-corporativo {
    border: 1px solid var(--empresa-primario) !important;
    color: var(--empresa-primario) !important;
    background-color: transparent !important;
    border-radius: var(--borde-radio-flat) !important;
    box-shadow: none !important;
    font-weight: 500;
    text-transform: none;
}

    .btn-outline-corporativo:hover {
        background-color: var(--empresa-primario) !important;
        color: var(--empresa-texto-claro) !important;
    }

/* 2. NAV PILLS FLAT */
.nav-pills .moving-tab {
    display: none !important;
}

.nav-pills-flat {
    border-bottom: 1px solid var(--empresa-borde);
}

    .nav-pills-flat .nav-link {
        color: #64748b;
        border-radius: 0 !important;
        padding: 0.5rem 1rem;
        margin-right: 1rem;
        font-size: 0.85rem;
        font-weight: 600;
        box-shadow: none !important;
        background-color: transparent !important;
        border-bottom: 2px solid transparent;
        position: relative;
        z-index: 1;
    }

        .nav-pills-flat .nav-link:hover {
            color: var(--empresa-texto-oscuro);
        }

        .nav-pills-flat .nav-link.active {
            color: var(--empresa-primario) !important;
            border-bottom: 2px solid var(--empresa-primario);
        }

/* 3. ETIQUETAS (BADGES) FLAT */
.badge-flat {
    box-shadow: none !important;
    background-image: none !important;
    border-radius: var(--borde-radio-flat);
    padding: 0.35em 0.65em;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
}

.badge-flat-success {
    background-color: rgba(45, 206, 137, 0.15);
    color: #2dce89;
}

.badge-flat-warning {
    background-color: rgba(251, 99, 64, 0.15);
    color: #fb6340;
}

.badge-flat-danger {
    background-color: rgba(245, 54, 92, 0.15);
    color: #f5365c;
}

/* 4. DATATABLES (TABLA COMPACTA Y ESPACIADA) */
/* Separación entre botones y elemento "Mostrar N registros" */
.dataTables_length {
    margin-top: 1.5rem !important;
    margin-bottom: 0.5rem !important;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ced4da;
    border-radius: var(--borde-radio-flat);
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    outline: none;
    box-shadow: none !important;
    background-color: #fff;
    width: 250px;
    margin-left: 0 !important;
}

    .dataTables_wrapper .dataTables_filter input:focus {
        border-color: var(--empresa-primario);
    }

/* Encabezados más grandes y notorios */
table.dataTable thead th {
    border-bottom: 2px solid var(--empresa-borde) !important;
    color: var(--empresa-texto-oscuro) !important;
    text-transform: uppercase;
    font-size: 0.75rem !important; /* Aumentado */
    font-weight: 700 !important;
    letter-spacing: 0.5px;
    padding-bottom: 0.6rem !important;
}
/* Filas más reducidas (Menos padding = Menos altura) */
table.dataTable tbody td {
    border-bottom: 1px solid var(--empresa-borde);
    vertical-align: middle;
    font-size: 0.85rem;
    color: var(--empresa-texto-oscuro);
    padding: 0.4rem 1rem !important; /* Altura reducida drásticamente */
}


/* 5. FIX PARA MENÚS DESPLEGABLES */
.table-responsive {
    overflow: visible !important;
}

.dropdown-menu-flat {
    border: 1px solid var(--empresa-borde);
    border-radius: var(--borde-radio-flat);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05) !important;
    padding: 0.5rem 0;
}

    .dropdown-menu-flat .dropdown-item {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
        font-weight: 500;
    }

        .dropdown-menu-flat .dropdown-item:hover {
            background-color: var(--empresa-secundario);
        }



/* 6. FORMULARIOS Y MODALES FLAT */
.form-control-flat {
    background-color: #f8f9fa; /* Fondo gris sutil */
    border: 1px solid #e2e8f0;
    border-radius: var(--borde-radio-flat);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: var(--empresa-texto-oscuro);
    transition: all 0.2s ease;
    box-shadow: none !important; /* Estilo Flat: Cero sombras interiores */
}

    .form-control-flat:focus {
        background-color: #ffffff; /* Brilla al hacer clic */
        border-color: var(--empresa-primario);
        box-shadow: none !important;
    }

.form-label-flat {
    font-size: 0.65rem;
    font-weight: 700;
    color: #8898aa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
}

.modal-content-flat {
    border-radius: 6px;
    border: 1px solid var(--empresa-borde);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.025) !important;
}

.modal-header-flat {
    border-bottom: 1px solid var(--empresa-borde);
}

.modal-footer-flat {
    border-top: 1px solid var(--empresa-borde);
    background-color: #fcfcfc;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}


/* ==========================================================================
   7. WIZARD (PASOS DEL FORMULARIO) FLAT
   ========================================================================== */
.wizard-header {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

    .wizard-header::before {
        content: '';
        position: absolute;
        top: 15px;
        left: 2rem;
        right: 2rem;
        height: 2px;
        background: var(--empresa-borde);
        z-index: 1;
    }

.wizard-indicator {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--empresa-borde);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #8898aa;
    font-size: 0.85rem;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

    .wizard-indicator.active {
        border-color: var(--empresa-primario);
        color: var(--empresa-primario);
        background: #fff;
    }

    .wizard-indicator.completed {
        background: var(--empresa-primario);
        border-color: var(--empresa-primario);
        color: #fff;
    }

.wizard-step {
    display: none;
    animation: fadeIn 0.4s ease;
}

    .wizard-step.active {
        display: block;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   8. CHOICES.JS (TAGS / MULTI-SELECT) FLAT
   ========================================================================== */
.choices {
    margin-bottom: 0 !important;
}

.choices__inner {
    background-color: #f8f9fa !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: var(--borde-radio-flat) !important;
    box-shadow: none !important;
    min-height: 38px;
    padding: 4px 6px !important;
    transition: all 0.2s ease;
}

.choices.is-focused .choices__inner {
    background-color: #ffffff !important;
    border-color: var(--empresa-primario) !important;
}

.choices__list--multiple .choices__item {
    background-color: var(--empresa-primario) !important;
    border: none !important;
    border-radius: 3px !important;
    font-family: var(--empresa-fuente);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    padding: 3px 8px;
    margin-right: 5px;
}

.choices[data-type*="select-multiple"] .choices__button {
    border-left: none !important;
    margin-left: 5px;
    opacity: 0.8;
}

    .choices[data-type*="select-multiple"] .choices__button:hover {
        opacity: 1;
    }



/* ==========================================================================
   FIX GLOBAL: ANTI-PARPADEO DE MENÚS DESPLEGABLES (Argon FOUC)
   Esto soluciona el flash de "Cerrar Sesión" y las "Acciones" de DataTables
   ========================================================================== */
.dropdown-menu {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-10px); /* Prepara la animación hacia abajo */
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s !important;
}

    .dropdown-menu.show {
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: translateY(0);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0s !important;
    }



/* ==========================================================================
   AGREGA ESTE NUEVO BOTÓN A TU SECCIÓN DE BOTONES
   ========================================================================== */
.btn-exito-corporativo {
    background-color: var(--empresa-exito) !important;
    color: var(--empresa-texto-claro) !important;
    border-radius: var(--borde-radio-flat) !important;
    border: none;
    box-shadow: none !important;
    background-image: none !important;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    transition: background-color 0.2s ease;
}

    .btn-exito-corporativo:hover {
        background-color: var(--empresa-exito-hover) !important;
    }




/* ==========================================================================
   DASHBOARD SIG - FONDOS SUAVES PARA ÍCONOS (FLAT)
   ========================================================================== */
.icon-shape-flat {
    width: 48px;
    height: 48px;
    border-radius: 8px; /* Cuadrado con bordes redondeados, más moderno que el círculo */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.bg-soft-primary {
    background-color: rgba(26, 92, 255, 0.1) !important;
    color: var(--empresa-primario) !important;
}

.bg-soft-warning {
    background-color: rgba(251, 99, 64, 0.1) !important;
    color: #fb6340 !important;
}

.bg-soft-success {
    background-color: rgba(45, 206, 137, 0.1) !important;
    color: #2dce89 !important;
}

.bg-soft-danger {
    background-color: rgba(245, 54, 92, 0.1) !important;
    color: #f5365c !important;
}

/* Mini-tarjetas para las listas de tareas */
.task-item-flat {
    border: 1px solid var(--empresa-borde);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

    .task-item-flat:hover {
        border-color: var(--empresa-primario);
        background-color: var(--empresa-secundario);
    }

/* ==========================================================================
   SWITCH / CHECKBOX CORPORATIVO (Estado Activo Global)
   Reescribe el color nativo de Bootstrap/Argon al encenderse
   ========================================================================== */
.form-switch .form-check-input:checked {
    background-color: var(--empresa-primario) !important;
    border-color: var(--empresa-primario) !important;
}


/* ==========================================================================
   DATATABLES: CLASE UTILITARIA PARA AUTOAJUSTE DE TEXTO (Solo usar donde se necesite)
   ========================================================================== */
table.tabla-autoajustable {
    width: 100% !important;
    table-layout: auto !important;
}

    table.tabla-autoajustable th,
    table.tabla-autoajustable td {
        white-space: normal !important; /* Obliga al texto a bajar de línea */
        word-wrap: break-word !important; /* Rompe palabras si no caben */
        vertical-align: middle !important;
        padding: 10px 8px !important;
    }

    table.tabla-autoajustable tbody td {
        font-size: 0.85rem !important;
    }