/* ===== Pro Theme - estilos compartidos MiFactura ===== */

:root {
    --mf-primary: #007bff;
    --mf-primary-dark: #0056d2;
    --mf-radius: 12px;
    --mf-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --mf-shadow-strong: 0 4px 20px rgba(0, 0, 0, 0.10);
    --mf-muted: #6c757d;
    --mf-border: #e3e6f0;
}

.home-card {
    border: none;
    border-radius: var(--mf-radius);
    box-shadow: var(--mf-shadow);
    overflow: hidden;
    margin-bottom: 1rem;
}

.home-card .card-header {
    padding: 1rem 1.25rem;
    border-bottom: 0;
}

.home-card .card-header h3,
.home-card .card-header h4,
.home-card .card-header h5 {
    margin: 0;
    font-weight: 600;
    word-break: break-word;
}

.home-card .card-header h3 {
    font-size: 1.1rem;
}

.home-card .card-header h3 i,
.home-card .card-header h4 i,
.home-card .card-header h5 i {
    margin-right: .5rem;
}

.header-empresa {
    background: linear-gradient(135deg, var(--mf-primary) 0%, var(--mf-primary-dark) 100%);
    color: #fff;
}

    .header-empresa .close,
    .header-empresa button.close {
        color: #fff;
        text-shadow: none;
        opacity: .9;
    }

.header-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: #fff;
}

.header-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
}

.header-info {
    background: linear-gradient(135deg, #17a2b8 0%, #117a8b 100%);
    color: #fff;
}

.header-dark {
    background: linear-gradient(135deg, #343a40 0%, #1d2124 100%);
    color: #fff;
}

/* Filtros / formularios */
.filtros-grid label {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--mf-muted);
    margin-bottom: .25rem;
}

.filtros-grid .form-control,
.filtros-grid .form-select,
.filtros-grid .select2-container--bootstrap4 .select2-selection {
    border-radius: 8px;
    min-height: 38px;
}

.filtros-acciones {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

    .filtros-acciones .btn {
        flex: 1 1 auto;
        min-height: 40px;
        border-radius: 8px;
    }

@media (min-width: 768px) {
    .filtros-acciones .btn {
        flex: 0 0 auto;
    }
}

.filtros-acciones .form-check {
    margin-right: .5rem;
}

/* Stat pills */
.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: rgba(255, 255, 255, .15);
    border-radius: 999px;
    padding: .15rem .65rem;
    font-size: .8rem;
}

/* Botones */
.btn {
    border-radius: 8px;
}

.btn-pro-primary {
    background: var(--mf-primary);
    color: #fff;
    border: none;
}

    .btn-pro-primary:hover {
        background: var(--mf-primary-dark);
        color: #fff;
    }

/* Empty state */
.mf-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--mf-muted);
}

    .mf-empty i {
        font-size: 3rem;
        opacity: .4;
        display: block;
        margin-bottom: .75rem;
    }

    .mf-empty p {
        margin: 0;
    }

/* Tablas */
.table-pro {
    margin-bottom: 0;
}

    .table-pro thead {
        background: #f8f9fa;
    }

    .table-pro th {
        font-size: .8rem;
        text-transform: uppercase;
        letter-spacing: .03em;
        color: var(--mf-muted);
        font-weight: 600;
        border-bottom: 1px solid var(--mf-border);
    }

    .table-pro td {
        vertical-align: middle;
    }

    .table-pro .acciones-cell .btn {
        margin: 2px;
    }

/* Tabla responsive: en mobile transforma cada fila en card */
@media (max-width: 767.98px) {
    .table-pro-responsive thead {
        display: none;
    }

    .table-pro-responsive,
    .table-pro-responsive tbody,
    .table-pro-responsive tr,
    .table-pro-responsive td {
        display: block;
        width: 100%;
        white-space: normal !important;   /* anula nowrap heredado de DataTables */
    }

    .table-pro-responsive tr {
        border: 1px solid var(--mf-border);
        border-radius: 10px;
        margin-bottom: .75rem;
        padding: .5rem;
        background: #fff;
    }

    /* Layout apilado: label arriba, valor abajo (usa todo el ancho) */
    .table-pro-responsive td {
        border: none;
        padding: .35rem .5rem;
        text-align: left !important;
        position: relative;
        word-break: break-word;
        overflow-wrap: anywhere;
        font-size: .95rem;
    }

    .table-pro-responsive td + td {
        border-top: 1px dashed #f0f2f5;
        padding-top: .45rem;
    }

    .table-pro-responsive td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: .15rem;
        font-weight: 600;
        font-size: .68rem;
        line-height: 1.15;
        color: var(--mf-muted);
        text-transform: uppercase;
        letter-spacing: .03em;
        white-space: normal;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    /* Oculta celdas vacías para evitar labels colgando */
    .table-pro-responsive td:empty,
    .table-pro-responsive td.is-empty {
        display: none;
    }

    .table-pro-responsive td.acciones-cell {
        padding-left: .5rem;
        display: flex;
        flex-wrap: wrap;
        gap: .25rem;
        margin-top: .35rem;
        border-top: 1px solid #e3e6f0;
        padding-top: .55rem;
    }

    .table-pro-responsive td.acciones-cell::before {
        display: none;
    }

    /* Respeta nowrap solo en encabezados/desktop, en mobile no */
    .table-pro-responsive.nowrap td {
        white-space: normal !important;
    }
}

