:root {
    --rose:        #ed426d;
    --rose-dark:   #d93a60;
    --rose-light:  #fdf0f3;
    --teal:        #47a9b3;
    --teal-dark:   #3d949d;
    --teal-light:  #ecf6f7;
    --grey-900:    #393939;
    --grey-600:    #6b7280;
    --grey-400:    #9ca3af;
    --grey-200:    #e5e7eb;
    --grey-100:    #f2f2f2;
    --grey-50:     #f8f9fa;
    --white:       #ffffff;
    --radius:      10px;
    --radius-sm:   6px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--grey-50);
    color: var(--grey-900);
    -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.accent-bar {
    height: 3px;
    background: linear-gradient(90deg, var(--rose), var(--teal));
}
.page-header {
    background: var(--white);
    border-bottom: 1px solid var(--grey-200);
    padding: 20px 24px;
    text-align: center;
}
.page-header .brand {
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 10px;
}
.page-header h1 {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--grey-900);
    margin-bottom: 4px;
}
.page-header .subtitle {
    font-size: 0.9em;
    color: var(--grey-600);
}

/* ── Container ── */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}

/* ── Calendar selector ── */
.selector-card {
    background: var(--white);
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 28px;
}
.selector-card label {
    display: block;
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--grey-600);
    margin-bottom: 8px;
}
.select-wrap {
    position: relative;
}
.select-wrap select {
    width: 100%;
    padding: 12px 40px 12px 14px;
    font-family: inherit;
    font-size: 0.95em;
    font-weight: 500;
    color: var(--grey-900);
    border: 1.5px solid var(--grey-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    appearance: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.select-wrap select:focus {
    outline: none;
    border-color: var(--teal);
}
.select-wrap select:focus-visible {
    outline: 3px solid rgba(71, 169, 179, 0.28);
    outline-offset: 1px;
}
.select-wrap::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--grey-400);
    pointer-events: none;
}

/* ── Calendar title ── */
#cal-title {
    text-align: center;
    font-size: 1.05em;
    font-weight: 600;
    color: var(--grey-900);
    margin-bottom: 24px;
    display: none;
    padding: 14px 20px;
    background: var(--teal-light);
    border-radius: var(--radius-sm);
}

#cal-location {
    display: none;
    margin: -12px 0 18px;
    text-align: center;
    font-size: 0.9em;
    color: var(--grey-600);
}

.cal-qrcode {
    display: none;
    margin: 0 0 18px;
    padding: 12px;
    border: 1px solid var(--grey-200);
    background: var(--white);
    border-radius: var(--radius-sm);
    text-align: center;
}
.cal-qrcode img {
    width: 124px;
    height: 124px;
    border-radius: 6px;
    border: 1px solid var(--grey-200);
    background: var(--white);
}
.cal-qrcode a {
    display: block;
    margin-top: 8px;
    color: var(--teal-dark);
    font-size: 0.82em;
    text-decoration: none;
    word-break: break-all;
}
.cal-qrcode a:hover {
    text-decoration: underline;
}

/* ── Day group ── */
.day-group {
    background: var(--white);
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}
.day-group-header {
    padding: 14px 20px;
    background: var(--grey-50);
    border-bottom: 1px solid var(--grey-200);
}
.day-group-header h3 {
    font-size: 0.88em;
    font-weight: 600;
    color: var(--grey-900);
    text-transform: capitalize;
}
.day-group.past-date .day-group-header {
    background: var(--grey-100);
    border-bottom-color: var(--grey-200);
}
.day-group.past-date .day-group-header h3 {
    color: var(--grey-400);
}
.day-group-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.period-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.period-title {
    font-size: 0.76em;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--grey-400);
}

.period-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.slot-wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: calc((100% - 24px) / 3);
    min-width: 0;
}

