/* ── Base ─────────────────────────────────────────────────── */
body {
    font-family: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 15px;
    color: var(--tl-blue);
}

h1 { font-size: 30px; }
h2 { font-size: 24px; }

/* ── Header ──────────────────────────────────────────────── */
#header {
    background: var(--color-white);
    border-bottom: 1px solid var(--tl-gold);
    height: 60px;
    padding: 6px 0;
}

.header-middle {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 2rem;
}

/* ── Menu principal ───────────────────────────────────────── */
.main-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.main-menu .menu-item {
    position: relative;
    display: flex;
    align-items: center;
}

.main-menu > .menu-item > a {
    text-decoration: none;
    font-weight: normal;
    text-transform: uppercase;
    font-size: .8rem;
    letter-spacing: .08em;
    color: var(--color-text);
    white-space: nowrap;
}

.main-menu > .current-menu-item > a,
.main-menu > .current-menu-ancestor > a {
    color: var(--tl-gold);
}

.main-menu .ouvrir-sous-menu {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 2px;
    vertical-align: middle;
    color: inherit;
}

.main-menu .svg-icon {
    width: .7em;
    height: .7em;
    fill: currentColor;
}

/* ── Sous-menu ────────────────────────────────────────────── */
.sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-white);
    box-shadow: 0 4px 16px var(--shadow-menu);
    list-style: none;
    padding: .5rem 0;
    padding-top: calc(.5rem + 8px);
    min-width: 220px;
    z-index: 100;
}

.sous-menu-ouvert > .sub-menu,
.menu-item-has-children:hover > .sub-menu {
    display: block;
}

.sub-menu .menu-item a {
    display: block;
    padding: .4rem 1.2rem;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    text-decoration: none;
    color: var(--color-text);
}

.sub-menu .current-menu-item a {
    color: var(--tl-gold);
}

/* ── Accessibilité ────────────────────────────────────────── */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.title-area a {
    display: inline-block;
    line-height: 0;
}

/* ── Main content ─────────────────────────────────────────── */
#main .container {
    max-width: 1240px;
    padding-top: 30px;
    padding-bottom: 30px;
}

/* ── Gridview sort icons ──────────────────────────────────── */
a.asc:after, a.desc:after {
    content: '';
    left: 3px;
    display: inline-block;
    width: 0;
    height: 0;
    border: solid 5px transparent;
    margin: 4px 4px 2px 4px;
    background: transparent;
}

a.asc:after {
    border-bottom: solid 7px var(--color-sort);
    border-top-width: 0;
}

a.desc:after {
    border-top: solid 7px var(--color-sort);
    border-bottom-width: 0;
}

.grid-view th {
    white-space: nowrap;
}

/* ── Articles demandes ────────────────────────────────────── */
.demande-article {
    display: grid;
    grid-template-columns: 80fr 20fr;
    border: 1px solid var(--color-border);
    margin-bottom: .75rem;
}

.demande-left  { padding: .75rem 1rem; border-right: 1px solid var(--color-border); min-width: 0; }

.demande-auteur { margin-left: auto; white-space: nowrap; }

.stade-reve { color: var(--stade-reve); }
.stade-idee { color: var(--stade-idee); }
.stade-resa { color: var(--stade-resa); }

.demande-head {
    display: flex;
    gap: 1rem;
    align-items: baseline;
    margin-bottom: .3rem;
    font-weight: 600;
}

.demande-destination { flex: 0 0 auto; }
.demande-programme   { flex: 1; }
.demande-pax         { flex: 0 0 auto; font-weight: normal; }

.demande-meta  { display: flex; gap: 2rem; flex-wrap: wrap; margin-bottom: .2rem; font-size: .85em; }
.demande-envies {
    margin-top: .5rem;
    font-size: .85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Table conseillers ────────────────────────────────────── */
.conseiller-table {
    width: 100%;
    border-collapse: collapse;
}

.conseiller-table th,
.conseiller-table td {
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}

.conseiller-table td.charge {
    text-align: right;
    white-space: nowrap;
}

.conseiller-table td.disponible {
    text-align: center;
}

.conseiller-table thead th {
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--tl-gold);
}