/* Modales */
.modal-content {
    border: none;
    border-radius: var(--mf-radius);
    overflow: hidden;
    box-shadow: var(--mf-shadow-strong);
}

.modal-header.header-empresa,
.modal-header.header-success,
.modal-header.header-warning,
.modal-header.header-info,
.modal-header.header-dark {
    border-bottom: 0;
}

/* Documentos invalidados: tachado + watermark visual */
.row-invalidado td {
    color: #6c757d !important;
    text-decoration: line-through;
    text-decoration-color: rgba(220, 53, 69, 0.65);
    text-decoration-thickness: 1.5px;
    background-color: rgba(220, 53, 69, 0.04);
}

.row-invalidado td.acciones-cell,
.row-invalidado td.acciones-cell * {
    text-decoration: none !important;
}

.row-invalidado td strong .badge.bg-danger {
    text-decoration: none !important;
}

/* Documentos sin clasificar (falta tipoOperacion/clasificacion/sector/tipoCosto/tipoIngreso) */
.row-sin-clasificar {
    position: relative;
    background-color: rgba(255, 193, 7, 0.06);
}
.row-sin-clasificar td:first-child {
    border-left: 3px solid #ffc107;
}
.row-sin-clasificar td:first-child::before {
    content: "\f071"; /* fa-exclamation-triangle */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #ffc107;
    margin-right: .35rem;
}

/* Badges para tipo DTE */
.badge-dte {
    font-size: .75rem;
    letter-spacing: .03em;
    font-weight: 600;
    padding: .35em .6em;
}

/* Login pulido — split-screen en desktop, apilado en mobile */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    background: #fff;
    margin: 0;
}

.login-brand {
    flex: 1 1 50%;
    background: linear-gradient(135deg, var(--mf-primary) 0%, var(--mf-primary-dark) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -30%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

.login-brand::after {
    content: "";
    position: absolute;
    bottom: -40%;
    left: -20%;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    pointer-events: none;
}

.login-brand-inner {
    position: relative;
    z-index: 1;
    max-width: 460px;
}

.login-brand img {
    height: 110px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

.login-brand h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: .5rem 0 .75rem;
}

.login-brand .tagline {
    font-size: 1.05rem;
    opacity: .92;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.login-brand .features {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
    display: inline-block;
}

.login-brand .features li {
    margin: .65rem 0;
    font-size: .95rem;
    opacity: .95;
}

.login-brand .features i {
    width: 22px;
    margin-right: .5rem;
    opacity: .85;
}

.login-form-side {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #fff;
}

.login-form-card {
    width: 100%;
    max-width: 420px;
}

.login-form-card .login-form-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a2331;
    margin-bottom: .35rem;
}

.login-form-card .login-form-sub {
    color: var(--mf-muted);
    margin-bottom: 1.75rem;
    font-size: .95rem;
}

.login-form-card .form-control {
    height: 46px;
    border-radius: 8px;
}

.login-form-card .input-group-text {
    border-radius: 8px 0 0 8px;
    border-right: 0;
}

.login-form-card .form-control + .input-group-text,
.login-form-card .input-group-text + .form-control {
    border-left: 0;
}

.login-form-card .btn-primary {
    background: linear-gradient(135deg, var(--mf-primary) 0%, var(--mf-primary-dark) 100%);
    border: none;
    height: 46px;
    border-radius: 8px;
    font-weight: 600;
    transition: transform .15s, box-shadow .15s;
}

.login-form-card .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.25);
}

.login-form-card .active-link {
    color: var(--mf-primary);
    text-decoration: none;
    font-weight: 600;
}

.login-form-card .active-link:hover {
    text-decoration: underline;
}

@media (max-width: 991.98px) {
    .login-wrapper {
        flex-direction: column;
    }

    .login-brand {
        flex: 0 0 auto;
        padding: 2rem 1.5rem;
    }

    .login-brand img {
        height: 70px;
    }

    .login-brand h1 {
        font-size: 1.5rem;
    }

    .login-brand .tagline {
        font-size: .95rem;
        margin-bottom: 0;
    }

    .login-brand .features {
        display: none;
    }

    .login-form-side {
        padding: 1.5rem 1.25rem;
    }
}

