/* ── Guesthouse Management — Public Form CSS ─────────────────────── */
:root { --gm-color: #2c6e49; --gm-color-h: #1e4d34; --gm-radius: 8px; }

/* ── Wrapper ──────────────────────────────────────────────────────── */
.gm-form-wrap {
    max-width: 680px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #1a1a2e;
}

/* ── Progress stepper ─────────────────────────────────────────────── */
.gm-progress {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.gm-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #aaa;
    transition: color .2s;
    cursor: default;
}
.gm-step.active  { color: var(--gm-color); font-weight: 700; }
.gm-step.done    { color: var(--gm-color); }
.gm-step-num {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid currentColor;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    flex-shrink: 0;
    transition: all .2s;
}
.gm-step.active .gm-step-num {
    background: var(--gm-color);
    color: #fff;
    border-color: var(--gm-color);
    box-shadow: 0 0 0 4px rgba(44,110,73,.15);
}
.gm-step.done .gm-step-num {
    background: var(--gm-color);
    color: #fff;
    border-color: var(--gm-color);
}
.gm-step.done .gm-step-num::before { content: '\2713'; }
.gm-step.done .gm-step-num span    { display: none; }
.gm-step-label { font-size: 13px; }
.gm-step-sep   { color: #ddd; font-size: 12px; padding: 0 2px; }

/* ── Form card ────────────────────────────────────────────────────── */
.gm-form {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
    overflow: hidden;
    position: relative;
}

/* ── Pages ────────────────────────────────────────────────────────── */
.gm-page {
    display: none;
    /* Padding géré uniquement par Form Settings sur .gm-form (voir
       class-form-renderer.php) — pas de padding fixe ici, sinon double
       comptage qui fausse tout positionnement pixel-perfect des composants. */
    animation: gmFadeIn .25s ease;
}
.gm-page.active { display: block; }
@keyframes gmFadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

/* ── Fields ───────────────────────────────────────────────────────── */
.gm-field {
    margin-bottom: 18px;
}
.gm-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}
.gm-req { color: #e74c3c; margin-left: 2px; }

.gm-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e0e4ea;
    border-radius: var(--gm-radius);
    font-size: 15px;
    font-family: inherit;
    color: #1a1a2e;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
    -webkit-appearance: none;
}
.gm-input:focus {
    outline: none;
    border-color: var(--gm-color);
    box-shadow: 0 0 0 3px rgba(44,110,73,.12);
}
.gm-input.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231,76,60,.1);
}
.gm-input:disabled { background: #f8f9fa; color: #aaa; }

.gm-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e0e4ea;
    border-radius: var(--gm-radius);
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 90px;
    box-sizing: border-box;
    transition: border-color .15s;
}
.gm-textarea:focus {
    outline: none;
    border-color: var(--gm-color);
    box-shadow: 0 0 0 3px rgba(44,110,73,.12);
}

.gm-field-error {
    font-size: 12px;
    color: #e74c3c;
    margin-top: 4px;
    display: none;
}

