:root {
    --primary: #1d4ed8;
    --primary-dark: #1e3a8a;
    --bg: #f4f6fb;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --muted: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

.header-banner {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 32px 20px;
    border-radius: 0 0 18px 18px;
    margin-bottom: 24px;
}

.header-banner h1 {
    margin: 0 0 10px;
    font-size: 1.5rem;
}

.header-banner p {
    margin: 0;
    opacity: 0.95;
    font-size: 0.98rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card h2 {
    font-size: 1.05rem;
    color: var(--primary-dark);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--bg);
}

.question {
    margin-bottom: 18px;
}

.question > label.q-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    padding: 6px 0;
    cursor: pointer;
}

.options input[type="radio"],
.options input[type="checkbox"] {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    accent-color: var(--primary);
}

.q-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    appearance: auto;
}

.q-select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.autre-input {
    margin-left: 25px;
    margin-top: 4px;
    width: calc(100% - 25px);
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.92rem;
}

textarea, input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
}

textarea { min-height: 80px; resize: vertical; }

.submit-btn {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.submit-btn:hover { background: var(--primary-dark); }

.hint {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: -6px;
    margin-bottom: 10px;
}

/* --- Admin --- */

.admin-topbar {
    position: relative;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 18px 0;
    margin-bottom: 26px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Variante centrée utilisée sur le dashboard : gros titre centré + bouton en haut à droite */
.admin-topbar-center {
    padding: 28px 90px;
    text-align: center;
}

.admin-topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-brand-left {
    font-size: 1.15rem;
    font-weight: 700;
}

.admin-brand {
    margin: 0;
    font-size: 1.7rem;
    font-weight: 800;
}

.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.admin-actions form { display: inline; }

/* Bouton de déconnexion (ou retour) toujours en haut à droite, PC et mobile */
.admin-logout-form {
    position: absolute;
    top: 16px;
    right: 16px;
}

.admin-topbar .btn-secondary {
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.35);
    color: #fff;
}

.admin-topbar .btn-secondary:hover { background: rgba(255,255,255,0.26); }

.btn-secondary {
    display: inline-block;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-secondary:hover { background: var(--bg); }

/* Nouveau bouton "Voir tout" */
.btn-detail {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s;
    border: none;
    cursor: pointer;
}

.btn-detail:hover {
    background: var(--primary-dark);
    color: #fff;
}

.table-wrap {
    overflow-x: auto;
    background: var(--card);
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.85rem;
}

th, td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

th {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    position: sticky;
    top: 0;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    font-weight: 700;
}

/* Alternance des couleurs de lignes */
tbody tr:nth-child(odd) td { background: #ffffff; }
tbody tr:nth-child(even) td { background: #e6f0ff; }
tbody tr:hover td { background: #cfe2ff; }
tbody tr:last-child td { border-bottom: none; }

.empty-row {
    text-align: center;
    color: var(--muted);
    padding: 28px 12px;
}

.detail-link {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.detail-link:hover { background: var(--primary-dark); }

/* Tableau "Question / Réponse" de la page détail : pas de troncature de texte */
.detail-table td, .detail-table th {
    white-space: normal;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
}

.detail-table td:first-child {
    font-weight: 600;
    color: var(--muted);
    width: 280px;
}

/* Badges pour Oui/Non, niveaux de satisfaction, etc. */
.pill {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}

.pill-good { background: #dcfce7; color: #15803d; }
.pill-bad { background: #fee2e2; color: #b91c1c; }
.pill-warn { background: #fef3c7; color: #b45309; }
.pill-neutral { background: #f1f5f9; color: #64748b; }

.value-empty { color: #94a3b8; }

.stat-cards {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 26px;
    min-width: 190px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.stat-card .num { font-size: 1.6rem; font-weight: 700; color: var(--primary-dark); line-height: 1.1; }
.stat-card .label { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 24px;
}

.auth-card {
    background: var(--card);
    border-radius: 18px;
    padding: 40px 32px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    text-align: center;
}

.auth-icon {
    font-size: 2.2rem;
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    background: var(--bg);
    border-radius: 50%;
}

.auth-title {
    margin: 0 0 6px;
    font-size: 1.3rem;
    color: var(--primary-dark);
}

.auth-subtitle {
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 0.88rem;
}

.auth-form { text-align: left; }
.auth-form .q-label { margin-bottom: 6px; }

.password-field {
    position: relative;
    margin-bottom: 18px;
}

.password-field input {
    width: 100%;
    padding: 11px 44px 11px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
}

.password-field input:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
    border-color: var(--primary);
}

.toggle-password {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px;
    line-height: 1;
}

.auth-back {
    display: inline-block;
    margin-top: 18px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
}

.auth-back:hover {
    color: var(--primary);
    text-decoration: underline;
}

.error-msg {
    background: #fee2e2;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 0.9rem;
}

.success-msg {
    background: #dcfce7;
    color: var(--success);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 0.9rem;
}

/* Masquage conditionnel des questions/sections selon les réponses précédentes */
.hidden {
    display: none !important;
}

/* --- Responsive (smartphones) --- */
@media (max-width: 480px) {
    .header-banner { padding: 22px 16px; border-radius: 0 0 14px 14px; }
    .header-banner h1 { font-size: 1.25rem; }
    .header-banner p { font-size: 0.9rem; }

    .card { padding: 16px 14px; }
    .card h2 { font-size: 0.98rem; }

    .admin-topbar-center { padding: 24px 64px; }
    .admin-brand { font-size: 1.25rem; }
    .admin-topbar-inner { padding: 0 12px; }
    .admin-logout-form { top: 12px; right: 12px; }
    .admin-logout-form .btn-secondary { font-size: 0.78rem; padding: 6px 10px; }

    .stat-card { min-width: 100%; }

    th, td { padding: 9px 10px; font-size: 0.8rem; }

    .detail-table td:first-child { width: 45%; }

    .auth-card { padding: 30px 20px; }
}