a/* Style for disabled select */
select:disabled {
    background-color: #f3f4f6; /* gray-100 */
    cursor: not-allowed;
}

.dark select:disabled {
    background-color: #4b5563; /* gray-600 */
}

/* Ensure tooltips are visible in dark mode */
.chartjs-tooltip {
    background: rgba(0, 0, 0, 0.7) !important;
    color: white !important;
    border-radius: 4px !important;
    padding: 6px !important;
}

.dark .chartjs-tooltip {
    background: rgba(255, 255, 255, 0.8) !important;
    color: black !important;
}

/* Animation for notifications */
@keyframes slideIn {
    0% { transform: translateX(100%); opacity: 0; }
    10% { transform: translateX(0); opacity: 1; }
    90% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(100%); opacity: 0; }
}

.notification {
    animation: slideIn 4s ease-in-out forwards;
}

/* Custom scrollbar for better UX */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-track {
    background: #374151;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Transition effects for dark mode toggle */
.dark-mode-transition {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Styles for financial summary cards */
.summary-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.dark .summary-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* Styles for AI advisor section */
.ai-advisor-container {
    border-left: 4px solid #6366f1;
    transition: border-color 0.3s ease;
}

.dark .ai-advisor-container {
    border-left-color: #818cf8;
}

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

/* Forzar fondo gris en ambos modos */
body {
    background-color: #f3f4f6 !important; /* gray-100 para modo claro */
}

html.dark body {
    background-color: #374151 !important; /* gray-700 para modo oscuro (gris más claro) */
    color: #e5e7eb !important; /* gray-200 */
}

/* Asegurar que los contenedores también tengan el fondo correcto */
.container {
    background-color: #f3f4f6 !important; /* gray-100 para modo claro */
}

html.dark .container {
    background-color: #374151 !important; /* gray-700 para modo oscuro (gris más claro) */
}

/* Corregir el selector para el modo oscuro - usar html.dark en lugar de .dark */
html.dark select:disabled {
    background-color: #4b5563 !important; /* gray-600 */
}

html.dark .chartjs-tooltip {
    background: rgba(255, 255, 255, 0.8) !important;
    color: black !important;
}

html.dark ::-webkit-scrollbar-track {
    background: #374151 !important;
}

html.dark ::-webkit-scrollbar-thumb {
    background: #4b5563 !important;
}

html.dark ::-webkit-scrollbar-thumb:hover {
    background: #6b7280 !important;
}

html.dark .summary-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2) !important;
}

html.dark .ai-advisor-container {
    border-left-color: #818cf8 !important;
}

/* Asegurar que todos los paneles y tarjetas tengan el fondo correcto en modo oscuro */
html.dark .bg-white {
    background-color: #1f2937; /* gray-800 */
}

html.dark .text-gray-800 {
    color: #e5e7eb; /* gray-200 */
}

html.dark .text-gray-600 {
    color: #e5e7eb; /* gray-200 */
}

html.dark .border-gray-200 {
    border-color: #374151 !important; /* gray-700 */
}

/* Asegurar que los encabezados de sección sean visibles en modo oscuro */
html.dark h2,
html.dark h3,
html.dark h4 {
    color: #e5e7eb; /* gray-200 */
}

/* Asegurar que las tablas sean visibles en modo oscuro */
html.dark table,
html.dark th,
html.dark td {
    border-color: #374151 !important; /* gray-700 */
}

html.dark thead tr {
    background-color: #1f2937 !important; /* gray-800 */
    color: #e5e7eb !important; /* gray-200 */
}

html.dark tbody tr {
    background-color: #1f2937 !important; /* gray-800 */
    color: #e5e7eb !important; /* gray-200 */
}

/* Asegurar que los botones sean visibles en modo oscuro */
html.dark button {
    background-color: #374151; /* gray-700 */
    color: #e5e7eb; /* gray-200 */
    border-color: #4b5563; /* gray-600 */
}

