/**
 * KFinanzas - Estilos principales
 */

/* Variables CSS */
:root {
    --kf-primary: #FFCD00; /* Caterpillar Yellow */
    --kf-primary-rgb: 255, 205, 0;
    --kf-secondary: #6c757d;
    --kf-success: #198754;
    --kf-danger: #dc3545;
    --kf-warning: #ffc107;
    --kf-info: #0dcaf0;
    --kf-modern-violet: #8b5cf6; /* Modern vibrant violet */
    --kf-sidebar-width: 280px;


    --kf-navbar-height: 70px;
    --kf-card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.04), 0 4px 12px -3px rgba(0, 0, 0, 0.02);
    --kf-glass-bg: rgba(255, 255, 255, 0.8);
    --kf-glass-border: rgba(255, 255, 255, 0.4);
}

/* Reset y mejoras generales */

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Tahoma', 'Verdana', sans-serif;
    background-color: #f4f7fa;
    color: #2d3748;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, .navbar-brand, .sidebar-brand {
    font-family: 'Tahoma', 'Verdana', sans-serif;
}



/* Overrides para el tema Caterpillar */
.btn-primary {
    color: #212529 !important;
    font-weight: 600;
}

.btn-primary:hover {
    color: #000 !important;
}

/* Layout principal */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--kf-sidebar-width);
    background: linear-gradient(180deg, #1a1a1a 0%, #000000 100%);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1050;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}


.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.btn-close-sidebar {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.25rem;
    padding: 1rem;
    margin-right: 0.5rem;
}

.btn-close-sidebar:hover {
    color: #fff;
}

.sidebar-user-avatar i {
    font-size: 1.5rem;
    color: var(--kf-modern-violet);
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--kf-modern-violet);
}



.sidebar-user-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
}

.sidebar-user-logout {
    color: #FFCD00;
    transition: color 0.2s;
}

.sidebar-user-logout:hover {
    color: #fff;
}

.sidebar-brand span {
    color: #fff;
    margin: 0;
    font-weight: 600;
    font-size: 1.25rem;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.7) !important;
    padding: 0.85rem 1.5rem;
    margin: 0.2rem 1rem;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    border-radius: 12px;
    font-weight: 500;
}

.sidebar-nav .nav-link:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.sidebar-nav .nav-link.active {
    color: #000 !important;
    background-color: var(--kf-primary);
    box-shadow: 0 4px 15px rgba(255, 205, 0, 0.3);
}

.sidebar-nav .nav-link.active i {
    color: #000 !important;
}



.sidebar-nav .nav-link i {
    width: 24px;
    margin-right: 1rem;
    font-size: 1.25rem;
    color: var(--kf-modern-violet) !important;
}




.nav-section-title {
    color: #ffffff !important; /* Títulos de sección en blanco */
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1.5rem 1.5rem 0.5rem;
    display: block;
    font-weight: 700;
}

/* Contenido principal */
.main-content {
    flex: 1;
    margin-left: var(--kf-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar-main {
    background-color: var(--kf-glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--kf-glass-border);
    height: var(--kf-navbar-height);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}


.navbar-main .navbar-toggler {
    border: none;
    padding: 0.5rem;
}

.navbar-main .navbar-toggler:focus {
    box-shadow: none;
}

/* Contenido de la página */
.page-content {
    flex: 1;
    padding: 1.5rem;
}

/* Cards */
.card {
    border-radius: 1.25rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--kf-card-shadow);
    transition: all 0.3s ease;
    background-color: #fff;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
}

/* Stats cards */
.stats-card {
    border-left: 5px solid;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stats-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08) !important;
}


.stats-card.primary {
    border-left-color: var(--kf-primary);
}

.stats-card.success {
    border-left-color: var(--kf-success);
}

.stats-card.danger {
    border-left-color: var(--kf-danger);
}

.stats-card.warning {
    border-left-color: var(--kf-warning);
}

/* Tablas */
.table {
    border-collapse: separate;
    border-spacing: 0 0.5rem;
    margin-top: -0.5rem;
}

.table th {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #a0aec0;
    border: none;
    padding: 1rem 1.5rem;
}

.table td {
    padding: 1.25rem 1.5rem;
    vertical-align: middle;
    background-color: #fff;
    border: none;
    border-top: 1px solid rgba(0,0,0,0.02);
}

.table tbody tr {
    transition: all 0.2s ease;
    border-radius: 12px;
}

.table tbody tr:hover {
    background-color: #f8fafc;
    transform: scale(1.005);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    z-index: 1;
    position: relative;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}


/* Formularios */
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--kf-primary);
    box-shadow: 0 0 0 4px rgba(255, 205, 0, 0.15);
    background-color: #fff;
}


/* Badges de tipo */
.badge-income {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--kf-success);
}

.category-icon-income {
    color: var(--kf-success) !important;
}

.category-icon-expense {
    color: var(--kf-danger) !important;
}

.category-icon-no-bg {
    background-color: transparent !important;
    padding: 0 !important;
}



.badge-expense {
    background-color: rgba(220, 53, 69, 0.15);
    color: var(--kf-danger);
}

/* Progress bars */
.progress {
    border-radius: 1rem;
    overflow: hidden;
}

.progress-bar {
    border-radius: 1rem;
}

/* Botones */
.btn {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--kf-primary) 0%, #e6b800 100%);
    color: #000 !important;
    border: none;
    box-shadow: 0 4px 12px rgba(255, 205, 0, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #e6b800 0%, #cca300 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 205, 0, 0.3);
}


/* Alertas */
.alert {
    border: none;
    border-radius: 0.75rem;
}

.alert-dismissible .btn-close {
    padding: 1rem;
}

/* Modales */
.modal-content {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Dropdown */
.dropdown-menu {
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.dropdown-item:hover {
    background-color: rgba(13, 110, 253, 0.08);
}

/* Paginación */
.pagination .page-link {
    border: none;
    margin: 0 0.125rem;
    border-radius: 0.375rem;
    color: var(--kf-secondary);
}

.pagination .page-item.active .page-link {
    background-color: var(--kf-primary);
    color: #fff;
}

.pagination .page-link:hover {
    background-color: rgba(13, 110, 253, 0.1);
    color: var(--kf-primary);
}

/* Empty state */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 767.98px) {
    .page-content {
        padding: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Utility classes */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Print styles */
@media print {

    .sidebar,
    .navbar-main,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}