/* psy-survey : style public, mobile-first */

:root {
    --color-bg:            #f3f4f6;
    --color-card:          #ffffff;
    --color-text:          #1f2937;
    --color-muted:         #6b7280;
    --color-border:        #e5e7eb;
    --color-primary:       #2563eb;
    --color-primary-light: #eff6ff;
    --color-primary-hover: #1d4ed8;
    --color-likert-hover:  #f0fdf4;
    --color-likert-text:   #16a34a;
    --color-error-bg:      #fef2f2;
    --color-error-text:    #991b1b;
    --color-error-border:  #fecaca;
    --radius:  8px;
    --shadow:  0 1px 4px rgba(0,0,0,0.07);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
}

.container {
    max-width: 740px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

/* ── Typographie ── */
h1 { font-size: 1.6rem; margin: 0 0 0.5rem; }
header { margin-bottom: 1.5rem; }
header p { color: var(--color-muted); margin: 0; }

/* ── Sélecteur de langue ── */
.lang-switch {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
    margin-bottom: 1rem;
}
.lang-switch a {
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--color-muted);
    font-size: 0.82rem;
    font-weight: 500;
}
.lang-switch a.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* ── Alertes ── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.alert.error {
    background: var(--color-error-bg);
    color: var(--color-error-text);
    border: 1px solid var(--color-error-border);
}

/* ── Fieldset ── */
fieldset {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.25rem 0.5rem;
    margin: 0 0 1.25rem;
    box-shadow: var(--shadow);
}
legend {
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
    padding: 0 0.4rem;
}

/* ── Question ── */
.question {
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
}
.question:last-child { border-bottom: none; padding-bottom: 0.25rem; }

.q-text {
    margin: 0 0 0.75rem;
    font-weight: 500;
    line-height: 1.45;
}

/* ── Select (variables de segmentation) ── */
label.q-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.4rem;
}
select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #fff;
    font-size: 1rem;
    color: var(--color-text);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
    cursor: pointer;
    transition: border-color 0.15s;
}
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* ── Radio-cards et checkbox-cards ── */
.opt-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    margin: 0.35rem 0;
    font-weight: normal;
    background: #fff;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}
.opt-card input {
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--color-primary);
    width: 1.1em;
    height: 1.1em;
}
.opt-card:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}
.opt-card:has(input:checked) {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

/* ── Échelle Likert ── */
.likert-wrap { margin-top: 0.5rem; }

.likert {
    display: flex;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
}

.likert-cell {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    cursor: pointer;
    border-right: 1px solid var(--color-border);
    background: #fff;
    transition: background 0.12s;
    margin: 0;
    font-weight: normal;
    user-select: none;
}
.likert-cell:last-child { border-right: none; }

.likert-cell input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.likert-cell .num {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-muted);
    transition: color 0.12s;
    pointer-events: none;
}

.likert-cell:hover { background: var(--color-primary-light); }
.likert-cell:hover .num { color: var(--color-primary); }

.likert-cell:has(input:checked) { background: var(--color-primary); }
.likert-cell:has(input:checked) .num { color: #fff; }

/* Tooltip CSS */
.likert-cell[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 400;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 100;
    max-width: 220px;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
}
.likert-cell[data-tooltip]:hover::after { opacity: 1; }

/* Labels extrêmes */
.likert-ends {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--color-muted);
    margin-top: 0.3rem;
    padding: 0 2px;
}

/* ── Bouton submit ── */
.btn-primary {
    display: block;
    width: 100%;
    padding: 0.9rem 1rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: background 0.15s;
}
.btn-primary:hover { background: var(--color-primary-hover); }

/* ── Page de remerciement ── */
.thanks {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow);
}

/* ── Mobile ── */
@media (max-width: 480px) {
    .likert-cell { min-height: 48px; }
    .likert-cell .num { font-size: 1rem; }
    .likert-cell[data-tooltip]::after { display: none; }
    .likert-ends { font-size: 0.72rem; }
}
