:root {
    color-scheme: light;
    --pcv-primary: #2C6E9B;
    --pcv-primary-dark: #1D4E70;
    --pcv-primary-light: #5B9BD5;
    --pcv-accent: #E8A33D;
    --pcv-success: #2F9E6E;
    --pcv-danger: #D6534A;
    --pcv-bg: #F4F6F9;
    --pcv-surface: #FFFFFF;
    --pcv-ink: #1F2933;
    --pcv-muted: #67788C;
    --pcv-border: #E3E8EF;

    --bs-primary: var(--pcv-primary);
    --bs-primary-rgb: 44, 110, 155;
    --bs-link-color: var(--pcv-primary);
    --bs-link-hover-color: var(--pcv-primary-dark);
    --bs-body-color: var(--pcv-ink);
    --bs-body-bg: var(--pcv-bg);
}

:root[data-bs-theme="dark"] {
    color-scheme: dark;
    --pcv-primary-light: #7CB3E0;
    --pcv-bg: #10151b;
    --pcv-surface: #1B232C;
    --pcv-ink: #E7EBEF;
    --pcv-muted: #93A2B4;
    --pcv-border: #2A3440;
}

body {
    min-height: 100vh;
}

/* ---------- Barre de navigation ---------- */
.pcv-navbar {
    background: linear-gradient(120deg, var(--pcv-primary-dark), var(--pcv-primary) 65%, #2E8F8A);
    box-shadow: 0 2px 10px rgba(20, 40, 60, .12);
}

.pcv-navbar .navbar-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-family: Georgia, "Iowan Old Style", serif;
    font-size: 1.15rem;
    letter-spacing: .01em;
}

.pcv-navbar .navbar-brand svg {
    width: 24px;
    height: 24px;
}

.pcv-navbar .nav-link {
    color: rgba(255, 255, 255, .85) !important;
    font-weight: 500;
}

.pcv-navbar .nav-link:hover,
.pcv-navbar .nav-link.active {
    color: #FFFFFF !important;
}

.pcv-navbar .btn-nouveau {
    background: var(--pcv-accent);
    border: none;
    color: #402B05;
    font-weight: 600;
}

.pcv-navbar .btn-nouveau:hover {
    background: #f0b158;
    color: #402B05;
}

/* ---------- En-tetes de tableau ---------- */
.pcv-table-header th {
    background: #205579 !important;
    color: rgba(255, 255, 255, .9) !important;
    border-color: transparent !important;
}

/* ---------- Bouton "Gerer" jaune ---------- */
.btn-pcv-accent {
    background: #f0b158;
    border: none;
    color: #402B05;
    font-weight: 600;
}

.btn-pcv-accent:hover {
    background: var(--pcv-accent);
    color: #402B05;
}

/* ---------- Boutons primaires du site en jaune ---------- */
.btn-primary {
    --bs-btn-color: #402B05;
    --bs-btn-bg: #f0b158;
    --bs-btn-border-color: #f0b158;
    --bs-btn-hover-color: #402B05;
    --bs-btn-hover-bg: var(--pcv-accent);
    --bs-btn-hover-border-color: var(--pcv-accent);
    --bs-btn-focus-shadow-rgb: 240, 177, 88;
    --bs-btn-active-color: #402B05;
    --bs-btn-active-bg: var(--pcv-accent);
    --bs-btn-active-border-color: var(--pcv-accent);
    --bs-btn-disabled-color: #402B05;
    --bs-btn-disabled-bg: #f0b158;
    --bs-btn-disabled-border-color: #f0b158;
}

.btn-outline-primary {
    --bs-btn-color: #f0b158;
    --bs-btn-border-color: #f0b158;
    --bs-btn-hover-color: #402B05;
    --bs-btn-hover-bg: #f0b158;
    --bs-btn-hover-border-color: #f0b158;
    --bs-btn-focus-shadow-rgb: 240, 177, 88;
    --bs-btn-active-color: #402B05;
    --bs-btn-active-bg: #f0b158;
    --bs-btn-active-border-color: #f0b158;
    --bs-btn-disabled-color: #f0b158;
    --bs-btn-disabled-border-color: #f0b158;
}

/* ---------- Onglets d'un voyage (Apercu/Budget/Planning/...) ---------- */
.pcv-voyage-nav .nav-link {
    background: #205579;
    color: #fff;
    font-weight: 600;
    border: none;
    margin-right: 4px;
    border-radius: .375rem .375rem 0 0;
}

.pcv-voyage-nav .nav-link:hover,
.pcv-voyage-nav .nav-link:focus {
    background: var(--pcv-primary-dark);
    color: #fff;
}

.pcv-voyage-nav .nav-link.active {
    background: #f0b158;
    color: #402B05;
    font-weight: 600;
}

/* ---------- Cartes "Ajouter un ..." qui alimentent un tableau ---------- */
.pcv-card-ajout {
    background: #205579;
}

.pcv-card-ajout .card-body h2,
.pcv-card-ajout .card-body .form-label {
    color: #fff;
}

.pcv-card-ajout .card-body .text-muted {
    color: rgba(255, 255, 255, .75) !important;
}

