:root {
    --primary: #ff2d55;
    /* Magenta del logo */
    --secondary: #8b5cf6;
    /* Morado */
    --accent-yellow: #f9d423;
    --accent-blue: #00d2ff;
    --success: #00c853;
    --warning: #ffab00;
    --danger: #ff3d00;
    --dark: #0f172a;
    --light: #f8fafc;
    --white: #ffffff;
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --card-radius: 1.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: radial-gradient(circle at top left, #f8fafc, #e2e8f0);
    background-attachment: fixed;
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 45, 85, 0.1), transparent);
    z-index: -1;
    border-radius: 50%;
}

body::after {
    content: '';
    position: fixed;
    bottom: -100px;
    left: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1), transparent);
    z-index: -1;
    border-radius: 50%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent-blue));
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    padding: 1rem;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.auth-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: var(--card-radius);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary);
    font-size: 1.75rem;
}

.auth-card p {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.auth-card a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 1rem;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(255, 45, 85, 0.1);
}

.btn {
    width: 100%;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 1rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(255, 45, 85, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 45, 85, 0.4);
    filter: brightness(1.1);
}

/* Dashboard */
.dashboard-header {
    background: white;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    border-radius: 0.75rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

/* Avatar and Greeting */
.user-greeting-card {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: var(--glass);
    backdrop-filter: blur(20px);
    padding: 2rem;
    border-radius: var(--card-radius);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.avatar-container {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.avatar-image {
    width: 100%;
    height: 100%;
    border-radius: 2rem;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.avatar-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: var(--success);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid white;
}

.greeting-text h2 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.greeting-text p {
    font-size: 1.1rem;
    color: #64748b;
    font-weight: 500;
}

@media (max-width: 768px) {
    .user-greeting-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .greeting-text h2 {
        font-size: 1.5rem;
    }
}

.filter-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.filter-form select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.filter-form select:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-form select:hover {
    border-color: var(--primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 2rem;
    border-radius: var(--card-radius);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.stat-card h3 {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
}

.stat-card .value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1;
}

.stat-card.income .value {
    color: var(--success);
    text-shadow: 0 0 20px rgba(0, 200, 83, 0.2);
}

.stat-card.expense .value {
    color: var(--danger);
    text-shadow: 0 0 20px rgba(255, 61, 0, 0.2);
}

.stat-card.balance .value {
    color: var(--secondary);
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}


.health-indicator {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-align: center;
}

.health-indicator.saludable {
    background: #d1fae5;
    color: var(--success);
}

.health-indicator.alerta {
    background: #fef3c7;
    color: var(--warning);
}

.health-indicator.critico {
    background: #fee2e2;
    color: var(--danger);
}

.health-indicator.sin-datos {
    background: var(--light);
    color: #6b7280;
}

/* Floating Button */
.fab {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s;
    border: none;
}

.fab:hover {
    background: var(--secondary);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 999;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #6b7280;
    font-size: 0.75rem;
    padding: 0.5rem 1rem;
    transition: color 0.3s;
    min-width: 60px;
}

.nav-item span:first-child {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item:hover {
    color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        padding-bottom: 100px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card .value {
        font-size: 1.75rem;
    }

    .dashboard-header h2 {
        font-size: 1.25rem;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-form {
        width: 100%;
    }

    .filter-form select {
        flex: 1;
    }

    .fab {
        bottom: 90px;
        right: 15px;
        width: 56px;
        height: 56px;
    }
}

@media (min-width: 769px) {
    .container {
        padding: 2rem;
    }

    .bottom-nav {
        display: none;
    }

    .fab {
        bottom: 30px;
    }

    /* Desktop Navigation */
    .desktop-nav {
        display: flex;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .desktop-nav a {
        padding: 0.75rem 1.5rem;
        background: white;
        border-radius: 0.5rem;
        text-decoration: none;
        color: var(--dark);
        transition: all 0.3s;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .desktop-nav a:hover {
        background: var(--primary);
        color: white;
        transform: translateY(-2px);
    }
}

/* Toast Animations */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Menú Hamburguesa */
.hamburger {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: var(--glass);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    width: 50px;
    height: 50px;
    border-radius: 1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger span {
    width: 20px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger:hover {
    transform: scale(1.1);
    background: white;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.05);
    z-index: 1002;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    border-right: 1px solid var(--glass-border);
}

.sidebar.active {
    transform: translateX(320px);
}

.sidebar-header {
    padding: 3rem 2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-align: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--dark);
    text-decoration: none;
    transition: all 0.3s;
    font-size: 1rem;
    border-left: 4px solid transparent;
}

.sidebar-menu a:hover {
    background: var(--light);
    border-left-color: var(--primary);
    padding-left: 2rem;
}

.sidebar-menu a.active {
    background: rgba(99, 102, 241, 0.1);
    border-left-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Chart Cards */
.chart-card {
    background: white;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.chart-card h3 {
    margin-bottom: 1.5rem;
    color: var(--dark);
    font-size: 1.25rem;
}

.chart-card canvas {
    max-height: 400px;
}

/* Responsive Charts */
@media (max-width: 768px) {
    .chart-card {
        padding: 1.5rem;
    }

    .chart-card h3 {
        font-size: 1rem;
    }

    .chart-card canvas {
        max-height: 300px;
    }

    .hamburger {
        top: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
    }

    .container {
        padding-top: 2rem;
    }

    .dashboard-header {
        margin-top: 60px;
    }
}

@media (min-width: 769px) {
    .hamburger {
        top: 25px;
        left: 25px;
    }

    .sidebar {
        width: 320px;
        left: -320px;
    }

    .container {
        padding-top: 2rem;
    }

    .dashboard-header {
        margin-top: 80px;
    }
}

/* Sección de Movimientos */
.movements-section {
    margin-top: 2rem;
}

.movements-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--dark);
}

.movements-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.movements-column {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.column-header {
    padding: 1rem 1.5rem;
    color: white;
    font-weight: 600;
}

.income-header {
    background: linear-gradient(135deg, #10b981, #059669);
}

.expense-header {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.column-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.movements-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
}

.movements-list::-webkit-scrollbar {
    width: 6px;
}

.movements-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.movements-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.movements-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.movement-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.movement-item:last-child {
    border-bottom: none;
}

.movement-item:hover {
    background: var(--light);
}

.movement-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.movement-desc {
    font-weight: 500;
    color: var(--dark);
    font-size: 0.95rem;
}

.movement-date {
    font-size: 0.8rem;
    color: #6b7280;
}

.movement-amount {
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
}

.income-amount {
    color: #10b981;
}

.expense-amount {
    color: #ef4444;
}

.column-total {
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    border-top: 2px solid var(--border);
}

.income-total {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.expense-total {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.empty-state p {
    margin: 0;
    font-style: italic;
}

/* Resumen de Movimientos */
.movements-summary {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    font-size: 1rem;
}

.summary-label {
    color: #6b7280;
    font-weight: 500;
}

.summary-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.income-text {
    color: #10b981;
}

.expense-text {
    color: #ef4444;
}

.summary-divider {
    height: 2px;
    background: var(--border);
    margin: 0.5rem 0;
}

.summary-final {
    padding: 1rem 0;
    font-size: 1.2rem;
}

.summary-final .summary-label {
    color: var(--dark);
    font-weight: 700;
}

.summary-final .summary-value {
    font-size: 1.5rem;
}

/* Responsive Movimientos */
@media (max-width: 768px) {
    .movements-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .movements-section h2 {
        font-size: 1.25rem;
    }

    .movements-list {
        max-height: 300px;
    }

    .movement-desc {
        font-size: 0.9rem;
    }

    .movement-amount {
        font-size: 0.95rem;
    }

    .column-total {
        font-size: 1rem;
    }

    .summary-final .summary-value {
        font-size: 1.3rem;
    }
}