/* ── Slot buttons ── */
.slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 12px 20px;
    border: 1.5px solid var(--grey-200);
    border-radius: 8px;
    background: var(--white);
    color: var(--grey-900);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.15s ease;
}
.slot-wrap .slot {
    width: 100%;
}
.slot:hover {
    border-color: var(--teal);
    background: var(--teal-light);
    color: var(--teal-dark);
}
.slot.selected {
    border-color: var(--teal);
    background: var(--teal);
    color: var(--white);
}
.slot.selected small { color: rgba(255,255,255,0.8); }
.slot.reserved {
    border-color: var(--grey-200);
    background: var(--grey-100);
    color: var(--grey-400);
    cursor: default;
    text-decoration: line-through;
    opacity: 0.7;
}
.slot.past {
    border-color: var(--grey-200);
    background: var(--grey-100);
    color: var(--grey-400);
    cursor: default;
    opacity: 0.78;
}
.slot.past:hover {
    border-color: var(--grey-200);
    background: var(--grey-100);
    color: var(--grey-400);
}
.slot small {
    font-size: 0.72em;
    font-weight: 500;
    color: var(--grey-400);
}
.slot small.slot-places-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.74em;
    font-weight: 800;
    letter-spacing: 0.02em;
    background: #dff8e8;
    color: #111111;
    border: 1px solid #9fe0b4;
    box-shadow: 0 1px 0 rgba(15, 122, 54, 0.08);
}
.slot-places-tag::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #16a34a;
}
.slot small.slot-places-tag.slot-places-tag-warning {
    background: #ffedd5;
    border-color: #fdba74;
    color: #111111;
}
.slot-places-tag.slot-places-tag-warning::before {
    background: #ea580c;
}
.slot.selected .slot-places-tag {
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.45);
    box-shadow: none;
}
.slot.selected .slot-places-tag::before {
    background: #fff;
}

/* ── Form panel ── */
.form-panel {
    background: var(--white);
    border: 1px solid var(--grey-200);
    border-radius: var(--radius);
    padding: 28px 24px;
    margin-top: 24px;
    display: none;
}
.form-panel.visible { display: block; }
.form-panel.inline-after-day {
    margin-top: 10px;
    margin-bottom: 16px;
    border-color: #c8e8eb;
    box-shadow: 0 8px 20px rgba(57, 57, 57, 0.06);
}
.form-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.form-panel-header h3 {
    font-size: 1em;
    font-weight: 700;
    color: var(--grey-900);
    margin-bottom: 0;
}
.btn-close-panel {
    background: none;
    border: none;
    font-size: 1.3em;
    line-height: 1;
    color: var(--grey-400);
    cursor: pointer;
    padding: 0 2px;
}
.btn-close-panel:hover { color: var(--grey-900); }

.slot-badge {
    display: inline-block;
    padding: 8px 14px;
    background: var(--teal-light);
    border: 1px solid #c8e8eb;
    color: var(--teal-dark);
    font-size: 0.85em;
    font-weight: 600;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.field-label {
    display: block;
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--grey-600);
    margin-bottom: 6px;
}
.field-label .req { color: var(--rose); }

.field-input {
    width: 100%;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 0.93em;
    color: var(--grey-900);
    border: 1.5px solid var(--grey-200);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s;
}
.field-input::placeholder { color: var(--grey-400); }
.field-input:focus {
    outline: none;
    border-color: var(--teal);
}
.field-input:focus-visible,
.btn:focus-visible,
.slot:focus-visible {
    outline: 3px solid rgba(71, 169, 179, 0.28);
    outline-offset: 1px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    font-family: inherit;
    font-size: 0.93em;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.15s ease;
}
.btn-primary {
    background: var(--rose);
    color: var(--white);
}
.btn-primary:hover { background: var(--rose-dark); }
.btn-secondary {
    background: var(--white);
    color: var(--grey-900);
    border: 1.5px solid var(--grey-200);
}
.btn-secondary:hover {
    border-color: var(--grey-400);
    background: var(--grey-50);
}
.btn-primary:disabled {
    background: var(--grey-400);
    cursor: not-allowed;
}

.form-panel .btn-primary {
    min-width: 260px;
}

@media (max-width: 640px) {
    .form-panel {
        padding: 22px 18px;
    }
    .form-panel .btn-primary {
        width: 100%;
        min-width: 0;
    }
}

/* ── Messages ── */
.success {
    background: var(--teal-light);
    border: 1.5px solid #b0dce1;
    color: #2a7d86;
    padding: 24px;
    border-radius: var(--radius);
    text-align: center;
    margin-top: 24px;
    display: none;
}
.success h3 { font-size: 1.05em; font-weight: 700; margin-bottom: 6px; color: var(--teal-dark); }
.success p { font-size: 0.9em; }
.success .btn { margin-top: 14px; }

.error {
    background: var(--rose-light);
    border: 1.5px solid #f5b5c4;
    color: #b91c38;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85em;
    margin-top: 12px;
    display: none;
}

.status-info {
    display: none;
    margin-bottom: 16px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid #b8dfe3;
    background: var(--teal-light);
    color: var(--teal-dark);
    font-size: 0.88em;
    font-weight: 500;
}

.empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--grey-400);
    font-size: 0.95em;
}

