:root {
    --bg-dark: #0f0c29;
    --bg-middle: #302b63;
    --bg-light: #24243e;
    
    --accent-primary: #f2c94c; /* Gold */
    --accent-secondary: #f2994a;
    --accent-glow: rgba(242, 201, 76, 0.5);
    
    --text-main: #f8f9fa;
    --text-muted: #adb5bd;
    
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    --danger: #ff4757;
    --success: #2ed573;
    
    --font-main: 'Outfit', sans-serif;
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-middle), var(--bg-light));
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-attachment: fixed;
}

/* Background Animated Shapes */
.bg-shape {
    position: absolute;
    filter: blur(100px);
    z-index: -1;
    border-radius: 50%;
    animation: float 10s infinite ease-in-out alternate;
}
.shape-1 {
    width: 300px;
    height: 300px;
    background: var(--accent-primary);
    top: 10%;
    left: 20%;
    opacity: 0.3;
}
.shape-2 {
    width: 400px;
    height: 400px;
    background: #e056fd; /* Purple/Pink */
    bottom: 10%;
    right: 10%;
    opacity: 0.2;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 50px) scale(1.1); }
}

/* Utility Classes */
.d-none { display: none !important; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

.glow-text {
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px var(--accent-glow);
}

/* Glassmorphism */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Buttons */
.btn {
    font-family: var(--font-main);
    font-weight: 600;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

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

.primary-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-dark);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}
.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

.accent-btn {
    background: rgba(242, 201, 76, 0.1);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Forms */
input[type="text"],
input[type="password"],
input[type="number"],
select {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

input:focus, select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(242, 201, 76, 0.2);
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-group input {
    padding-left: 2.5rem;
}

.inline-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form input[type="text"] {
    flex: 1;
    min-width: 200px;
}

.stacked-form .form-group {
    margin-bottom: 1rem;
}
.stacked-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Toggle Switch */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255,255,255,0.2);
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Layout Screens */
.screen {
    min-height: 100vh;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Login Screen */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.login-container h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.login-container p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.login-container button {
    width: 100%;
}

.error-msg {
    color: var(--danger);
    margin-top: 1rem;
    font-size: 0.9rem;
    display: none;
}
.error-msg:not(.d-none) {
    display: block;
}

/* Main App Layout */
#main-app {
    display: flex;
}

.sidebar {
    width: 250px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    z-index: 100;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    text-align: center;
}

.countdown {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    display: inline-block;
}

.nav-links {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
}

.nav-links li {
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-muted);
    border-left: 3px solid transparent;
}

.nav-links li:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
}

.nav-links li.active {
    color: var(--accent-primary);
    background: rgba(242, 201, 76, 0.05);
    border-left-color: var(--accent-primary);
}

.sidebar-footer {
    padding: 1.5rem;
}

.content-area {
    margin-left: 250px;
    flex: 1;
    padding: 2rem 3rem;
    min-height: 100vh;
}

.section-header {
    margin-bottom: 2rem;
}

.section-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-muted);
}

.app-section {
    animation: slideUp 0.4s ease forwards;
}

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

/* Dashboard Cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

.bounce-hover:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(242,201,76,0.2), rgba(242,153,74,0.2));
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 1.5rem;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Guest List */
.guest-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.badge {
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dynamic-list {
    list-style: none;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: var(--transition);
}

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

.list-item:hover {
    background: rgba(255,255,255,0.02);
}

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

.item-tags span {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    margin-left: 0.5rem;
}

.item-tags .tag-warn {
    background: rgba(255, 71, 87, 0.2);
    color: #ff6b81;
}
.item-tags .tag-success {
    background: rgba(46, 213, 115, 0.2);
    color: #7bed9f;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
}

.btn-icon:hover.delete {
    color: var(--danger);
}

/* Calculator Grid */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

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

.form-row label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-row input {
    width: 80px;
    text-align: right;
}

.calculated-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.calc-item {
    display: flex;
    justify-content: space-between;
    background: rgba(0,0,0,0.2);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--accent-primary);
}

/* Finances Grid */
.finances-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.debts-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.debt-item {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
}

.debt-item .owe {
    color: var(--danger);
}
.debt-item .get {
    color: var(--success);
}

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

.expenses-table th, .expenses-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.expenses-table th {
    color: var(--text-muted);
    font-weight: normal;
}

/* Todo section */
.progress-container {
    width: 100%;
}

.progress-bar-bg {
    width: 100%;
    height: 12px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
    width: 0%;
    transition: width 0.5s ease;
}

.progress-text {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.todo-lists-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.todo-category-box h4 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.cat-deco { color: #f368e0; }
.cat-food { color: #ff9f43; }
.cat-logistics { color: #0abde3; }
.cat-general { color: #1dd1a1; }

.todo-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 0;
}

.todo-item.completed span {
    text-decoration: line-through;
    color: var(--text-muted);
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.todo-item button { margin-left: auto; }

/* Modal & Toast */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 2000;
    font-weight: 600;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 992px) {
    .calculator-grid, .finances-grid, .todo-lists-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: auto; /* IMPORTANT: Retire le top:0 du desktop */
        bottom: 0;
        left: 0;
        z-index: 1000;
        background: var(--bg-dark);
        border-top: 1px solid var(--glass-border);
        box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
    }
    .sidebar-header, .sidebar-footer {
        display: none;
    }
    .nav-links {
        display: flex;
        justify-content: space-between;
        width: 100%;
        padding: 0;
        margin: 0;
    }
    .nav-links li {
        flex: 1;
        min-width: 0;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0.5rem 0;
        border-left: none;
        border-bottom: 3px solid transparent;
        gap: 3px;
        cursor: pointer;
        touch-action: manipulation;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    .nav-links li i, .nav-links li span {
        pointer-events: none;
    }
    .nav-links li.active {
        border-left-color: transparent;
        border-bottom-color: var(--accent-primary);
        background: rgba(242, 201, 76, 0.05);
    }
    .nav-links li i { margin: 0; font-size: 1.1rem; }
    .nav-links li .nav-text { display: block; font-size: 0.55rem; margin-top: 4px; text-align: center; white-space: normal; line-height: 1; word-break: break-word; }
    
    .content-area {
        margin-left: 0;
        padding: 1rem;
        padding-bottom: 120px; /* Space for the bottom nav */
    }
    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }
    .inline-form input[type="text"], .inline-form select {
        min-width: 0 !important;
        width: 100% !important;
    }
    .inline-form button { margin-top: 10px; }
    
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .expenses-table {
        min-width: 100%; /* Plus de scrolling forcé */
    }
    .expenses-table th, .expenses-table td {
        padding: 0.5rem;
        font-size: 0.85rem;
        word-break: break-word;
    }
    
    .todo-item span {
        word-break: break-word;
    }

    .section-header h1 {
        font-size: 2rem;
    }
    
    .guest-stats {
        justify-content: center;
    }
}