/* Excepciones para botones específicos que deben mantener sus colores */
html.dark button#newTransactionBtn {
    background-color: rgba(16, 185, 129, 0.8) !important; /* verde semi-transparente */
    color: white !important;
    border-color: rgba(16, 185, 129, 0.6) !important;
}

html.dark button#settingsBtn,
html.dark button#darkModeToggleBtn {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
}

/* Style for collapse toggle buttons in dark mode */
html.dark .collapse-toggle {
    background-color: transparent !important;
    border-color: transparent !important;
}

/* Fix dropdown text color in dark mode */
html.dark #period-dropdown-options a {
    color: #e5e7eb !important; /* gray-200 */
}

html.dark #period-dropdown-options a:hover {
    background-color: #4b5563 !important; /* gray-600 */
}


/* Mejorar visibilidad del logo en ambos modos - VERSIÓN UNIFICADA */
img[src="finai_logo.png"] {
    height: 3.5rem !important; /* Tamaño estándar */
    width: auto !important;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
    border-radius: 4px;
    margin-right: 0.75rem !important;
}

html.dark img[src="finai_logo.png"] {
    filter: brightness(1.2) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}

/* Ajustar para móviles */
@media (max-width: 768px) {
    img[src="finai_logo.png"] {
        height: 3.4rem !important; /* Tamaño reducido para móviles */
        transform: scale(1.2);
    }
}

