/* =====================================================
   SISTEMA DE CRÉDITOS - ESTILOS
   ===================================================== */

:root {
    --sidebar-width: 250px;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #3b82f6;
    --topbar-height: 56px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f1f5f9;
    color: #334155;
    font-size: 14px;
}

/* ==================== LOGIN SCREEN ==================== */
.login-screen {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e293b 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 35px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
    color: var(--sidebar-bg);
}

.login-header h3 {
    margin: 10px 0 5px;
}

.login-header p {
    margin: 0;
    font-size: 0.9rem;
}

.login-form .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #475569;
}

.login-form .input-group-text {
    background: #f8fafc;
    border-right: none;
}

.login-form .input-group .form-control {
    border-left: none;
}

.login-form .btn-primary {
    padding: 10px;
    font-weight: 600;
}

.login-form .btn-success {
    padding: 10px;
    font-weight: 600;
}

/* ==================== SIDEBAR USER ==================== */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 0.85rem;
    color: #e2e8f0;
    flex-wrap: wrap;
}

.sidebar-user i {
    font-size: 1.1rem;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer .btn-outline-light {
    font-size: 0.8rem;
    border-color: rgba(255,255,255,0.2);
}

.sidebar-footer .btn-outline-light:hover {
    background: rgba(255,255,255,0.1);
}

/* ==================== TOPBAR USER INFO ==================== */
.topbar .badge {
    font-size: 0.75rem;
    font-weight: 500;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1000;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

@media (min-width: 992px) {
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h4 {
    margin: 0;
    color: #fff;
    font-size: 1.2rem;
}

.sidebar-nav {
    list-style: none;
    padding: 10px 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav li {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
}

.sidebar-nav li:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.sidebar-nav li.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
    font-weight: 600;
}

.sidebar-nav li i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: 0;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.content-section {
    display: none;
    padding: 20px;
}

.content-section.active {
    display: block;
}

/* ==================== STAT CARDS ==================== */
.stat-card {
    border-radius: 12px;
    padding: 20px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.3;
}

.stat-card .stat-info {
    display: flex;
    flex-direction: column;
}

.stat-card .stat-number {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-top: 2px;
}

/* ==================== CARDS ==================== */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    padding: 12px 16px;
}

/* ==================== TABLES ==================== */
.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    padding: 10px 12px;
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 12px;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background: #f0f9ff;
}

/* ==================== UPLOAD AREA ==================== */
.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8fafc;
}

.upload-area:hover, .upload-area.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #64748b;
}

.upload-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.upload-preview span {
    font-weight: 500;
    color: #334155;
}

/* ==================== SEARCH RESULTS ==================== */
.search-results {
    position: absolute;
    z-index: 1050;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    max-height: 250px;
    overflow-y: auto;
    width: calc(100% - 90px);
}

.search-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.search-item:hover {
    background: #f0f9ff;
}

.search-item:last-child {
    border-bottom: none;
}

/* ==================== SELECTED CLIENT ==================== */
.selected-client {
    animation: fadeIn 0.3s ease;
}

/* ==================== RESUMEN CUOTAS ==================== */
.resumen-cuotas {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 16px;
    animation: fadeIn 0.3s ease;
}

.resumen-cuotas h6 {
    color: #166534;
    margin-bottom: 10px;
}

/* ==================== BADGES ==================== */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
}

/* ==================== PROGRESS BAR ==================== */
.progress {
    border-radius: 8px;
    background: #e2e8f0;
}

.progress-bar {
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: width 0.6s ease;
}

