@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --brand-blue: #0b2e82;
    --brand-teal: #2258b3;
    --brand-light: #f8fafc;
    --sidebar-width: 260px;
    --text-color: #334155;
}

body {
    background-color: var(--brand-light);
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    overflow-x: hidden;
}

/* Layout Wrapper */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background-color: var(--brand-blue);
    color: #fff;
    transition: all 0.3s;
    box-shadow: 4px 0 10px rgba(0,0,0,0.05);
    z-index: 1000;
}

.sidebar .sidebar-header {
    padding: 20px;
    background-color: #082161;
    text-align: center;
}

.sidebar .sidebar-header img {
    max-width: 80%;
    border-radius: 8px;
    margin-bottom: 10px;
}

.sidebar ul.components {
    padding: 20px 0;
}

.sidebar ul li a {
    padding: 12px 25px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    color: #cbd5e1;
    text-decoration: none;
    transition: 0.2s;
    font-weight: 500;
}

.sidebar ul li a:hover, .sidebar ul li.active > a {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--brand-teal);
}

.sidebar ul li a i {
    margin-right: 15px;
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    width: 100%;
    padding: 30px;
    transition: all 0.3s;
}

/* Header Topbar inside Main Content */
.topbar {
    background: #fff;
    padding: 15px 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-radius: 12px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Modificadores de UI Moderna */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03) !important;
    margin-bottom: 25px;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid #e2e8f0;
    padding: 15px 20px;
    font-weight: 600;
}

.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--brand-teal);
    border-color: var(--brand-teal);
}

.btn-primary:hover {
    background-color: #1a428a;
    border-color: #1a428a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 88, 179, 0.3);
}

.table {
    vertical-align: middle;
}
.table th {
    font-weight: 600;
    color: #475569;
    background-color: #f1f5f9;
    border-bottom-width: 1px;
}

.form-control, .form-select {
    border-radius: 8px;
    border-color: #cbd5e1;
    padding: 10px 15px;
}

.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 3px rgba(34, 88, 179, 0.15);
    border-color: var(--brand-teal);
}

/* Toast Container */
.toast-container {
    z-index: 9999;
}

/* Ocultar las alertas viejas (Las reemplazaremos por Toasts) */
.old-alert {
    display: none !important;
}

/* Buscador de tablas */
.search-wrapper {
    position: relative;
    max-width: 300px;
}
.search-wrapper i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}
.search-wrapper input {
    padding-left: 40px;
}

/* Responsiveness (Tablet/Mobile) */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        height: 100vh;
        left: -var(--sidebar-width);
        transition: all 0.3s ease;
    }
    .sidebar.active {
        left: 0;
    }
    .main-content {
        width: 100%;
        margin-left: 0;
    }
}

/* Toggle Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}
.sidebar-overlay.active {
    display: block;
}

/* Botón flotante inferior Sidebar */
.sidebar-bottom {
    position: absolute;
    bottom: 20px;
    width: 100%;
    padding: 0 20px;
}

/* Dark Mode */
body.dark-mode {
    background-color: #0f172a;
    color: #e2e8f0;
}
body.dark-mode .card, 
body.dark-mode .topbar,
body.dark-mode .modal-content {
    background-color: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
}
body.dark-mode .card-header {
    border-bottom: 1px solid #334155;
}
body.dark-mode h2, body.dark-mode h3, body.dark-mode h4, body.dark-mode h5, body.dark-mode h6 {
    color: #f8fafc !important;
}
body.dark-mode .table {
    color: #e2e8f0;
    border-color: #334155;
}
body.dark-mode .table th {
    background-color: #334155;
    color: #f8fafc;
    border-color: #475569;
}
body.dark-mode .table td {
    border-color: #334155;
}
body.dark-mode .table-striped>tbody>tr:nth-of-type(odd)>* {
    color: #e2e8f0;
}
body.dark-mode .form-control, body.dark-mode .form-select {
    background-color: #334155;
    border-color: #475569;
    color: #f8fafc;
}
body.dark-mode .form-control:focus, body.dark-mode .form-select:focus {
    background-color: #475569;
    color: #fff;
}
body.dark-mode .text-dark {
    color: #f8fafc !important;
}
body.dark-mode .bg-white {
    background-color: #1e293b !important;
}
body.dark-mode .bg-light {
    background-color: #1e293b !important;
}
body.dark-mode .table-hover>tbody>tr:hover>* {
    color: #fff;
    background-color: #475569;
}
@media print {
    .no-print, .sidebar, .topbar {
        display: none !important;
    }
    .d-print-block {
        display: block !important;
    }
    .wrapper {
        display: block;
    }
    .main-content {
        padding: 0;
        width: 100%;
    }
    body {
        background-color: #fff;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}

/* --- UI/UX Refinement (Fase 2) --- */
.text-financial {
    font-family: 'Courier New', Courier, monospace;
    text-align: right;
    letter-spacing: -0.5px;
}

/* Skeleton Loader */
.skeleton-loader {
    display: inline-block;
    height: 1em;
    width: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}
@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
body.dark-mode .skeleton-loader {
    background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
    background-size: 200% 100%;
}

/* Form Wizard Stepper */
.stepper-wrapper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}
.stepper-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}
.stepper-item::before {
    position: absolute;
    content: "";
    border-bottom: 2px solid #ccc;
    width: 100%;
    top: 20px;
    left: -50%;
    z-index: 2;
}
.stepper-item::after {
    position: absolute;
    content: "";
    border-bottom: 2px solid #ccc;
    width: 100%;
    top: 20px;
    left: 50%;
    z-index: 2;
}
.stepper-item .step-counter {
    position: relative;
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ccc;
    margin-bottom: 6px;
    color: white;
    font-weight: bold;
}
.stepper-item.active .step-counter {
    background: var(--brand-teal);
}
.stepper-item.completed .step-counter {
    background: #10b981;
}
.stepper-item:first-child::before {
    content: none;
}
.stepper-item:last-child::after {
    content: none;
}
.step-content {
    display: none;
    animation: fadeIn 0.3s;
}
.step-content.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