/* Estilo tipo banner para el encabezado */
header .flex.items-center {
    background: linear-gradient(135deg, #4338ca 0%, #3b82f6 100%);
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Eliminar cualquier fondo adicional en el contenedor del título */
header .flex.items-center > div.flex.items-center {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    flex-wrap: nowrap !important;
}

/* Ajustar colores del título para que se vea bien sobre el fondo del banner */
header .flex.items-center h1 {
    color: white !important;
}

header .flex.items-center h1 span {
    color: #34d399 !important; /* verde-400 */
}

header .flex.items-center p {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Mantener el estilo en modo oscuro */
html.dark header .flex.items-center {
    background: #1f2937 !important; /* gray-800 for a darker gray banner */
}

/* Estilos para los botones en el banner */
header .mt-4.md\:mt-0.flex.space-x-2 button {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

header .mt-4.md\:mt-0.flex.space-x-2 button:hover {
    background-color: rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* Iconos en los botones */
header .mt-4.md\:mt-0.flex.space-x-2 button i {
    color: white !important;
    font-size: 1rem !important;
    margin-right: 0.5rem !important;
}

/* Estilo específico para el botón de nuevo movimiento */
header button#newTransactionBtn {
    background-color: rgba(16, 185, 129, 0.8) !important; /* verde semi-transparente */
    border: 1px solid rgba(16, 185, 129, 0.6);
}

header button#newTransactionBtn:hover {
    background-color: rgba(16, 185, 129, 1) !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* Ajustes responsivos para los botones del banner */
@media (max-width: 768px) {
    header .mt-4.md\:mt-0.flex.space-x-2 button {
        padding: 0.5rem !important;
        font-size: 0.75rem !important;
        border-radius: 50% !important;
        min-width: 2.2rem !important;
        width: 2.2rem !important;
        height: 2.2rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        aspect-ratio: 1/1 !important;
    }

    header .mt-4.md\:mt-0.flex.space-x-2 {
        margin-top: 0.5rem !important;
    }

    header .mt-4.md\:mt-0.flex.space-x-2 {
        position: absolute !important;
        top: 0.5rem !important;
        right: 0.5rem !important;
        margin-top: 0 !important; /* Remove negative margin */
    }

    /* Hacer que los iconos sean más pequeños en móvil */
    header .mt-4.md\:mt-0.flex.space-x-2 button i {
        font-size: 0.85rem !important;
        margin-right: 0 !important;
    }

    /* Ajustar el espaciado entre botones */
    header .mt-4.md\:mt-0.flex.space-x-2 {
        gap: 0.5rem !important;
    }

    /* Hacer que el banner se adapte mejor */
    header .flex.items-center {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 0.75rem !important;
    }

    /* Asegurar que los botones ocupen el ancho completo */
    header .mt-4.md\:mt-0.flex.space-x-2 {
        width: 100% !important;
        justify-content: flex-end !important;
    }

    /* Ocultar texto en botones y mostrar solo iconos */
    header .mt-4.md\:mt-0.flex.space-x-2 button span {
        display: none !important;
    }

    /* --- Reglas específicas para móvil (movidas aquí) --- */

    /* Mantener el color del banner de modo claro en modo oscuro para móviles */
    html.dark header .flex.items-center {
        background: linear-gradient(135deg, #4338ca 0%, #3b82f6 100%) !important;
    }

    /* Ocultar botón "Nuevo Movimiento" en móvil */
    header button#newTransactionBtn {
        display: none !important;
    }

    /* Posicionar el icono de configuración en la esquina superior derecha en modo móvil */
    header .mobile-settings-icon {
        position: absolute !important;
        top: 0.01rem !important; /* Ajustado para mover ligeramente hacia arriba */
        right: 0.5rem !important;
        z-index: 10 !important;
    }

    /* Contenedor relativo para el posicionamiento absoluto del icono móvil */
    header .flex.items-center {
        position: relative !important;
    }
    /* Hacer el modal de transacción ocupar toda la pantalla en móvil */
    /* Temporarily commented out for debugging mobile modal visibility */
    /*
    #transactionModal {
        align-items: flex-start !important;
    }

    #transactionModal > div {
        width: 100% !important;
        max-width: none !important;
        height: 100vh !important;
        max-height: none !important;
        overflow-y: auto !important;
        padding: 2rem !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
    */

    #transactionForm > :not([hidden]) ~ :not([hidden]) {
        margin-top: 0.75rem !important; /* Reducir espacio entre elementos del form (era space-y-4) */
    }
    /* --- Fin de reglas específicas para móvil --- */

    .mobile-transaction-list {
        max-height: 300px; /* Adjust as needed for mobile */
        overflow-y: auto;
    }

    /* Ensure mobile transaction list and individual cards are completely hidden when the section is collapsed */
    #transactionHistoryContent.hidden .mobile-transaction-list {
        display: none !important;
        max-height: 0 !important;
        overflow: hidden !important;
        /* Also remove any potential gap/space from the list container */
        gap: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    #transactionHistoryContent.hidden .mobile-transaction-list .mobile-transaction-card {
        display: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Ensure the collapse-content is completely hidden when the parent section is collapsed on mobile */
    @media (max-width: 768px) {
        .transaction-history-container .collapse-content.hidden {
            display: none !important;
        }

        /* Remove padding from the transaction history container when collapsed on mobile */
        .transaction-history-container:has(.collapse-content.hidden) {
            padding-top: 1.5rem !important; /* Restore top padding */
            padding-bottom: 1.5rem !important; /* Restore bottom padding */
            padding-left: 1.5rem !important; /* Keep horizontal padding if needed, adjust as per design */
            padding-right: 1.5rem !important; /* Keep horizontal padding if needed, adjust as per design */
        }
    }

    /* Ensure date input text is visible in dark mode on mobile */
    html.dark input[type="date"] {
        color: #e5e7eb !important; /* gray-200 */
    }
}

/* Contenedor relativo GLOBAL para el header (necesario para el icono móvil absoluto) */
header .flex.items-center {
    position: relative !important;
}




#aiAdvisorContent {
    background-color: rgba(75, 192, 192, 0.2) !important; /* Verde transparente para modo claro */
}

html.dark #aiAdvisorContent {
    background-color: rgba(27, 94, 32, 0.2) !important; /* Verde oscuro transparente para modo oscuro */
}

/* Estilos para el formato Markdown en el contenedor de IA */
#aiAdvisorContent strong,
#aiAdvisorContent b {
    font-weight: 700 !important;
    color: inherit !important;
}

#aiAdvisorContent em,
#aiAdvisorContent i {
    font-style: italic !important;
    color: inherit !important;
}

#aiAdvisorContent ul {
    list-style-type: disc !important;
    padding-left: 1.5rem !important;
    margin: 0.5rem 0 !important;
}