/* ==================== BUTTONS ==================== */
.btn-group-sm .btn {
    padding: 4px 8px;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== TOAST ==================== */
.toast-container {
    z-index: 9999;
}

/* ==================== PAGINATION ==================== */
.pagination {
    margin: 0;
}

.page-link {
    color: #3b82f6;
    border-color: #e2e8f0;
}

.page-item.active .page-link {
    background: #3b82f6;
    border-color: #3b82f6;
}

/* ==================== MODAL ==================== */
.modal-header {
    border-bottom: 1px solid #e2e8f0;
}

.modal-content {
    border: none;
    border-radius: 12px;
}

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

/* Overlay para sidebar en móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1050;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show-mobile {
        transform: translateX(0) !important;
        z-index: 1100;
        box-shadow: 5px 0 25px rgba(0,0,0,0.3);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .content-section {
        padding: 12px;
    }

    /* Topbar compacto */
    .topbar {
        padding: 0 10px;
        gap: 5px;
    }

    .topbar h5 {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }

    #topbar-empresa {
        display: none;
    }

    /* Stat cards */
    .stat-card {
        padding: 12px 15px;
    }

    .stat-card .stat-icon {
        font-size: 1.8rem;
    }

    .stat-card .stat-number {
        font-size: 1.1rem;
    }

    .stat-card .stat-label {
        font-size: 0.7rem;
    }

    /* Sección créditos: filtros y botones */
    #section-creditos > .d-flex.justify-content-between {
        flex-direction: column;
        gap: 10px;
        align-items: stretch !important;
    }

    #section-creditos > .d-flex > .d-flex.gap-2 {
        flex-wrap: wrap;
        gap: 6px !important;
    }

    #creditos-tab-group {
        width: 100%;
    }

    #creditos-tab-group .btn {
        flex: 1;
    }

    #filtro-credito-estado {
        width: 100% !important;
    }

    #buscar-credito,
    #buscar-credito-terminado {
        width: 100% !important;
    }

    /* Sección clientes: filtros */
    #section-clientes > .d-flex.justify-content-between {
        flex-direction: column;
        gap: 10px;
        align-items: stretch !important;
    }

    #section-clientes > .d-flex > .d-flex.gap-2 {
        flex-wrap: wrap;
        gap: 6px !important;
    }

    #buscar-cliente {
        width: 100% !important;
    }

    #filtro-cliente-estado {
        width: 100% !important;
    }

    /* Tablas: font más pequeño en móvil */
    .table {
        font-size: 0.78rem;
    }

    .table thead th {
        font-size: 0.7rem;
        padding: 8px 6px;
        letter-spacing: 0;
    }

    .table tbody td {
        padding: 8px 6px;
    }

    .btn-group-sm .btn,
    .btn-sm {
        padding: 3px 6px;
        font-size: 0.75rem;
    }

    /* Modales fullscreen en móvil */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }

    .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    .modal-dialog.modal-xl {
        max-width: 100%;
    }

    /* Formulario nuevo crédito */
    #section-nuevo-credito .col-lg-8 {
        padding: 0;
    }

    /* Resumen cuotas en móvil */
    .resumen-cuotas .row .col-md-3 {
        text-align: center;
    }

    /* Search results posición */
    .search-results {
        width: 100% !important;
        left: 0;
    }

    /* Configuración */
    #section-configuracion .col-lg-8 {
        padding: 0;
    }

    /* Cards sin bordes redondeados en móvil para aprovechar espacio */
    .card {
        border-radius: 8px;
    }

    /* Paginación */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Upload area compacta */
    .upload-area {
        padding: 15px;
    }

    .upload-placeholder p {
        font-size: 0.85rem;
    }

    /* Sidebar footer en móvil */
    .sidebar-footer {
        padding: 12px 15px;
    }
}

