/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
}

/* Variables CSS para colores */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --light-bg: #f8fafc;
    --white: #ffffff;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.3s ease;
}

/* Header y Navegación */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-color);
    font-weight: bold;
}

.logo i {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.75rem;
    margin: 0;
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--gray-600);
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--primary-color);
    color: var(--white);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
    font-weight: 500;
}

.user-profile i {
    font-size: 1.5rem;
}

/* Layout principal */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

/* Dashboard Header */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h2 {
    font-size: 2rem;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.date {
    color: var(--gray-500);
    font-size: 1.1rem;
}

/* Tarjetas de resumen */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.card-header h3 {
    font-size: 1rem;
    color: var(--gray-600);
    font-weight: 500;
}

.card-header i {
    font-size: 1.5rem;
}

.balance-card .card-header i { color: var(--primary-color); }
.income-card .card-header i { color: var(--success-color); }
.expense-card .card-header i { color: var(--danger-color); }
.savings-card .card-header i { color: var(--warning-color); }

.card-value {
    margin-bottom: 1rem;
}

.amount {
    font-size: 2rem;
    font-weight: bold;
    color: var(--gray-800);
}

.card-change {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.card-change.positive {
    color: var(--success-color);
}

.card-change.negative {
    color: var(--danger-color);
}

/* Gráficos */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.chart-container {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.chart-container h3 {
    margin-bottom: 1rem;
    color: var(--gray-700);
    font-size: 1.25rem;
}

.chart-container canvas {
    max-height: 300px;
}

/* Sección de transacciones recientes */
.recent-transactions {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

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

.section-header h2,
.section-header h3 {
    color: var(--gray-800);
}

.recent-transactions .section-header {
    padding: 1.5rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--gray-200);
}

.transactions-list {
    max-height: 400px;
    overflow-y: auto;
}

/* Transacciones */
.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

.transaction-item:hover {
    background-color: var(--gray-50);
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.2rem;
}

.transaction-icon.income {
    background-color: var(--success-color);
}

.transaction-icon.expense {
    background-color: var(--danger-color);
}

.transaction-details h4 {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.transaction-details span {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.transaction-amount {
    font-weight: bold;
    font-size: 1.1rem;
}

.transaction-amount.income {
    color: var(--success-color);
}

.transaction-amount.expense {
    color: var(--danger-color);
}

/* Filtros */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filters select,
.filters input {
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    background: var(--white);
    font-size: 1rem;
    min-width: 200px;
}

.filters select:focus,
.filters input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Tabla de transacciones */
.transactions-table {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.transactions-table table {
    width: 100%;
    border-collapse: collapse;
}

.transactions-table th {
    background: var(--gray-50);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
}

.transactions-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.transactions-table tr:hover {
    background-color: var(--gray-50);
}

/* Presupuesto */
.budget-overview {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    margin-bottom: 2rem;
}

.budget-progress h3 {
    margin-bottom: 1rem;
    color: var(--gray-800);
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--gray-200);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--primary-color));
    border-radius: 6px;
    transition: var(--transition);
}

.budget-stats {
    display: flex;
    justify-content: space-between;
    color: var(--gray-600);
}

.budget-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.budget-category {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.budget-category h4 {
    margin-bottom: 1rem;
    color: var(--gray-800);
}

.budget-category .progress-bar {
    margin-bottom: 0.5rem;
}

.budget-category .budget-stats {
    font-size: 0.875rem;
}

/* Metas */
.goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.goal-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.goal-card h3 {
    margin-bottom: 1rem;
    color: var(--gray-800);
}

.goal-progress {
    margin-bottom: 1rem;
}

.goal-amount {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-weight: 600;
}

.goal-deadline {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Reportes */
.report-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.financial-insights {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.insights-list {
    display: grid;
    gap: 1rem;
}

.insight-item {
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.insight-item h4 {
    margin-bottom: 0.5rem;
    color: var(--gray-800);
}

.insight-item p {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* Botones */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn-success:hover {
    background: #059669;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    color: var(--gray-800);
}

.close {
    font-size: 2rem;
    cursor: pointer;
    color: var(--gray-400);
    transition: var(--transition);
}

.close:hover {
    color: var(--gray-600);
}

/* Formularios */
form {
    padding: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    background: var(--white);
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .main-content {
        padding: 1rem;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .filters {
        flex-direction: column;
    }

    .filters select,
    .filters input {
        min-width: 100%;
    }

    .transactions-table {
        overflow-x: auto;
    }

    .budget-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
}

@media (max-width: 480px) {
    .logo h1 {
        display: none;
    }

    .user-profile span {
        display: none;
    }

    .card {
        padding: 1rem;
    }

    .amount {
        font-size: 1.5rem;
    }

    .chart-container {
        padding: 1rem;
    }
}

/* Animaciones adicionales */
.card,
.chart-container,
.transaction-item {
    animation: slideUp 0.3s ease-out;
}

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

/* Ofertas bancarias */
.location-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.location-selector select {
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    background: var(--white);
}

.bank-filters {
    margin-bottom: 2rem;
}

.bank-filters h3 {
    margin-bottom: 1rem;
    color: var(--gray-700);
}

.bank-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.bank-filter-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    background: var(--white);
    color: var(--gray-600);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.bank-filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.bank-filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

.offers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.offer-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transition: var(--transition);
}

.offer-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.offer-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
}

.offer-bank {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.bank-logo {
    width: 40px;
    height: 40px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--primary-color);
}

.offer-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.offer-subtitle {
    opacity: 0.9;
    font-size: 0.875rem;
}

.offer-content {
    padding: 1.5rem;
}

.offer-highlight {
    background: var(--success-color);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
}

.offer-features {
    list-style: none;
    margin-bottom: 1.5rem;
}

.offer-features li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.offer-features li:last-child {
    border-bottom: none;
}

.offer-features i {
    color: var(--success-color);
    width: 16px;
}

.offer-actions {
    display: flex;
    gap: 1rem;
}

.btn-offer {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
}

.btn-offer-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-offer-primary:hover {
    background: var(--primary-dark);
}

.btn-offer-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-offer-secondary:hover {
    background: var(--gray-200);
}

.featured-offers {
    margin-top: 3rem;
}

.featured-offers h3 {
    margin-bottom: 1.5rem;
    color: var(--gray-800);
    font-size: 1.5rem;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.featured-offer {
    background: linear-gradient(135deg, var(--warning-color), #f97316);
    color: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    position: relative;
    overflow: hidden;
}

.featured-offer::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: rotate(45deg);
}

.featured-offer h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.featured-offer p {
    margin-bottom: 1rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.featured-offer .btn-offer {
    background: var(--white);
    color: var(--warning-color);
    position: relative;
    z-index: 1;
}

/* Configuración */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.settings-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.settings-header h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--gray-800);
    margin: 0;
}

.settings-header i {
    color: var(--primary-color);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.online {
    background: var(--success-color);
}

.status-dot.offline {
    background: var(--danger-color);
}

.settings-content {
    padding: 1.5rem;
}

.sync-log {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.sync-log h4 {
    margin-bottom: 1rem;
    color: var(--gray-700);
    font-size: 1rem;
}

.log-entries {
    max-height: 200px;
    overflow-y: auto;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    padding: 1rem;
}

.log-entry {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.875rem;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-timestamp {
    color: var(--gray-500);
}

.log-status.success {
    color: var(--success-color);
}

.log-status.error {
    color: var(--danger-color);
}

.bank-accounts-list {
    display: grid;
    gap: 1rem;
}

.bank-account-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.bank-account-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bank-account-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.bank-account-details h4 {
    margin-bottom: 0.25rem;
    color: var(--gray-800);
}

.bank-account-details span {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.bank-account-actions {
    display: flex;
    gap: 0.5rem;
}

.data-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.backup-info {
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--info-color);
}

.backup-info h4 {
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.backup-info p {
    color: var(--gray-600);
    font-size: 0.875rem;
}

.no-data {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border: 2px dashed var(--gray-300);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.income {
    background: var(--success-color);
    color: var(--white);
}

.badge.expense {
    background: var(--danger-color);
    color: var(--white);
}

/* Estados de carga */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}