#aiAdvisorContent ol {
    list-style-type: decimal !important;
    padding-left: 1.5rem !important;
    margin: 0.5rem 0 !important;
}
#aiAdvisorContent li {
    margin-bottom: 0.25rem !important;
}

#aiAdvisorContent p {
    margin-bottom: 0.75rem !important;
}

#aiAdvisorContent h1,
#aiAdvisorContent h2,
#aiAdvisorContent h3,
#aiAdvisorContent h4 {
    font-weight: 600 !important;
    margin-top: 1rem !important;
    margin-bottom: 0.5rem !important;
    color: inherit !important;
}

/* Asegurar que los estilos Markdown también funcionen en modo oscuro */
html.dark #aiAdvisorContent strong,
html.dark #aiAdvisorContent b,
html.dark #aiAdvisorContent em,
html.dark #aiAdvisorContent i,
html.dark #aiAdvisorContent h1,
html.dark #aiAdvisorContent h2,
html.dark #aiAdvisorContent h3,
html.dark #aiAdvisorContent h4 {
    color: #ffffff !important;
}

/* Mejorar visibilidad en modales para modo oscuro */
html.dark #transactionModal .text-gray-700,
html.dark #transactionModal label,
html.dark #transactionModal input,
html.dark #transactionModal select,
html.dark #transactionModal textarea {
    color: #e5e7eb !important; /* gray-200 para mejor legibilidad */
}

html.dark #transactionModal input,
html.dark #transactionModal select,
html.dark #transactionModal textarea {
    background-color: #374151 !important; /* gray-700 */
    border-color: #4b5563 !important; /* gray-600 */
}

html.dark #transactionModal input::placeholder,
html.dark #transactionModal textarea::placeholder {
    color: #9ca3af !important; /* gray-400 */
}

/* Asegurar que los textos de ayuda sean visibles */
html.dark #transactionModal .text-xs.text-gray-500 {
    color: #9ca3af !important; /* gray-400 */
}

/* Mejorar contraste para los botones en el modal */
html.dark #transactionModal button.bg-indigo-600 {
    background-color: #4f46e5 !important; /* indigo-600 */
    color: white !important;
}

html.dark #transactionModal button.bg-indigo-600:hover {
    background-color: #4338ca !important; /* indigo-700 */
}

html.dark #transactionModal button.bg-red-600 {
    background-color: #dc2626 !important; /* red-600 */
    color: white !important;
}

html.dark #transactionModal button.bg-red-600:hover {
    background-color: #b91c1c !important; /* red-700 */
}

html.dark #transactionModal button.bg-gray-200 {
    background-color: #4b5563 !important; /* gray-600 */
    color: #e5e7eb !important; /* gray-200 */
}

html.dark #transactionModal button.bg-gray-200:hover {
    background-color: #6b7280 !important; /* gray-500 */
}

/* Mejorar visibilidad en modal de configuración para modo oscuro */
html.dark #settingsModal .text-gray-700,
html.dark #settingsModal label,
html.dark #settingsModal input,
html.dark #settingsModal select,
html.dark #settingsModal textarea {
    color: #e5e7eb !important; /* gray-200 */
}

html.dark #settingsModal input,
html.dark #settingsModal select,
html.dark #settingsModal textarea {
    background-color: #374151 !important; /* gray-700 */
    border-color: #4b5563 !important; /* gray-600 */
}

html.dark #settingsModal input::placeholder,
html.dark #settingsModal textarea::placeholder {
    color: #9ca3af !important; /* gray-400 */
}

html.dark #settingsModal .text-xs.text-gray-500 {
    color: #9ca3af !important; /* gray-400 */
}

/* Add padding to the bottom of the main container on small screens
   to prevent overlap with the fixed bottom navigation */
@media (max-width: 640px) { /* Corresponds to sm:hidden in #mobileBottomNav */
    .container {
        /* Adjust height based on nav bar height + some extra space */
        padding-bottom: 60px !important; /* Reducido para barra más corta */
    }
}