@media (max-width: 576px) {
    /* Topbar extra compacto */
    .topbar {
        height: 48px;
        padding: 0 8px;
    }

    .topbar h5 {
        font-size: 0.9rem;
        max-width: 100px;
        margin-left: 8px !important;
    }

    .topbar .ms-auto {
        gap: 4px !important;
    }

    #topbar-user {
        font-size: 0.65rem;
        max-width: 70px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .content-section {
        padding: 8px;
    }

    /* Stat cards en 2 columnas */
    .stat-card {
        padding: 10px 12px;
    }

    .stat-card .stat-icon {
        font-size: 1.5rem;
    }

    .stat-card .stat-number {
        font-size: 1rem;
    }

    /* Dashboard subtítulos */
    .card-header {
        font-size: 0.8rem;
        padding: 10px 12px;
    }

    /* Tabla aún más compacta */
    .table {
        font-size: 0.72rem;
    }

    .table thead th {
        font-size: 0.65rem;
        padding: 6px 4px;
    }

    .table tbody td {
        padding: 6px 4px;
    }

    /* Botones de acción en tablas */
    .btn-group-sm .btn,
    .btn-sm {
        padding: 2px 5px;
        font-size: 0.7rem;
    }

    /* Login responsive */
    .login-card {
        padding: 25px 20px;
    }

    .login-header i {
        font-size: 2rem !important;
    }

    .login-header h3 {
        font-size: 1.2rem;
    }

    /* Modal body padding reducido */
    .modal-body {
        padding: 12px;
    }

    .modal-header {
        padding: 10px 12px;
    }

    .modal-footer {
        padding: 8px 12px;
    }

    /* Formularios más compactos */
    .form-label {
        font-size: 0.8rem;
        margin-bottom: 2px;
    }

    .form-control, .form-select {
        font-size: 0.85rem;
        padding: 6px 10px;
    }

    /* Badges */
    .badge {
        font-size: 0.65rem;
        padding: 3px 6px;
    }

    /* Sección usuarios: header */
    #section-usuarios > .d-flex.justify-content-between {
        flex-direction: column;
        gap: 8px;
        align-items: stretch !important;
    }

    /* Backup/restore botones */
    #section-configuracion .btn {
        width: 100%;
        margin-top: 5px;
    }
}