.slot-names {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, max-height 0.2s ease;
}
.slot-wrap:hover .slot-names,
.slot-wrap:focus-within .slot-names,
.slot.selected + .slot-names {
    opacity: 1;
    max-height: 320px;
    pointer-events: auto;
}

.slot-name-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid var(--grey-200);
    background: var(--grey-50);
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    position: relative;
}

.slot-name-text {
    font-size: 0.78em;
    color: var(--grey-600);
    line-height: 1.2;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    flex: 1;
}

.slot-name-item {
    transition: border-color 0.15s ease, background 0.15s ease;
}
.slot-name-item:hover {
    border-color: #f5b5c4;
    background: var(--rose-light);
}

.slot-name-delete {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translate(4px, -50%);
    border: 1px solid #f5b5c4;
    background: #fff;
    color: #b91c38;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.7em;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 2;
}
.slot-name-item:hover .slot-name-delete,
.slot-name-item:focus-within .slot-name-delete {
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, -50%);
}
.slot-name-item.touch-active .slot-name-delete {
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, -50%);
}
.slot-name-item-can-delete {
    cursor: pointer;
}
.slot-name-delete:hover {
    background: #fbd5df;
}
.slot-name-delete:disabled {
    opacity: 0.65;
    pointer-events: none;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 900px) {
    .slot-wrap {
        width: calc((100% - 12px) / 2);
    }
}

@media (max-width: 640px) {
    .slot-wrap {
        width: 100%;
    }
    .slot-wrap .slot-names {
        opacity: 1;
        max-height: 320px;
        pointer-events: auto;
    }
}

/* ── Tag visio (front) ── */
.tag-visio-front {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7em;
    font-weight: 600;
    background: #eef2ff;
    color: #4f46e5;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: 0.02em;
}

/* ── Modale de confirmation ── */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}
.confirm-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px 28px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.confirm-box p {
    font-size: 0.97em;
    color: var(--grey-900);
    margin-bottom: 20px;
    line-height: 1.5;
}
.reservation-success-box {
    max-width: 460px;
}
.reservation-success-title {
    font-size: 1.08em;
    margin: 0 0 10px;
    color: var(--teal-dark);
}
.reservation-success-text {
    margin-bottom: 12px !important;
}
.reservation-recap {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #c8e8eb;
    background: linear-gradient(180deg, #f2fbfc 0%, #ecf6f7 100%);
}
.reservation-recap-label {
    font-size: 0.74em;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--teal-dark);
    margin-bottom: 5px;
}
.reservation-recap-when {
    font-size: 1.03em;
    font-weight: 800;
    line-height: 1.35;
    color: var(--grey-900);
}
.reservation-recap-where {
    margin-top: 6px;
    font-size: 0.86em;
    color: var(--grey-600);
}
.reservation-recap-visio {
    display: inline-flex;
    margin-top: 8px;
    font-size: 0.86em;
    font-weight: 700;
    color: var(--teal-dark);
    text-decoration: none;
}
.reservation-recap-visio:hover {
    text-decoration: underline;
}
.reservation-success-helper {
    margin: 0 0 12px;
    font-size: 0.86em;
    color: var(--grey-600);
}
.reservation-success-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}
.reservation-success-actions .btn-confirm-ok,
.reservation-success-actions .btn-confirm-cancel {
    text-decoration: none;
}
.btn-calendar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 10px;
    padding: 9px 14px;
    border: 1px solid transparent;
    font-size: 0.9em;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn-calendar:hover {
    transform: translateY(-1px);
}
.btn-calendar-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    font-size: 0.92em;
}
.btn-calendar-google {
    background: linear-gradient(135deg, #0f9d58, #34a853);
    color: #fff;
    box-shadow: 0 5px 14px rgba(15, 157, 88, 0.28);
}
.btn-calendar-google:hover {
    background: linear-gradient(135deg, #0b8a4d, #2d944a);
}
.btn-calendar-ical {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e3a8a;
}
.btn-calendar-ical:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}
.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.btn-confirm-cancel {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--grey-200);
    background: var(--white);
    color: var(--grey-600);
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}
.btn-confirm-cancel:hover { background: var(--grey-100); }
.btn-confirm-ok {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--rose);
    color: var(--white);
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.btn-confirm-ok:hover { background: var(--rose-dark); }

@media (max-width: 640px) {
    .reservation-success-actions {
        flex-direction: column;
    }
    .reservation-success-actions .btn-confirm-ok,
    .reservation-success-actions .btn-confirm-cancel {
        width: 100%;
        text-align: center;
    }
}

/* ── Footer ── */
.page-footer {
    text-align: center;
    padding: 20px;
    font-size: 0.75em;
    color: var(--grey-400);
}