html.dark #settingsModal button.bg-green-600 {
    background-color: #16a34a !important; /* green-600 */
    color: white !important;
}

html.dark #settingsModal button.bg-green-600:hover {
    background-color: #15803d !important; /* green-700 */
}

html.dark #settingsModal button.bg-gray-200 {
    background-color: #4b5563 !important; /* gray-600 */
    color: #e5e7eb !important; /* gray-200 */
}

html.dark #settingsModal button.bg-gray-200:hover {
    background-color: #6b7280 !important; /* gray-500 */
}

/* FAB styles removed as we are using a bottom navigation bar (#mobileBottomNav) */

/* Estilos para botones de navegación inferior en modo claro */
#mobileIncomeBtn,
#mobileExpenseBtn {
    background: linear-gradient(135deg, #4338ca 0%, #3b82f6 100%); /* Match light mode banner */
    color: white;
    border: none; /* Remove potential borders that might clash with gradient */
}

/* Ajustar color de hover en modo claro */
#mobileIncomeBtn:hover,
#mobileExpenseBtn:hover {
    background: linear-gradient(135deg, #3730a3 0%, #2563eb 100%); /* Darker gradient for hover */
}

/* Estilos para modo oscuro */
html.dark #mobileIncomeBtn,
html.dark #mobileExpenseBtn {
    background: linear-gradient(135deg, #4338ca 0%, #3b82f6 100%); /* Same as light mode banner */
    color: white !important;
    border: none; /* Same as light mode */
}

html.dark #mobileIncomeBtn:hover,
html.dark #mobileExpenseBtn:hover {
    background: linear-gradient(135deg, #3730a3 0%, #2563eb 100%); /* Same as light mode hover */
    border: none; /* Same as light mode hover */
}

/* Asegurar que los iconos (imágenes) no se vean afectados por el color del texto */
#mobileIncomeBtn img,
#mobileExpenseBtn img {
    /* No se necesita estilo de color aquí, pero podríamos añadir filtros si fuera necesario */
}

/* Ensure date and pagination text is visible in dark mode */
html.dark .mobile-transaction-card .text-gray-700 {
    color: #ffffff !important; /* White for visibility */
}

html.dark .pagination-container span {
    color: #ffffff !important; /* White for visibility */
}

/* Ensure transaction type filter text is visible in dark mode */
html.dark #transactionTypeFilter {
    color: #ffffff !important; /* White for visibility */
}

/* Ensure section title icons are green in dark mode */
html.dark h2 i {
    color: #34d399 !important; /* verde-400 */
}

/* --- Estilos para el botón de IA en la barra de navegación inferior --- */

/* Icono (cerebro) - Verde */
#mobileBottomNav #mobileAiBtn i {
    color: #34d399; /* verde-400 */
    transition: color 0.2s ease-in-out;
}
html.dark #mobileBottomNav #mobileAiBtn i {
    color: #34d399 !important;
}
#mobileBottomNav #mobileAiBtn:hover i {
    color: #10b981; /* verde-500 */
}
html.dark #mobileBottomNav #mobileAiBtn:hover i {
    color: #6ee7b7 !important; /* verde-300 */
}

/* Texto (Resumen IA) - Azul */
#mobileBottomNav #mobileAiBtn span {
    color: #3b82f6; /* azul-500 */
    transition: color 0.2s ease-in-out;
}
html.dark #mobileBottomNav #mobileAiBtn span {
    color: #60a5fa !important; /* azul-400 */
}
#mobileBottomNav #mobileAiBtn:hover span {
    color: #2563eb; /* azul-600 */
}
html.dark #mobileBottomNav #mobileAiBtn:hover span {
    color: #93c5fd !important; /* azul-300 */
}


/* ======================================== */
/* Dark Mode Fixes for Budget Section       */
/* ======================================== */

/* Force dark background on the main budget container and inner content box */
html.dark #budgetSectionContent,
html.dark div.lg\:col-span-3 > div.bg-white[class*="dark:bg-gray-800"] /* More specific selector for the outer box */ {
    background-color: #1f2937 !important; /* gray-800 */
    color: #e5e7eb !important; /* gray-200 */
}

