/* =====================================================
   VISUAL IMPROVEMENTS - Modern Dashboard Styles
   ===================================================== */

/* ==================== Dashboard Cards Mejoradas ==================== */
/* ==================== Dashboard Cards Mejoradas ==================== */
.stat-card {
    background: white;
    border-radius: 24px !important;
    padding: 1.5rem;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: none !important;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}

/* Tarjeta Principal estila "Income" (Lila Suave) */
.stat-card.card-primary-soft {
    background: #E0E7FF !important;
}

.stat-card.card-primary-soft .card-icon {
    background: #C7D2FE !important;
    color: #312E81 !important;
}

.stat-card.card-primary-soft .stat-number {
    color: #1E1B4B !important;
}

.stat-card.card-primary-soft h3 {
    color: #4338CA !important;
}

/* Icon styles REMOVED - now in reference-override.css */
/* Prevents conflicts with centralized icon definitions */


.stat-card .card-content {
    flex: 1;
}

.stat-card .card-content h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6B7280;
    margin: 0 0 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #1F2937;
    margin: 0;
    line-height: 1;
}

/* Make icon text larger and bold */
.stat-card .card-icon {
    font-size: 3rem;
    font-weight: 700;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

/* ==================== Cards de Gráficos ==================== */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #F3F4F6;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid #F3F4F6;
}

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1F2937;
    margin: 0;
}

/* ==================== Grid Layouts ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== Sección Headers ==================== */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1F2937;
    margin: 0 0 1.5rem 0;
}

/* ==================== Botones Modernos ==================== */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #6C5DD3;
    color: white;
}

.btn-primary:hover {
    background: #5a4cb5;
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* ==================== Tables Modernas ==================== */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead {
    background: #F9FAFB;
}

thead th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-bottom: 1px solid #E5E7EB;
}

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: #F9FAFB;
}

tbody td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #F3F4F6;
    color: #1F2937;
}

/* ==================== Badges ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.badge-info {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
}

/* ==================== Inputs Modernos ==================== */
.input,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: white;
}

.input:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* File Input Sytling */
input[type="file"] {
    padding: 0.4rem;
    /* Ajuste para alinear con otros inputs */
}

input[type="file"]::file-selector-button {
    margin-right: 1rem;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    border: none;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    color: #4b5563;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

input[type="file"]::file-selector-button:hover {
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ==================== Modals Mejorados ==================== */
.modal-content {
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: none;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #F3F4F6;
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1F2937;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #F3F4F6;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ==================== Animaciones ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Animación escalonada para grids */
.stagger-1 {
    animation-delay: 0.05s;
}

.stagger-2 {
    animation-delay: 0.1s;
}

.stagger-3 {
    animation-delay: 0.15s;
}

.stagger-4 {
    animation-delay: 0.2s;
}

/* ==================== Skeleton Loading ==================== */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton-box {
    background: #f0f0f0;
    background-image: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    display: inline-block;
}

.skeleton-text {
    height: 1em;
    width: 80%;
    margin-bottom: 0.5em;
    background: #f0f0f0;
    background-image: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

/* Estado de carga específico para tarjetas */
.stat-card.loading .stat-number,
.stat-card.loading p {
    color: transparent !important;
    background: #f0f0f0;
    background-image: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    user-select: none;
}

.stat-card.loading .card-icon {
    opacity: 0.5;
    filter: grayscale(100%);
}

/* Overlay de carga para gráficos */
.chart-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 12px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    border-top-color: #6366f1;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== Scrollbar Personalizado ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #F3F4F6;
}

::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* ==================== Year Selector Widget (Overlay Strategy) ==================== */
.year-selector-container {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    width: auto;
    min-width: 80px;
}

/* Capa Visual: Lo que el usuario ve */
/* Capa Visual: Lo que el usuario ve */
.year-selector-visual {
    background: #FFFFFF;
    /* White background for premium look */
    border: 1px solid #E5E7EB;
    color: #374151;
    /* Gray 700 */
    padding: 0.5rem 2rem 0.5rem 1rem;
    border-radius: 8px;
    /* Rounded corners */
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    /* Soft shadow */
    user-select: none;
    min-width: 100px;
    /* Ensure consistent width */
    cursor: pointer;
}

/* Efecto Hover */
.year-selector-container:hover .year-selector-visual {
    background: #F9FAFB;
    /* Gray 50 */
    border-color: #6C5DD3;
    /* Primary Color Border */
    color: #6C5DD3;
    /* Primary Color Text */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.year-selector-container:active .year-selector-visual {
    transform: translateY(1px);
    box-shadow: none;
}

/* Capa Funcional: El select real transparente */
.year-selector-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    /* Invisible */
    cursor: pointer;
    z-index: 10;
    /* Encima de lo visual */
    appearance: none;
    /* Reset nativo */
    -webkit-appearance: none;
    border: none;
    padding: 0;
    margin: 0;
}

.year-selector-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 0.7rem;
    color: #6B7280;
    z-index: 5;
}

.btn-icon-small {
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    color: #4B5563;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    vertical-align: middle;
    margin-left: 5px;
}

.btn-icon-small:hover {
    background: #E5E7EB;
    /* Gray 200 */
    transform: scale(1.05);
    color: #1F2937;
}

/* SMART SUGGESTION STYLES */
.badge-smart-suggestion {
    display: inline-flex;
    align-items: center;
    background-color: #F5F3FF;
    /* Violet 50 */
    color: #6D28D9;
    /* Violet 700 */
    border: 1px solid #DDD6FE;
    /* Violet 200 */
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    margin-top: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.badge-smart-suggestion:hover {
    background-color: #EDE9FE;
    /* Violet 100 */
    border-color: #7C3AED;
    /* Violet 600 */
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.badge-smart-suggestion::before {
    content: "✨";
    margin-right: 4px;
}

.suggestion-confidence {
    font-size: 0.8em;
    opacity: 0.8;
    margin-left: 4px;
    padding-left: 4px;
    border-left: 1px solid rgba(109, 40, 217, 0.3);
}

.smart-matching-highlight {
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% {
        border-color: #DDD6FE;
    }

    50% {
        border-color: #7C3AED;
    }

    100% {
        border-color: #DDD6FE;
    }
}