/* Asegurar tablas con scroll horizontal en todos los tamaños */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Fix para inputs con width fijo */
@media (max-width: 768px) {
    input[style*="width: 250px"],
    input[style*="width: 300px"] {
        width: 100% !important;
    }

    select[style*="width: auto"] {
        width: 100% !important;
    }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ==================== TEMA OSCURO ==================== */
[data-theme="dark"] body {
    background: #0f172a;
    color: #e2e8f0;
}

[data-theme="dark"] .login-card {
    background: #1e293b;
    color: #e2e8f0;
}

[data-theme="dark"] .login-header {
    color: #e2e8f0;
}

[data-theme="dark"] .login-form .form-label {
    color: #94a3b8;
}

[data-theme="dark"] .login-form .input-group-text {
    background: #334155;
    border-color: #475569;
    color: #94a3b8;
}

[data-theme="dark"] .login-form .form-control {
    background: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}

[data-theme="dark"] .topbar {
    background: #1e293b;
    border-bottom-color: #334155;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

[data-theme="dark"] .topbar h5 {
    color: #e2e8f0;
}

[data-theme="dark"] .card {
    background: #1e293b;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

[data-theme="dark"] .card-header {
    background: #1e293b;
    border-bottom-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .table {
    color: #e2e8f0;
}

[data-theme="dark"] .table thead th {
    background: #1e293b;
    border-bottom-color: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .table tbody td {
    border-color: #334155;
}

[data-theme="dark"] .table-hover tbody tr:hover {
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background: #0f172a;
    border-color: #3b82f6;
    color: #e2e8f0;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .form-control::placeholder {
    color: #64748b;
}

[data-theme="dark"] .input-group-text {
    background: #334155;
    border-color: #475569;
    color: #94a3b8;
}

[data-theme="dark"] .modal-content {
    background: #1e293b;
    color: #e2e8f0;
}

[data-theme="dark"] .modal-header {
    border-bottom-color: #334155;
}

[data-theme="dark"] .modal-footer {
    border-top-color: #334155;
}

[data-theme="dark"] .btn-close {
    filter: invert(1);
}

[data-theme="dark"] .alert-info {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #93c5fd;
}

[data-theme="dark"] .alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #fca5a5;
}

[data-theme="dark"] .alert-success {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    color: #86efac;
}

[data-theme="dark"] .upload-area {
    border-color: #475569;
    background: #0f172a;
}

[data-theme="dark"] .upload-area:hover,
[data-theme="dark"] .upload-area.drag-over {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .upload-placeholder {
    color: #94a3b8;
}

[data-theme="dark"] .search-results {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

[data-theme="dark"] .search-item {
    border-bottom-color: #334155;
}

[data-theme="dark"] .search-item:hover {
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .resumen-cuotas {
    background: rgba(34, 197, 94, 0.1);
    border-color: #22c55e;
}

[data-theme="dark"] .resumen-cuotas h6 {
    color: #86efac;
}

[data-theme="dark"] .progress {
    background: #334155;
}

[data-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

[data-theme="dark"] .page-link {
    background: #1e293b;
    border-color: #334155;
    color: #93c5fd;
}

[data-theme="dark"] .page-item.active .page-link {
    background: #3b82f6;
    border-color: #3b82f6;
}

[data-theme="dark"] .toast {
    background: #1e293b !important;
    color: #e2e8f0;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #0f172a;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #475569;
}

[data-theme="dark"] .selected-client {
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .btn-outline-secondary {
    border-color: #475569;
    color: #94a3b8;
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background: #334155;
    color: #e2e8f0;
}

/* Texto y elementos generales */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] label,
[data-theme="dark"] strong,
[data-theme="dark"] .modal-title,
[data-theme="dark"] .form-label {
    color: #e2e8f0;
}

[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] small,
[data-theme="dark"] li,
[data-theme="dark"] td,
[data-theme="dark"] th {
    color: inherit;
}

/* Bootstrap text utilities - mejor contraste */
[data-theme="dark"] .text-success {
    color: #4ade80 !important;
}

[data-theme="dark"] .text-danger {
    color: #f87171 !important;
}

[data-theme="dark"] .text-warning {
    color: #fbbf24 !important;
}

[data-theme="dark"] .text-info {
    color: #60a5fa !important;
}

[data-theme="dark"] .text-primary {
    color: #60a5fa !important;
}

[data-theme="dark"] .text-secondary {
    color: #94a3b8 !important;
}

[data-theme="dark"] .text-dark {
    color: #e2e8f0 !important;
}

/* Bootstrap bg utilities */
[data-theme="dark"] .bg-light {
    background-color: #334155 !important;
    color: #e2e8f0;
}

[data-theme="dark"] .bg-white {
    background-color: #1e293b !important;
    color: #e2e8f0;
}

/* Bordes */
[data-theme="dark"] .border {
    border-color: #475569 !important;
}

[data-theme="dark"] .border-bottom {
    border-bottom-color: #475569 !important;
}

/* Alert warning */
[data-theme="dark"] .alert-warning {
    background: rgba(251, 191, 36, 0.15);
    border-color: #f59e0b;
    color: #fcd34d;
}

/* Tablas con color de fila - forzar texto legible */
[data-theme="dark"] .table-warning,
[data-theme="dark"] .table-warning > td,
[data-theme="dark"] .table-warning > th {
    --bs-table-bg: rgba(251, 191, 36, 0.12);
    --bs-table-hover-bg: rgba(251, 191, 36, 0.18);
    --bs-table-color: #fde68a;
    color: #fde68a !important;
}

[data-theme="dark"] .table-danger,
[data-theme="dark"] .table-danger > td,
[data-theme="dark"] .table-danger > th {
    --bs-table-bg: rgba(239, 68, 68, 0.15);
    --bs-table-hover-bg: rgba(239, 68, 68, 0.2);
    --bs-table-color: #fca5a5;
    color: #fca5a5 !important;
}

[data-theme="dark"] .table-success,
[data-theme="dark"] .table-success > td,
[data-theme="dark"] .table-success > th {
    --bs-table-bg: rgba(34, 197, 94, 0.15);
    --bs-table-hover-bg: rgba(34, 197, 94, 0.2);
    --bs-table-color: #86efac;
    color: #86efac !important;
}

[data-theme="dark"] .table-info,
[data-theme="dark"] .table-info > td,
[data-theme="dark"] .table-info > th {
    --bs-table-bg: rgba(59, 130, 246, 0.12);
    --bs-table-hover-bg: rgba(59, 130, 246, 0.18);
    --bs-table-color: #93c5fd;
    color: #93c5fd !important;
}

/* Asegurar que TODAS las celdas en tablas oscuras sean legibles */
[data-theme="dark"] .table > :not(caption) > * > * {
    color: var(--bs-table-color, #e2e8f0);
    border-bottom-color: #334155;
}

[data-theme="dark"] .table > thead > tr > th {
    color: #94a3b8 !important;
    background: #1e293b !important;
}

/* Badge dentro de tabla */
[data-theme="dark"] .table .badge {
    color: inherit;
}

[data-theme="dark"] .table .badge.bg-success {
    color: #fff !important;
}

[data-theme="dark"] .table .badge.bg-danger {
    color: #fff !important;
}

[data-theme="dark"] .table .badge.bg-warning {
    color: #fff !important;
}

[data-theme="dark"] .table .badge.bg-info {
    color: #fff !important;
}

[data-theme="dark"] .table .badge.bg-primary {
    color: #fff !important;
}

[data-theme="dark"] .table .badge.bg-secondary {
    color: #e2e8f0 !important;
}

/* Badges con mejor contraste */
[data-theme="dark"] .badge.bg-secondary {
    background-color: #475569 !important;
    color: #e2e8f0;
}

[data-theme="dark"] .badge.bg-warning {
    background-color: #b45309 !important;
    color: #fef3c7 !important;
}

[data-theme="dark"] .badge.bg-light {
    background-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* Botones en dark */
[data-theme="dark"] .btn-outline-danger {
    color: #f87171;
    border-color: #f87171;
}

[data-theme="dark"] .btn-outline-danger:hover {
    background: rgba(248, 113, 113, 0.15);
    color: #fca5a5;
    border-color: #f87171;
}

[data-theme="dark"] .btn-outline-primary {
    color: #60a5fa;
    border-color: #60a5fa;
}

[data-theme="dark"] .btn-outline-primary:hover {
    background: rgba(96, 165, 250, 0.15);
    color: #93c5fd;
    border-color: #60a5fa;
}

[data-theme="dark"] .btn-outline-success {
    color: #4ade80;
    border-color: #4ade80;
}

[data-theme="dark"] .btn-outline-success:hover {
    background: rgba(74, 222, 128, 0.15);
    color: #86efac;
    border-color: #4ade80;
}

[data-theme="dark"] .btn-outline-warning {
    color: #fbbf24;
    border-color: #fbbf24;
}

[data-theme="dark"] .btn-outline-warning:hover {
    background: rgba(251, 191, 36, 0.15);
    color: #fde68a;
    border-color: #fbbf24;
}

/* Dropdown y select options */
[data-theme="dark"] .dropdown-menu {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .dropdown-item {
    color: #e2e8f0;
}

[data-theme="dark"] .dropdown-item:hover {
    background: #334155;
    color: #fff;
}

/* Links */
[data-theme="dark"] a {
    color: #60a5fa;
}

[data-theme="dark"] a:hover {
    color: #93c5fd;
}

/* HR / separadores */
[data-theme="dark"] hr {
    border-color: #334155;
    opacity: 0.5;
}

/* Selected client box */
.selected-client-box {
    background: #f8fafc;
}

[data-theme="dark"] .selected-client-box {
    background: #334155;
    border-color: #475569 !important;
}

/* ==================== PRINT ==================== */
@media print {
    .sidebar, .topbar, .btn, .pagination, .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
    .content-section {
        display: block !important;
    }
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
    .table {
        font-size: 11px !important;
    }
    .badge {
        border: 1px solid #999 !important;
    }
}

/* ==========================================
   NOTIFICACIONES DROPDOWN
   ========================================== */
.notif-dropdown {
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
}

.notif-item {
    cursor: pointer;
    transition: background 0.2s;
}

.notif-item:hover {
    background: #f0f9ff;
}

.notif-no-leida {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
}

.notif-no-leida:hover {
    background: #dbeafe;
}

#notif-count {
    font-size: 0.65rem;
    padding: 2px 5px;
    min-width: 18px;
}

[data-theme="dark"] .notif-item:hover {
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .notif-no-leida {
    background: rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .notif-no-leida:hover {
    background: rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .notif-dropdown {
    background: var(--card-bg);
    border-color: var(--border-color);
}