/* Force dark background on the "Crear Nuevo Presupuesto" box */
html.dark #budgetSectionContent > div.bg-white[class*="dark:bg-gray-800"] {
    background-color: #374151 !important; /* gray-700 */
    border: 1px solid #4b5563; /* gray-600 */
}

/* Ensure text within the budget section is light */
html.dark #budgetSectionContent p,
html.dark #budgetSectionContent h4 {
    color: #e5e7eb !important; /* gray-200 */
}

/* Style the "Añadir Presupuesto" button for dark mode */
html.dark #addBudgetBtn {
    background-color: #16a34a !important; /* green-600 */
    color: white !important;
    border: 1px solid #15803d !important; /* green-700 */
}

html.dark #addBudgetBtn:hover {
    background-color: #15803d !important; /* green-700 */
}

/* Style dynamically added budget list items */
html.dark #budgetList > div { /* Assuming each item is a direct child div */
    background-color: #374151 !important; /* gray-700 */
    border: 1px solid #4b5563 !important; /* gray-600 */
    color: #e5e7eb !important; /* gray-200 */
    padding: 0.75rem !important; /* Add some padding */
    border-radius: 0.375rem !important; /* Add rounded corners */
}

/* Ensure text inside budget list items is light */
html.dark #budgetList > div * { /* Target all descendants */
    color: #e5e7eb !important; /* gray-200 */
}

/* Style the progress bar text (Exceso/Restante) */
html.dark #budgetList .text-red-600 { /* Assuming 'Exceso' uses text-red-600 */
    color: #f87171 !important; /* red-400 */
}

html.dark #budgetList .text-green-600 { /* Assuming 'Restante' uses text-green-600 */
    color: #34d399 !important; /* green-400 */
}

/* Style the progress bar background */
html.dark #budgetList .bg-gray-200 { /* Assuming this class for the bar background */
    background-color: #4b5563 !important; /* gray-600 */
}

/* Style the progress bar fill */
html.dark #budgetList .bg-green-500 { /* Assuming this class for the green fill */
    background-color: #10b981 !important; /* green-500 */
}
html.dark #budgetList .bg-red-500 { /* Assuming this class for the red fill (over budget) */
    background-color: #ef4444 !important; /* red-500 */
}

/* Style the delete button within budget items */
html.dark #budgetList button { /* General style for buttons inside items */
     background-color: #4b5563 !important; /* gray-600 */
     color: #e5e7eb !important; /* gray-200 */
     border: 1px solid #6b7280 !important; /* gray-500 */
}
html.dark #budgetList button:hover {
     background-color: #6b7280 !important; /* gray-500 */
}
/* Assuming delete button has a specific class or icon, e.g., .delete-budget-btn or uses fas fa-trash */
html.dark #budgetList button i.fa-trash {
    color: #fca5a5 !important; /* red-300 */
}
html.dark #budgetList button:hover i.fa-trash {
    color: #f87171 !important; /* red-400 */
}

/* ================================================ */
/* Dark Mode Fixes for Category Management (Modal)  */
/* ================================================ */

/* Ensure heading and labels are light */
html.dark #categoryManagementSection h4,
html.dark #categoryManagementSection label {
    color: #e5e7eb !important; /* gray-200 */
}

/* Ensure input and select have light text and dark background/border */
/* (These might be covered by general modal rules but reinforcing) */
html.dark #newCategoryType,
html.dark #newCategoryName {
    color: #e5e7eb !important; /* gray-200 */
    background-color: #374151 !important; /* gray-700 */
    border-color: #4b5563 !important; /* gray-600 */
}
html.dark #newCategoryName::placeholder {
     color: #9ca3af !important; /* gray-400 */
}

/* Style the "Añadir" category button for dark mode */
html.dark #addCategoryBtn {
    background-color: #4f46e5 !important; /* indigo-600 */
    color: white !important;
    border-color: #4338ca !important; /* indigo-700 */
}
html.dark #addCategoryBtn:hover {
    background-color: #4338ca !important; /* indigo-700 */
}