/* Compatibilidad: mantenemos la clase vieja por si otra vista la usa */
.login-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    background: #fff;
    overflow: hidden;
}

.login-card .login-header {
    background: linear-gradient(135deg, var(--mf-primary) 0%, var(--mf-primary-dark) 100%);
    color: #fff;
    text-align: center;
    padding: 2rem 1.5rem 1.25rem;
}

.login-card .login-header h1 {
    font-size: 1.4rem;
    margin: .5rem 0 0;
    font-weight: 600;
}

.login-card .login-header p {
    margin: 0;
    opacity: .9;
    font-size: .85rem;
}

.login-card .login-body {
    padding: 1.5rem;
}

/* Scroll suave para listas en modal */
.modal-dialog-scrollable .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* Stepper / dropzone para subir JSON */
.dropzone-pro {
    border: 2px dashed #b9c4d6;
    border-radius: 12px;
    padding: 2.25rem 1rem;
    text-align: center;
    background: #fbfcfe;
    transition: background .15s, border-color .15s;
    cursor: pointer;
}

    .dropzone-pro:hover {
        border-color: var(--mf-primary);
        background: #f0f6ff;
    }

    .dropzone-pro i {
        font-size: 2.5rem;
        color: var(--mf-primary);
        margin-bottom: .5rem;
    }

    .dropzone-pro.is-dragover {
        background: #eaf2ff;
        border-color: var(--mf-primary-dark);
    }

/* Mejoras DataTable */
.dataTables_wrapper .dt-buttons .btn {
    border-radius: 8px;
    margin-bottom: .5rem;
}

.dataTables_filter input,
.dataTables_length select {
    border-radius: 8px !important;
}

@media (max-width: 767.98px) {
    .dataTables_wrapper .dt-buttons {
        margin-bottom: .5rem;
        display: flex;
        flex-wrap: wrap;
        gap: .25rem;
    }

    .dataTables_filter,
    .dataTables_length {
        text-align: left !important;
        width: 100%;
    }

    .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
    }
}

/* Sidebar/footer cosmetics */
.main-footer {
    border-top: 1px solid var(--mf-border);
}

/* === Switcher de empresa en navbar === */
.empresa-switcher {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .75rem;
    border-radius: 999px;
    border: 1px solid var(--mf-border);
    background: #fff;
    color: #333;
    font-size: .9rem;
    cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s;
    max-width: 240px;
    line-height: 1.2;
}

.empresa-switcher:hover,
.empresa-switcher:focus {
    background: #f8f9fa;
    border-color: var(--mf-primary);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.08);
    outline: none;
}

.empresa-switcher .empresa-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mf-primary), var(--mf-primary-dark));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    flex-shrink: 0;
}

.empresa-switcher .empresa-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    max-width: 160px;
}

.empresa-switcher .empresa-caret {
    color: var(--mf-muted);
    font-size: .7rem;
    margin-left: .15rem;
}

.empresa-list {
    min-width: 300px;
    max-width: 360px;
    max-height: 70vh;
    overflow-y: auto;
    padding: .35rem;
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.empresa-list .empresa-list-header {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--mf-muted);
    padding: .5rem .75rem .25rem;
    font-weight: 600;
}

.empresa-list .empresa-option {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background .12s;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: #333;
}

.empresa-list .empresa-option:hover {
    background: #eaf2ff;
}

.empresa-list .empresa-option.active {
    background: linear-gradient(135deg, var(--mf-primary), var(--mf-primary-dark));
    color: #fff;
}

.empresa-list .empresa-option.active .empresa-option-nit {
    color: rgba(255, 255, 255, 0.85);
}

.empresa-list .empresa-option-text {
    flex: 1;
    overflow: hidden;
}

.empresa-list .empresa-option-name {
    font-weight: 600;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empresa-list .empresa-option-nit {
    font-size: .75rem;
    color: var(--mf-muted);
}

.empresa-list .empresa-search {
    position: sticky;
    top: 0;
    background: #fff;
    padding: .5rem;
    border-bottom: 1px solid var(--mf-border);
    z-index: 1;
}

.empresa-list .empresa-search input {
    border-radius: 8px;
    height: 36px;
}

@media (max-width: 575.98px) {
    .empresa-switcher {
        max-width: 180px;
        padding: .35rem .6rem;
        font-size: .85rem;
    }

    .empresa-switcher .empresa-name {
        max-width: 110px;
    }

    .empresa-list {
        min-width: calc(100vw - 1rem);
        max-width: calc(100vw - 1rem);
    }
}