/* ── Two-column grid for dates/numbers ───────────────────────────── */
.gm-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ── Navigation buttons ───────────────────────────────────────────── */
.gm-page-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f0f2f5;
    gap: 8px;
}
.gm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    border-radius: var(--gm-radius);
    border: 1.5px solid #e0e4ea;
    background: #fff;
    color: #444;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
    text-decoration: none;
    white-space: nowrap;
}
.gm-btn:hover { background: #f5f5f5; }
.gm-btn-primary {
    background: var(--gm-color);
    color: #fff;
    border-color: var(--gm-color);
}
.gm-btn-primary:hover { background: var(--gm-color-h); border-color: var(--gm-color-h); }
.gm-btn-submit {
    flex: 1;
    justify-content: center;
    padding: 12px 24px;
    font-size: 15px;
}
.gm-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Blocks ───────────────────────────────────────────────────────── */
.gm-block { margin-bottom: 18px; }

/* Price summary */
.gm-price-summary {
    background: linear-gradient(135deg, #f0faf5 0%, #e8f5ee 100%);
    border: 1.5px solid #c3e6cb;
    border-radius: var(--gm-radius);
    padding: 16px 18px;
    margin-bottom: 18px;
}
.gm-price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.gm-price-table td { padding: 4px 0; }
.gm-price-table td:last-child { text-align: right; font-weight: 600; }
.gm-price-total {
    border-top: 1.5px solid #c3e6cb;
    margin-top: 6px;
    font-size: 16px;
    font-weight: 800;
    color: var(--gm-color);
}
.gm-price-total td { padding-top: 10px; }
#gm-price-total { font-size: 18px; }
.gm-spinner-sm {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid #ddd;
    border-top-color: var(--gm-color);
    border-radius: 50%;
    animation: gmSpin .6s linear infinite;
    vertical-align: middle;
}

/* Payment choice */
.gm-payment-choice { margin-bottom: 18px; }
.gm-payment-options { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.gm-payment-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1.5px solid #e0e4ea;
    border-radius: var(--gm-radius);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-size: 14px;
}
.gm-payment-opt:hover { border-color: var(--gm-color); background: #f0faf5; }
.gm-payment-opt input[type=radio] {
    accent-color: var(--gm-color);
    width: 16px; height: 16px;
    flex-shrink: 0;
}
.gm-payment-opt input[type=radio]:checked + span { color: var(--gm-color); font-weight: 600; }

/* Supplements */
.gm-supplements { margin-bottom: 18px; }
.gm-supplement-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f2f5;
    font-size: 14px;
}
.gm-supplement-item:last-child { border-bottom: none; }
.gm-supplement-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
}
.gm-supplement-item input[type=checkbox] {
    accent-color: var(--gm-color);
    width: 16px; height: 16px;
    flex-shrink: 0;
}
.gm-supplement-item input[type=number] {
    width: 64px;
    padding: 5px 8px;
    border: 1.5px solid #e0e4ea;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
}

/* Coupon */
.gm-coupon { margin-bottom: 18px; }
.gm-coupon-row { display: flex; gap: 8px; margin-top: 6px; }
.gm-coupon-row .gm-input { flex: 1; text-transform: uppercase; letter-spacing: 1px; }
#gm-coupon-msg { font-size: 12px; margin-top: 4px; min-height: 18px; }

/* Terms */
.gm-terms { margin-bottom: 18px; }
.gm-toggle-inline {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}
.gm-toggle-inline input[type=checkbox] {
    accent-color: var(--gm-color);
    width: 16px; height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}
.gm-toggle-inline a { color: var(--gm-color); }

/* ── Loading overlay ──────────────────────────────────────────────── */
.gm-loading {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.85);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
}
.gm-spinner {
    width: 36px; height: 36px;
    border: 3px solid #e0e4ea;
    border-top-color: var(--gm-color);
    border-radius: 50%;
    animation: gmSpin .8s linear infinite;
}
@keyframes gmSpin { to { transform: rotate(360deg); } }