/* Ensure text in dynamically added category list items is light */
html.dark #categoryListContainer * {
    color: #e5e7eb !important; /* gray-200 */
}

/* Style any buttons (e.g., delete) within the category list */
html.dark #categoryListContainer button {
    background-color: #4b5563 !important; /* gray-600 */
    color: #e5e7eb !important; /* gray-200 */
    border: 1px solid #6b7280 !important; /* gray-500 */
    padding: 0.25rem 0.5rem !important; /* Adjust padding if needed */
    font-size: 0.875rem !important; /* Adjust font size if needed */
}
html.dark #categoryListContainer button:hover {
    background-color: #6b7280 !important; /* gray-500 */
}
/* Example: Styling a delete icon within the button */
html.dark #categoryListContainer button i.fa-trash {
    color: #fca5a5 !important; /* red-300 */
}
html.dark #categoryListContainer button:hover i.fa-trash {
    color: #f87171 !important; /* red-400 */
}

/* Ensure budget category select and amount input text is visible in dark mode */
html.dark #budgetItemCategory,
html.dark #budgetItemAmount {
    color: #e5e7eb !important; /* Use light gray (gray-200) and !important for specificity */
}

/* Ensure placeholder text is also visible in dark mode */
html.dark #budgetItemAmount::placeholder {
    color: #9ca3af !important; /* Lighter gray for placeholder (gray-400) */
}

/* Ensure date filter labels ("Desde:", "Hasta:") are visible in dark mode */
html.dark label[for="startDateFilter"],
html.dark label[for="endDateFilter"] {
    color: #e5e7eb !important; /* Use light gray (gray-200) for better visibility */
}


/* Ensure date input calendar icon and text are visible in dark mode */
html.dark input[type="date"] {
    color-scheme: dark; /* Hint to browser to use dark UI for internal elements */
    color: #e5e7eb !important; /* Reiterate light text color just in case */
}

/* ======================================== */
/* Modern AI Advisor Section Styles         */
/* ======================================== */

.ai-section-container {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%); /* Gradiente azul oscuro a azul brillante */
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5); /* Sombra brillante azul */
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

/* Color verde para el icono del cerebro en el título de la sección IA */
.ai-section-container h2 i {
    color: #34d399; /* verde-400 */
}

html.dark .ai-section-container {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%); /* Gradiente gris oscuro */
    box-shadow: 0 0 25px rgba(129, 140, 248, 0.3); /* Sombra brillante índigo sutil */
}

.ai-generate-button {
    background: linear-gradient(90deg, #4f46e5, #818cf8);
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px; /* pastilla */
    border: none;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.ai-generate-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

.ai-generate-button:disabled {
    background: #6b7280;
    box-shadow: none;
    cursor: not-allowed;
    transform: translateY(0);
}

.ai-content-box {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    padding: 1rem;
    min-height: 200px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e5e7eb; /* gris-200 - Color de texto claro por defecto */
}

.ai-content-box p, 
.ai-content-box strong,
.ai-content-box ul,
.ai-content-box li {
    color: #e5e7eb !important; /* Asegurar que todo el texto sea claro */
}

/* Estilos para los gráficos dentro de la sección de IA */
.ai-content-box #balanceChartContainer,
.ai-content-box #aiChartContainer {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 0.5rem;
}

/* Estilos para el dropdown de categorías en móvil */
@media (max-width: 640px) {
    .category-dropdown-mobile-fullscreen {
        position: fixed !important;
        top: auto !important; /* Cambiado de 0 a auto */
        bottom: 0 !important; /* Anclado a la parte inferior */
        left: 0 !important;
        width: 100vw !important;
        height: 70vh !important; /* Ocupa el 70% de la altura */
        max-height: 70vh !important;
        margin-top: 0 !important;
        border-radius: 0 !important;
        z-index: 100 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .category-dropdown-mobile-fullscreen #category-list {
        flex-grow: 1;
        overflow-y: auto;
    }
}
