:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --success-color: #4bb543;
    --danger-color: #ff3333;
    --warning-color: #f9c74f;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --light-gray: #e9ecef;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: var(--dark-color);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4361ee 0%, #3f37c9 100%);
    animation: gradientBG 15s ease infinite;
    background-size: 400% 400%;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-container .card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-container .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.login-container .card-body {
    padding: 2.5rem;
    text-align: center;
}

.login-container h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 700;
    font-size: 1.8rem;
}

.login-container h3 {
    color: var(--secondary-color);
    margin-bottom: 2rem;
    font-weight: 600;
    font-size: 1.5rem;
}

.login-container .spinner-border {
    width: 3rem;
    height: 3rem;
    margin: 1.5rem 0;
    color: var(--primary-color);
}

.login-container .text-muted {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    display: block;
}

/* Main Layout */
.sidebar {
    background: #fff;
    min-height: 100vh;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    width: 250px;
    z-index: 1000;
    overflow-y: auto;
    max-height: 100vh;
}

.main-content {
    margin-left: 250px;
    padding: 0;
    width: calc(100% - 250px);
    min-height: 100vh;
}

/* Navigation */
.nav-link {
    color: var(--gray-color);
    padding: 12px 20px;
    border-radius: 5px;
    margin: 5px 0;
    transition: all 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

.nav-link i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
    padding: 15px 20px;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Forms */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
}

/* Progress bars */
.progress {
    height: 8px;
    border-radius: 4px;
}

/* Responsive - Tablets */
@media (max-width: 991.98px) {
    .main-content {
        margin-left: 0;
        width: 100%;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    h4 {
        font-size: 1.1rem;
    }
    
    h5 {
        font-size: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

/* Utility Classes */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.rounded-lg {
    border-radius: 10px;
}

.shadow-sm {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===== CALENDARIO ESTILOS ===== */

/* Header del calendario */
.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    text-align: center;
}

.calendar-day-header {
    padding: 15px 8px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Grid del calendario */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    min-height: 500px;
}

.calendar-day {
    border: 1px solid #e9ecef;
    min-height: 80px;
    padding: 8px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #fff;
}

.calendar-day:hover {
    background-color: #f8f9fa;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.calendar-day.other-month {
    background-color: #f8f9fa;
    color: #adb5bd;
}

.calendar-day.today {
    background-color: rgba(67, 97, 238, 0.1);
    border-color: var(--primary-color);
    font-weight: bold;
}

.calendar-day.has-expenses {
    background-color: rgba(75, 181, 67, 0.05);
    border-left: 4px solid var(--success-color);
}

.calendar-day-number {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: var(--dark-color);
}

.calendar-day.other-month .calendar-day-number {
    color: #adb5bd;
}

.calendar-day.today .calendar-day-number {
    color: var(--primary-color);
}

/* Gastos en el calendario */
.calendar-expense {
    background-color: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.9;
}

.calendar-expense:hover {
    opacity: 1;
}

.calendar-expense-amount {
    font-weight: 600;
}

.calendar-total {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Modal de gastos del día */
.day-expense-item {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    background-color: #fff;
    transition: all 0.2s ease;
}

.day-expense-item:hover {
    background-color: #f8f9fa;
    border-color: var(--primary-color);
}

.day-expense-category {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
}

.day-expense-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.day-expense-description {
    color: var(--gray-color);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

/* Navegación de meses */
.month-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
}

.month-navigation .btn {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

#current-month {
    min-width: 160px;
    font-weight: 600;
    text-transform: capitalize;
}

/* Responsive para móvil - Calendario */
@media (max-width: 768px) {
    .calendar-header {
        font-size: 0.75rem;
    }
    
    .calendar-day-header {
        padding: 8px 2px;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 4px 2px;
    }
    
    .calendar-day-number {
        font-size: 0.75rem;
    }
    
    .calendar-expense {
        font-size: 0.6rem;
        padding: 1px 3px;
        margin-bottom: 1px;
    }
    
    .calendar-total {
        font-size: 0.6rem;
        bottom: 2px;
        right: 2px;
        padding: 1px 3px;
    }
    
    #current-month {
        min-width: 110px;
        font-size: 0.85rem;
    }
    
    .month-navigation .btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        padding: 0;
    }
}

@media (max-width: 480px) {
    .calendar-grid {
        min-height: 350px;
    }
    
    .calendar-day {
        min-height: 45px;
        padding: 2px 1px;
    }
    
    .calendar-day-number {
        font-size: 0.7rem;
    }
    
    .calendar-expense {
        display: none; /* Ocultar gastos individuales en pantallas muy pequeñas */
    }
    
    .calendar-total {
        position: static;
        display: block;
        text-align: center;
        margin-top: 2px;
        background-color: var(--primary-color);
        color: white;
        border-radius: 3px;
        font-size: 0.65rem;
        padding: 2px;
    }
    
    #current-month {
        min-width: 100px;
        font-size: 0.8rem;
    }
    
    .month-navigation .btn {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }
}

/* Animaciones del calendario */
.calendar-day {
    animation: fadeIn 0.3s ease-out forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.calendar-expense {
    animation: slideIn 0.2s ease-out forwards;
}

/* Estados de carga */
.calendar-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
}

/* Tooltip para gastos */
.calendar-expense[title] {
    position: relative;
}

.calendar-expense[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 1000;
    opacity: 1;
}

/* Mejoras visuales adicionales */
.calendar-day.weekend {
    background-color: #f8f9fa;
}

.calendar-day.weekend .calendar-day-number {
    color: var(--danger-color);
}

.calendar-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 6px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid;
}

