* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #2563eb;
    --secondary-blue: #3b82f6;
    --light-blue: #60a5fa;
    --dark-blue: #1e40af;
    --accent-blue: #0ea5e9;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --success: #10b981;
    --danger: #ef4444;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-dark);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
}

/* Patterns de fond moderne */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(37, 99, 235, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(14, 165, 233, 0.08) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 60px,
            rgba(37, 99, 235, 0.02) 60px,
            rgba(37, 99, 235, 0.02) 61px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 60px,
            rgba(59, 130, 246, 0.02) 60px,
            rgba(59, 130, 246, 0.02) 61px
        );
    z-index: 0;
    pointer-events: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 50px;
    padding: 40px 20px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-radius: 24px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(37, 99, 235, 0.1) inset,
        0 8px 32px rgba(37, 99, 235, 0.15);
}

header h1 {
    font-size: 3rem;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-shadow: 0 0 40px rgba(37, 99, 235, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.main-content {
    display: grid;
    gap: 24px;
}

section {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(59, 130, 246, 0.1) inset;
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

section:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(59, 130, 246, 0.2) inset,
        0 0 20px rgba(37, 99, 235, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

h2 {
    color: var(--light-blue);
    margin-bottom: 24px;
    font-size: 1.75rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

h2::before {
    content: '';
    width: 4px;
    height: 28px;
    background: linear-gradient(180deg, var(--primary-blue), var(--accent-blue));
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

/* Formulaire */
.form-group {
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: rgba(15, 23, 42, 0.8);
    box-shadow:
        0 0 0 4px rgba(37, 99, 235, 0.1),
        0 0 20px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

input[type="text"]::placeholder,
input[type="number"]::placeholder {
    color: var(--text-muted);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2360a5fa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Boutons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--accent-blue) 100%);
    color: white;
    width: 100%;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
    position: relative;
    z-index: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(59, 130, 246, 0.1);
    color: var(--light-blue);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.btn-secondary:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    padding: 10px 20px;
    font-size: 0.9rem;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Résumé */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    position: relative;
    z-index: 1;
}

.summary-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
    padding: 28px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.3);
    border-color: var(--primary-blue);
}

.summary-card:hover::before {
    opacity: 1;
}

.summary-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.summary-value {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--light-blue) 0%, var(--primary-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
}

/* Liste des dépenses */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.section-header h2 {
    margin-bottom: 0;
}

.actions {
    display: flex;
    gap: 12px;
}

.expenses-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.expense-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 20px;
    align-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-blue);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.expense-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.1) 0%, transparent 100%);
    transition: width 0.3s;
}

.expense-item:hover::before {
    width: 100%;
}

.expense-item:hover {
    border-color: var(--primary-blue);
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.2);
    transform: translateX(8px);
}

.expense-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.05rem;
    position: relative;
    z-index: 1;
}

.expense-category {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.expense-category::before {
    content: '•';
    color: var(--accent-blue);
}

.expense-amount {
    font-weight: 800;
    color: var(--light-blue);
    font-size: 1.2rem;
    position: relative;
    z-index: 1;
}

.expense-frequency {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(37, 99, 235, 0.15);
    color: var(--light-blue);
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(37, 99, 235, 0.3);
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.expense-monthly {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    font-style: italic;
    font-size: 1.05rem;
}

/* Répartition */
.category-breakdown,
.frequency-breakdown {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 4px 0;
}

.breakdown-label {
    min-width: 180px;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
}

.breakdown-bar-container {
    flex: 1;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 12px;
    height: 40px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}

.breakdown-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-blue) 0%, var(--accent-blue) 100%);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3) inset;
    position: relative;
    overflow: hidden;
}

.breakdown-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.breakdown-amount {
    min-width: 140px;
    text-align: right;
    font-weight: 800;
    color: var(--light-blue);
    font-size: 1.1rem;
}

.breakdown-percentage {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 6px;
    border: 2px solid var(--bg-dark);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-blue);
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .expense-item {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .section-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .actions {
        width: 100%;
        flex-direction: column;
    }

    .actions button {
        width: 100%;
    }

    .breakdown-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .breakdown-bar-container {
        width: 100%;
    }

    .breakdown-label {
        min-width: 100%;
    }

    .breakdown-amount {
        width: 100%;
        text-align: left;
    }
}

/* Animations d'entrée */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section {
    animation: fadeInUp 0.6s ease-out backwards;
}

section:nth-child(1) { animation-delay: 0.1s; }
section:nth-child(2) { animation-delay: 0.2s; }
section:nth-child(3) { animation-delay: 0.3s; }
section:nth-child(4) { animation-delay: 0.4s; }
section:nth-child(5) { animation-delay: 0.5s; }