/* ── Success ──────────────────────────────────────────────────────── */
.gm-success {
    padding: 48px 28px;
    text-align: center;
    animation: gmFadeIn .3s ease;
}
.gm-success-icon { font-size: 56px; margin-bottom: 16px; }
.gm-success h3 { color: var(--gm-color); font-size: 22px; margin: 0 0 12px; }
.gm-success p  { color: #666; font-size: 15px; margin: 6px 0; }
.gm-success-ref {
    display: inline-block;
    background: #f0faf5;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 10px 20px;
    font-family: monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--gm-color);
    margin: 16px 0;
    letter-spacing: 1px;
}
.gm-success-link {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 24px;
    background: var(--gm-color);
    color: #fff;
    border-radius: var(--gm-radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

/* ── Error states ─────────────────────────────────────────────────── */
.gm-error {
    padding: 12px 16px;
    background: #fde8e8;
    border-left: 4px solid #e74c3c;
    border-radius: 0 var(--gm-radius) var(--gm-radius) 0;
    color: #c0392b;
    font-size: 14px;
    margin-bottom: 16px;
}
.gm-info-box {
    padding: 12px 16px;
    background: #f0faf5;
    border-left: 4px solid var(--gm-color);
    border-radius: 0 var(--gm-radius) var(--gm-radius) 0;
    font-size: 13px;
    color: #2c6e49;
    margin-bottom: 16px;
}

/* ── Calendar availability widget ────────────────────────────────── */
.gm-availability-calendar {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    overflow: hidden;
}

/* ── Tracking page ────────────────────────────────────────────────── */
.gm-tracking {
    max-width: 640px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.gm-tracking-header {
    background: var(--gm-color);
    color: #fff;
    padding: 28px 24px;
    border-radius: 12px 12px 0 0;
    text-align: center;
}
.gm-tracking-header h2 { margin: 0 0 4px; font-size: 20px; }
.gm-tracking-header p  { margin: 0; opacity: .85; font-size: 14px; }
.gm-tracking-body { background: #fff; border-radius: 0 0 12px 12px; box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.gm-tracking-status {
    padding: 20px 24px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.gm-tracking-badge {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 15px;
}
.gm-tracking-section {
    padding: 20px 24px;
    border-bottom: 1px solid #f0f2f5;
}
.gm-tracking-section:last-child { border-bottom: none; }
.gm-tracking-section h4 {
    margin: 0 0 14px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #888;
    font-weight: 700;
}
.gm-tracking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.gm-tracking-table tr { border-bottom: 1px solid #f5f5f5; }
.gm-tracking-table tr:last-child { border-bottom: none; }
.gm-tracking-table th {
    padding: 8px 0;
    text-align: left;
    font-weight: 600;
    color: #666;
    width: 45%;
    vertical-align: top;
}
.gm-tracking-table td { padding: 8px 0; vertical-align: top; }

/* Payment timeline */
.gm-payment-timeline { list-style: none; padding: 0; margin: 0; }
.gm-payment-timeline li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
}
.gm-payment-timeline li:last-child { border-bottom: none; }
.gm-payment-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--gm-color);
    flex-shrink: 0;
    margin-top: 4px;
}
.gm-payment-timeline .amount { font-weight: 700; color: var(--gm-color); margin-left: auto; }

/* Balance due box */
.gm-balance-box {
    background: #fff9f0;
    border: 1.5px solid #fcd34d;
    border-radius: var(--gm-radius);
    padding: 14px 18px;
    text-align: center;
}
.gm-balance-box .amount { font-size: 24px; font-weight: 800; color: #92400e; }
.gm-balance-box .label  { font-size: 12px; color: #92400e; margin-top: 2px; }
.gm-balance-paid {
    background: #f0faf5;
    border: 1.5px solid #c3e6cb;
    border-radius: var(--gm-radius);
    padding: 14px 18px;
    text-align: center;
    color: var(--gm-color);
    font-weight: 700;
    font-size: 16px;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
    /* Plus de padding responsive fixe ici — géré par Form Settings */
    .gm-field-row     { grid-template-columns: 1fr; }
    .gm-progress      { gap: 4px; }
    .gm-step-label    { display: none; }
    .gm-step.active .gm-step-label { display: inline; }
    .gm-payment-options { gap: 6px; }

    /* Composant "guests" (Voyageurs) — jusqu'ici totalement figé en
       pixels, sans la moindre adaptation à la largeur d'écran. Les
       boutons +/- lisent --gm-guest-btn (variable CSS définie inline par
       GmFieldGuests::renderPublic) qu'on redéfinit ici plus petite. */
    .gm-field-guests            { --gm-guest-btn: 28px; padding: 10px !important; }
    .gm-field-guests .gm-guests-row  { gap: 8px; }
    .gm-field-guests .gm-guests-btn  { font-size: 15px !important; }
    .gm-field-guests input[type="number"] { width: 32px !important; font-size: 13px !important; }
}

@media (max-width: 380px) {
    .gm-field-guests            { --gm-guest-btn: 26px; }
    .gm-field-guests .gm-guests-row span { font-size: 13px; }
}

@media (max-width: 480px) {
    /* Récapitulatif de prix (resume_prix) — la grille à 3 colonnes tient
       sur la plupart des mobiles, mais sur les écrans très étroits (ex.
       Pixel 9a) un libellé un peu long ("Ménages Glycines", "Linge de
       maison / serviettes") n'a plus assez de place. On réorganise alors
       la grille elle-même via grid-template-areas : libellé + total sur
       la ligne 1, "qté × prix unitaire" en petit sur toute la largeur de
       la ligne 2 — sans wrapper HTML supplémentaire, donc ça marche même
       si le libellé est assez long pour empiéter sur 2 lignes tout seul
       (contrairement à une réorganisation flexbox classique, qui pousse
       imprévisiblement les éléments suivants quand un libellé wrap). */
    .gm-field-resume-prix .gm-recap-item {
        display: grid !important;
        grid-template-columns: 1fr auto;
        grid-template-areas: "lbl total" "qtyunit qtyunit";
        column-gap: 8px;
        row-gap: 2px;
    }
    .gm-field-resume-prix .gm-recap-item .gm-recap-lbl {
        grid-area: lbl; font-weight: 600; min-width: 0;
    }
    .gm-field-resume-prix .gm-recap-item .gm-recap-lineamount {
        grid-area: total; font-weight: 700; text-align: right !important;
    }
    .gm-field-resume-prix .gm-recap-item .gm-recap-qtyunit {
        grid-area: qtyunit; text-align: left !important;
        font-size: 11px; color: #888; margin-top: 1px;
    }
}

/* ── Label position ────────────────────────────────────────────── */
.gm-form--labels-left .gm-field-wrap {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
}
.gm-form--labels-left .gm-field-label {
    width: 130px;
    min-width: 130px;
    flex-shrink: 0;
    margin-bottom: 0;
    font-weight: 500;
    text-align: right;
}
.gm-form--labels-left .gm-field-control {
    flex: 1;
}
.gm-form--labels-top .gm-field-label {
    display: block;
    margin-bottom: 5px;
}

/* ── Per-field label position (public form) ───────────────────── */
.gm-field--label-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.gm-field--label-left .gm-label,
.gm-field--label-left label {
    width: 130px;
    min-width: 130px;
    flex-shrink: 0;
    text-align: right;
    margin-bottom: 0;
    font-weight: 500;
}
.gm-field--label-left input,
.gm-field--label-left select,
.gm-field--label-left textarea {
    flex: 1;
}

/* ── Counter (adults / children) — styles depuis props FormBuilder ── */
.gm-field--counter { }
.gm-counter { display: inline-flex; align-items: center; }
.gm-counter-btn { transition: filter .1s; }
.gm-counter-btn:hover { filter: brightness(.92); }
.gm-counter-val::-webkit-inner-spin-button,
.gm-counter-val::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ── Calendar embed ───────────────────────────────────────────── */
.gm-field--calendar { margin-bottom: 20px; }
.gm-calendar-embed { min-height: 200px; }
.gm-calendar-loading { padding: 20px; text-align: center; color: #aaa; font-size: 14px; }

/* ── Public calendar ──────────────────────────────────────────── */
.gm-cal-month { margin-bottom: 20px; }
.gm-cal-header { text-align: center; padding: 10px 0; font-weight: 700; font-size: 15px; }
/* gm-cal-grid v1 — remplacé par v1.0 ci-dessous */
.gm-cal-dow {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    padding: 4px 0;
}
.gm-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    cursor: default;
}
.gm-cal-day.gm-cal-avail { cursor: pointer; }
.gm-cal-day.gm-cal-avail:hover { filter: brightness(1.1); }
.gm-cal-day.gm-cal-empty,
.gm-cal-day.gm-cal-past { background: transparent; color: #ccc; font-weight: 400; }
.gm-cal-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #666; margin-top: 8px; }
.gm-cal-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
/* Selected dates */
.gm-cal-day.selected-checkin,
.gm-cal-day.selected-checkout { outline: 3px solid #1a1a2e; }
.gm-cal-day.in-range { filter: brightness(0.85); }


/* ── Payment choice ─────────────────────────────────────────────── */
/* gm-pay-option supprimé — les options radio n'ont plus de classe */

/* ── Reset thème sur containers supplement / payment ─────────── */
.gm-field--supplements > legend,
.gm-field--supplements > .gm-label:empty,
.gm-field--payment > legend,
.gm-field--payment > .gm-label:empty {
    display: none !important;
}

/* ── Masquer label vide sur containers supplement / payment ──── */
.gm-field--supplements > .gm-label:empty,
.gm-field--payment > .gm-label:empty,
.gm-field--supplements .gm-label:empty,
.gm-field--payment .gm-label:empty {
    display: none !important;
}

/* ── GmCalendar v1.0 ────────────────────────────────────────────────────── */
.gm-cal-root { font-family: inherit; }
.gm-cal-months-wrap { display: flex; align-items: flex-start; gap: 6px; }
.gm-cal-months { flex: 1; display: flex; flex-wrap: wrap; gap: 12px; }
.gm-cal-month { flex: 1; min-width: 220px; box-sizing: border-box; }
.gm-cal-month-title {
    text-align: left; font-weight: 700; font-size: 13px; padding: 6px 4px 8px;
    background: transparent; color: #222; border-radius: 0;
}
.gm-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.gm-cal-head {
    text-align: center; font-size: 11px; font-weight: 700; color: #888;
    padding: 5px 2px; background: #f5f5f5;
}
.gm-cal-cell {
    text-align: center; padding: 2px; font-size: 12px; font-weight: 600;
    border: 1px solid #f0f0f0; box-sizing: border-box;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: filter .1s;
}
.gm-cal-cell[data-date] { cursor: pointer; }
.gm-cal-cell[data-date]:hover { filter: brightness(0.92); }
.gm-cal-daynum { font-size: 12px; font-weight: 600; line-height: 1.2; color: inherit; }
.gm-cal-prix { font-size: 9px; font-weight: 400; opacity: .85; line-height: 1; margin-top: 1px; }

.gm-cal-btn-nav {
    flex-shrink: 0; width: 30px; height: 30px; border: 1px solid #dee2e6;
    border-radius: 6px; background: #fff; cursor: pointer; font-size: 16px;
    display: flex; align-items: center; justify-content: center; margin-top: 6px;
    transition: background .1s;
}
.gm-cal-btn-nav:hover { background: #f5f5f5; }

.gm-cal-legend {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    font-size: 12px; color: #666; margin-top: 12px; padding: 0 4px;
}
.gm-cal-leg { display: flex; align-items: center; gap: 5px; }
.gm-cal-leg b {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 4px; font-size: 11px;
    font-weight: 700; color: #fff;
}