/* ---------- Boutons de vue du calendrier (Mois/Semaine/Liste) ---------- */
.fc .fc-toolbar-chunk:last-child .fc-button-primary {
    background-color: #205579;
    border-color: #205579;
    color: #fff;
}

.fc .fc-toolbar-chunk:last-child .fc-button-primary:hover {
    background-color: var(--pcv-primary-dark);
    border-color: var(--pcv-primary-dark);
}

.fc .fc-toolbar-chunk:last-child .fc-button-primary:not(:disabled).fc-button-active {
    background-color: #f0b158;
    border-color: #f0b158;
    color: #402B05;
}

/* ---------- Cartes voyage ---------- */
.voyage-card {
    border: 1px solid var(--pcv-border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--pcv-surface);
    box-shadow: 0 1px 2px rgba(20, 30, 45, .04);
    transition: transform .15s ease, box-shadow .15s ease;
    height: 100%;
    cursor: pointer;
}

.voyage-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(20, 30, 45, .1);
}

.voyage-card .voyage-banniere {
    height: 72px;
    display: flex;
    align-items: flex-end;
    gap: .4rem;
    padding: .6rem .9rem;
    color: #fff;
}

.voyage-card .voyage-banniere.has-image {
    height: 110px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.voyage-card .voyage-banniere.has-image::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, .45) 100%);
}

.voyage-card .voyage-banniere.has-image .statut-badge {
    position: relative;
}

.voyage-card .voyage-banniere .statut-badge {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    padding: .2rem .55rem;
    border-radius: 100px;
    background: rgba(255, 255, 255, .22);
    backdrop-filter: blur(2px);
}

.voyage-card .voyage-banniere .type-badge {
    background: rgba(0, 0, 0, .3);
}

.voyage-card .card-body h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: .15rem;
}

.voyage-card .voyage-meta {
    font-size: .82rem;
    color: var(--pcv-muted);
}

.voyage-card .budget-bar {
    height: 6px;
    border-radius: 100px;
    background: var(--pcv-border);
    overflow: hidden;
    margin-top: .6rem;
}

.voyage-card .budget-bar > span {
    display: block;
    height: 100%;
    border-radius: 100px;
    transition: width .3s ease;
}

.voyage-card .participants-stack {
    display: flex;
    margin-top: .7rem;
}

/* ---------- Avatars ---------- */
.avatar-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
    color: #fff;
    border: 2px solid var(--pcv-surface);
    flex: none;
}

.participants-stack .avatar-circle {
    margin-left: -8px;
}

.participants-stack .avatar-circle:first-child {
    margin-left: 0;
}

.avatar-circle.lg {
    width: 42px;
    height: 42px;
    font-size: .95rem;
    border-width: 0;
}

.avatar-circle.xl {
    width: 126px;
    height: 126px;
    font-size: 2.6rem;
    border-width: 0;
}

/* ---------- Etats vides ---------- */
.pcv-empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
    color: var(--pcv-muted);
}

.pcv-empty-state i {
    font-size: 2.6rem;
    color: var(--pcv-primary-light);
    margin-bottom: .75rem;
    display: block;
}

/* ---------- En-tete de voyage (page detail) ---------- */
.voyage-header {
    background: linear-gradient(120deg, var(--pcv-primary-dark), var(--pcv-primary));
    color: #fff;
    border-radius: 16px;
    padding: 1.6rem 1.8rem;
    position: relative;
    overflow: hidden;
}

.voyage-header.has-image {
    background-size: cover;
    background-position: center;
}

.voyage-header.has-image::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(15, 30, 45, .82), rgba(15, 30, 45, .45));
}

.voyage-header > * {
    position: relative;
}

.voyage-header .voyage-header-meta {
    color: rgba(255, 255, 255, .85);
    font-size: .9rem;
}

/* ---------- Categories de depenses ---------- */
.categorie-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    font-size: 1rem;
}

/* Couleurs desormais calculees dynamiquement par categorie_style() (includes/helpers.php),
   les categories n'etant plus une liste figee. */

/* ---------- Calendrier (FullCalendar, page Planning) ---------- */
.fc .fc-button-primary {
    background: var(--pcv-primary);
    border-color: var(--pcv-primary);
}

.fc .fc-button-primary:hover {
    background: var(--pcv-primary-dark);
    border-color: var(--pcv-primary-dark);
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background: var(--pcv-primary-dark);
    border-color: var(--pcv-primary-dark);
}

/* ---------- Invitation en attente ---------- */
.invitation-banner {
    border: 1px solid #F0D9A6;
    background: #FBF0DC;
    color: #402B05;
    border-radius: 12px;
    padding: .85rem 1.1rem;
}

:root[data-bs-theme="dark"] .invitation-banner {
    border-color: #7A5C2E;
    background: #2E260F;
    color: #F0D9A6;
}

/* ---------- Formulaires / general ---------- */
.form-label {
    font-weight: 600;
    font-size: .85rem;
    color: var(--pcv-ink);
}

.card-auth {
    max-width: 400px;
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--pcv-border);
    box-shadow: 0 10px 30px rgba(20, 40, 60, .08);
}

@media (max-width: 575.98px) {
    .voyage-header {
        padding: 1.2rem 1.3rem;
        border-radius: 12px;
    }
}