.calendar-summary-item .category-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-summary-item .category-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.calendar-summary-item .category-amount {
    font-weight: 600;
    color: var(--primary-color);
}

/* ===== MOBILE MENU STYLES ===== */
.mobile-header {
    background: #fff;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
}

.mobile-menu-toggle {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: var(--light-color);
    transform: scale(1.05);
}

.mobile-menu-toggle i {
    transition: transform 0.3s ease;
}

.mobile-menu-toggle.active i {
    transform: rotate(90deg);
}

/* Sidebar Mobile Styles */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 1040;
        transition: left 0.3s ease;
        background: #fff;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1035;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
    
    .main-content {
        width: 100%;
        padding: 0;
    }
}

/* Mejorar responsive para botones y elementos generales */
@media (max-width: 576px) {
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        margin-bottom: 0.5rem;
        border-radius: 0.375rem !important;
    }
    
    .card-header {
        padding: 0.75rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    .card-header h6 {
        font-size: 0.9rem;
    }
    
    .card-body {
        padding: 1rem 0.75rem;
    }
    
    /* Hacer los modales más móviles */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-content {
        border-radius: 8px;
    }
    
    .modal-header {
        padding: 0.75rem 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 0.75rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
    }
    
    /* Botones en móvil */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .btn-lg {
        padding: 0.625rem 1.25rem;
        font-size: 1rem;
    }
    
    /* Formularios móviles */
    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }
    
    .form-control,
    .form-select {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }
}

/* ===== UTILITY CLASSES RESPONSIVE ===== */

/* Navbar responsive adjustments */
.navbar {
    padding: 0.75rem 1rem;
}

@media (max-width: 576px) {
    .navbar {
        padding: 0.5rem 0.75rem;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
}

/* Main content area responsive padding */
.main-content-area {
    padding-bottom: 2rem;
}

@media (max-width: 768px) {
    .main-content-area {
        padding-bottom: 1rem;
    }
}

/* Card responsive improvements */
@media (max-width: 576px) {
    .card {
        border-radius: 6px;
        margin-bottom: 1rem;
    }
}

/* Badge and pill responsive */
.badge {
    font-size: 0.75rem;
}

@media (max-width: 576px) {
    .badge {
        font-size: 0.7rem;
    }
}

/* Pagination responsive */
.pagination {
    flex-wrap: wrap;
}

@media (max-width: 576px) {
    .pagination .page-link {
        padding: 0.375rem 0.65rem;
        font-size: 0.85rem;
    }
}

/* Input groups responsive */
@media (max-width: 576px) {
    .input-group-text {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Utility spacing for mobile */
@media (max-width: 576px) {
    .gap-3 {
        gap: 0.75rem !important;
    }
    
    .gap-2 {
        gap: 0.5rem !important;
    }
}

/* Mobile header adjustments */
@media (max-width: 576px) {
    .mobile-header {
        padding: 0.625rem 0.75rem;
    }
    
    .mobile-header h5 {
        font-size: 1rem;
    }
}

/* Text size utilities for mobile */
@media (max-width: 576px) {
    .text-xs {
        font-size: 0.65rem;
    }
}