.conseiller-table tbody tr:hover {
    background: color-mix(in srgb, var(--tl-blue) 4%, transparent);
}

/* ── Barre de charge ──────────────────────────────────────── */
.charge-bar {
    display: inline-block;
    width: 40px;
    height: .65em;
    background: var(--color-border);
    border-radius: 2px;
    vertical-align: middle;
    margin-left: .5rem;
    overflow: hidden;
    position: relative;
}

.charge-bar::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--pct);
    background: var(--charge-color);
    transition: width .2s;
}

/* ── Input devis max ──────────────────────────────────────── */
.edit-devis-max {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    color: inherit;
    font: inherit;
    padding: 0 3px;
    text-align: right;
    width: 36px;
}

.edit-devis-max:focus, .edit-devis-max:hover {
    outline: none;
    border-color: var(--tl-gold);
    background: var(--color-white);
}

/* ── Bouton IA + résultat ─────────────────────────────────── */
.demande-right {
    position: relative;
    padding: .75rem 1rem;
}

.btn-ia {
    position: absolute;
    top: 6px;
    right: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--tl-blue);
    padding: 2px;
    line-height: 0;
}

.btn-ia:hover {
    color: var(--tl-gold);
}

.btn-ia:disabled {
    opacity: .4;
    cursor: wait;
}

.ia-result {
    font-size: .8rem;
    width: 100%;
}

.ia-suggestion {
    display: inline-flex;
    align-items: baseline;
    gap: .3rem;
}

.ia-info {
    position: relative;
    display: inline-block;
    color: var(--color-muted);
    cursor: default;
    font-size: .85em;
}

.ia-info:hover .reco-popover {
    display: block;
}

.reco-popover {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 16px var(--shadow-menu);
    z-index: 200;
    min-width: 180px;
    padding: .5rem .75rem;
    white-space: nowrap;
}

.reco-popover-title {
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .4rem;
    color: var(--tl-blue);
}

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

.reco-table td {
    padding: .15rem .3rem;
    font-size: .8rem;
}

.reco-table td:last-child {
    text-align: right;
    padding-left: 1rem;
}

.ia-raisonnement {
    font-size: .75rem;
    color: var(--color-muted);
    margin-top: .25rem;
}

.ia-meta {
    font-size: .7rem;
    color: var(--color-muted);
    margin-top: .2rem;
}

/* ── Page login ───────────────────────────────────────────── */
.site-login {
    max-width: 400px;
    margin: 3rem auto;
    text-align: center;
}

.btn-google {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem 1.4rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 500;
    font-size: .9rem;
}

.btn-google:hover {
    border-color: var(--tl-gold);
}

.auth-error {
    margin-top: 1.5rem;
    padding: .5rem 1rem;
    color: var(--color-error);
    background: var(--color-error-bg);
    border-left: 3px solid var(--color-error-border);
    font-size: .85rem;
    text-align: left;
}

/* ── Info utilisateur header ──────────────────────────────── */
.header-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    white-space: nowrap;
}

.header-username {
    color: var(--color-text);
}

.btn-logout {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    font: inherit;
    font-size: .8rem;
    padding: 0;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.btn-logout:hover {
    color: var(--tl-gold);
}

/* ── Flash message ────────────────────────────────────────── */
#flash-message {
    position: fixed;
    top: 70px;
    right: max(20px, calc((100vw - 1240px) / 2 + 12px));
    padding: .5rem 1rem;
    border-left: 3px solid;
    font-size: .85rem;
    z-index: 500;
    transition: opacity .3s;
}

#flash-message.flash-success {
    color: var(--color-success);
    background: var(--color-success-bg);
    border-color: var(--color-success-border);
}

#flash-message.flash-error {
    color: var(--color-error);
    background: var(--color-error-bg);
    border-color: var(--color-error-border);
}

/* ── Page d'accueil plein écran ───────────────────────────── */
.home-fullscreen {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-color: var(--tl-blue);
}

.home-logo {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1rem;
}

.hint-block {
    display: block;
    margin-top: 5px;
    color: var(--color-muted);
}

.error-summary {
    color: var(--color-error);
    background: var(--color-error-bg);
    border-left: 3px solid var(--color-error-border);
    padding: 10px 20px;
    margin: 0 0 15px 0;
}
