:root {
    --fin-income: #22C55E;
    --fin-expense: #EF4444;
    --fin-goal: #06B6D4;
    --fin-budget: #EAB308;
    --card-bg-light: rgba(255, 255, 255, 0.03);
}

/* Bento Grid Layout */
.finanzas-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(150px, auto);
    gap: 1.5rem;
    margin-top: 2rem;
}

.fin-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    transition: var(--transition);
}

.fin-card:hover {
    transform: translateY(-5px);
    border-color: rgba(6, 182, 212, 0.3);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

/* Special Sizes */
.fin-tall { grid-row: span 2; }
.fin-wide { grid-column: span 2; }
.fin-large { grid-column: span 2; grid-row: span 2; }

/* Stats Mini Cards */
.fin-stat-mini {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.fin-stat-mini .icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.fin-stat-mini.income .icon { background: rgba(34, 197, 94, 0.1); color: var(--fin-income); }
.fin-stat-mini.expense .icon { background: rgba(239, 68, 68, 0.1); color: var(--fin-expense); }
.fin-stat-mini.balance .icon { background: rgba(6, 182, 212, 0.1); color: var(--secondary-color); }

.fin-stat-mini .value {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: 'Outfit';
    margin-bottom: 0.2rem;
}

.fin-stat-mini .label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Goals Widget (Students) */
.goals-container {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.goal-item {
    background: var(--card-bg-light);
    border-radius: 12px;
    padding: 1rem;
}

.goal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.goal-info h4 { margin: 0; font-size: 0.95rem; }
.goal-info span { font-size: 0.75rem; color: var(--text-muted); }

.goal-progress-wrapper {
    height: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.goal-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
}

.goal-amounts {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

/* Budget Widget (Parents) */
.budget-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.budget-item {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 1rem;
}

.budget-category-icon {
    width: 35px;
    height: 35px;
    background: rgba(234, 179, 8, 0.1);
    color: var(--fin-budget);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.budget-visual {
    flex-grow: 1;
}

.budget-visual .progress-bg {
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    margin-top: 5px;
}

.budget-visual .progress-fill {
    height: 100%;
    border-radius: 3px;
}

.budget-visual .progress-fill.warning { background: var(--fin-budget); }
.budget-visual .progress-fill.danger { background: var(--fin-expense); }
.budget-visual .progress-fill.safe { background: var(--fin-income); }

/* History Table */
.fin-history-table {
    width: 100%;
    border-collapse: collapse;
}

.fin-history-table th {
    text-align: left;
    padding: 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.fin-history-table td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

.history-cat {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
}

.amount-text { font-family: 'Outfit'; font-weight: 700; white-space: nowrap; }
.amount-text.income { color: #22C55E; }
.amount-text.expense { color: #EF4444; }

/* Table layout fix */
.fin-history-table {
    width: 100%;
    min-width: 500px;
    border-collapse: collapse;
}

.fin-history-table td:last-child {
    min-width: 120px;
}

/* Professional Reports */
.pro-report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.pro-stat-box {
    background: var(--card-bg-light);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.03);
}

.pro-stat-box h5 { margin: 0 0 0.5rem; color: var(--text-muted); font-size: 0.8rem; letter-spacing: 0.05rem; }
.pro-stat-box .v { font-family: 'Outfit'; font-size: 1.2rem; font-weight: 600; }

@media (max-width: 1150px) { /* Sincronizado con sidebar */
    .finanzas-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 1.2rem;
    }
}

@media (max-width: 992px) {
    .finanzas-grid { 
        grid-template-columns: 1fr; 
    }
    .fin-wide, .fin-large, .fin-tall { grid-column: span 1; grid-row: span 1; }
}

@media (max-width: 768px) {
    .fin-card {
        padding: 1.2rem;
    }
    .fin-card-header h3 { font-size: 1.1rem; }
    .history-table th, .history-table td { padding: 0.8rem 0.5rem; font-size: 0.8rem; }
}

/* Responsive Table Container */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: 12px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(11, 17, 32, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content.glass {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 450px;
    border-radius: 24px;
    padding: 2.2rem;
    transform: translateY(30px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.show .modal-content.glass {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.8rem;
}

.modal-header h3 {
    margin: 0;
    font-family: 'Outfit';
    font-size: 1.3rem;
    font-weight: 700;
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover { color: white; }

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.9rem 1.1rem;
    background: #1e293b; /* Fondo sólido oscuro para mejor renderizado de opciones en Windows */
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.form-group select option {
    background-color: #1e293b;
    color: white;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--secondary-color);
    background: #1e293b;
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.1);
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.05);
}
/* AI Forecast Card Styles */
.ai-forecast-card {
    background: linear-gradient(135deg, rgba(88, 28, 135, 0.15), rgba(30, 41, 59, 0.4)) !important;
    border: 1px solid rgba(168, 85, 247, 0.2) !important;
    position: relative;
    overflow: hidden;
}

.ai-forecast-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.ai-title {
    font-family: 'Outfit';
    font-size: 1.2rem;
    font-weight: 700;
    color: #C084FC;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-status-badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 50px;
    background: rgba(168, 85, 247, 0.1);
    color: #A855F7;
    border: 1px solid rgba(168, 85, 247, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ai-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: center;
}

.ai-prediction {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pred-item {
    display: flex;
    flex-direction: column;
}

.pred-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.pred-value {
    font-family: 'Outfit';
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
}

.ai-message-box {
    background: rgba(15, 23, 42, 0.5);
    padding: 1.2rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-message-box p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #E2E8F0;
}

/* AI Status Colors */
.ai-status-safe { color: #22C55E !important; }
.ai-status-warning { color: #EAB308 !important; }
.ai-status-danger { color: #EF4444 !important; }

@media (max-width: 600px) {
    .ai-content {
        grid-template-columns: 1fr;
    }
}
