/* --- Reset & Variables --- */
:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --accent-color: #38bdf8;
    --accent-hover: #0284c7;
    --row-hover: rgba(51, 65, 85, 0.5);
    --row-checked: rgba(16, 185, 129, 0.15);
    --success-color: #10b981;
    --danger-color: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: radial-gradient(circle at top, #1e293b, #0f172a);
    color: var(--text-color);
    min-height: 100vh;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Cartes de gestion des voyages & Progression --- */
.trip-manager-card, .tracker-card {
    width: 100%;
    max-width: 900px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    padding: 1.25rem 1.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    margin-bottom: 1rem;
}

.tracker-card {
    position: sticky;
    top: 1rem;
    z-index: 90;
    margin-bottom: 2rem;
}

.trip-selector-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.trip-selector-group select {
    flex: 1;
    min-width: 200px;
    padding: 0.6rem 1rem;
    background: #1e293b;
    color: var(--text-color);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
}

.trip-details {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.tracker-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.progress-bar-bg {
    width: 100%;
    height: 12px;
    background: #334155;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #38bdf8, #10b981);
    border-radius: 999px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Boutons --- */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary { background: var(--accent-color); color: #0f172a; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: #334155; color: var(--text-color); }
.btn-secondary:hover { background: #475569; }

.btn-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger-color); border: 1px solid rgba(239, 68, 68, 0.4); }
.btn-danger:hover { background: var(--danger-color); color: white; }

/* --- Tableau Styling --- */
.table-container {
    width: 100%;
    max-width: 900px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr { transition: background-color 0.2s ease; }
tr:hover { background-color: var(--row-hover); }

tr.is-checked { background-color: var(--row-checked); }
tr.is-checked td { color: #a7f3d0; }

tr.section-header td {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.2), transparent);
    color: var(--accent-color);
    font-weight: 700;
    font-size: 1.05rem;
    padding: 1rem;
    border-top: 2px solid rgba(56, 189, 248, 0.3);
    border-bottom: 2px solid rgba(56, 189, 248, 0.3);
}

tr.section-header.section-foreign td {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.2), transparent);
    color: #fbbf24;
    border-top: 2px solid rgba(245, 158, 11, 0.3);
    border-bottom: 2px solid rgba(245, 158, 11, 0.3);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-fr { background-color: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-foreign { background-color: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }

/* Style Checkbox */
td input[type="checkbox"] {
    appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--accent-color);
    border-radius: 6px;
    background-color: transparent;
    cursor: pointer;
    display: grid;
    place-content: center;
    transition: all 0.2s ease;
}

td input[type="checkbox"]::before {
    content: "✓";
    font-size: 14px;
    font-weight: bold;
    color: white;
    transform: scale(0);
    transition: transform 0.15s ease-in-out;
}

td input[type="checkbox"]:checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

td input[type="checkbox"]:checked::before { transform: scale(1); }

/* --- Modales --- */
.modal-overlay, .victory-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active, .victory-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card, .victory-content {
    background: #1e293b;
    border: 1px solid var(--card-border);
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.form-group label { font-size: 0.9rem; color: var(--text-muted); }

.form-group input {
    padding: 0.75rem 1rem;
    background: #0f172a;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 1rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Confettis */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    opacity: 0.8;
    animation: fall 3s linear infinite;
}

@keyframes fall {
    to { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}