/* RegenSuivi - styles applicatifs
   Complete le CSS Bootstrap fourni par le template. */

/* ---------------------------------------------------------------- generique */

.toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0 1.25rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1 1 20rem;
    max-width: 28rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-size: 1rem;
}

.search-input:focus,
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.muted { color: #6c757d; font-size: 0.9rem; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-head h1 { margin-bottom: 0.25rem; }

/* ---------------------------------------------------------------- boutons */

.btn-primary, .btn-plain, .btn-danger-plain {
    padding: 0.4rem 0.9rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.btn-primary { background: #0d6efd; color: #fff; border-color: #0d6efd; }
.btn-primary:hover:not(:disabled) { background: #0b5ed7; }
.btn-plain { background: #fff; color: #212529; border-color: #ced4da; }
.btn-plain:hover { background: #f8f9fa; }
.btn-danger-plain { background: transparent; color: #b02a37; border-color: transparent; }
.btn-danger-plain:hover { text-decoration: underline; }

button:disabled { opacity: 0.45; cursor: default; }

/* ---------------------------------------------------------------- tableaux */

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

table.grid th, table.grid td {
    text-align: left;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #e9ecef;
}

table.grid th {
    font-weight: 600;
    color: #495057;
    border-bottom-width: 2px;
    white-space: nowrap;
}

table.grid tbody tr:hover { background: #f8f9fa; }
table.grid tbody tr.clickable { cursor: pointer; }

.pager { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }

.pager button {
    padding: 0.35rem 0.9rem;
    border: 1px solid #ced4da;
    background: #fff;
    border-radius: 0.375rem;
    cursor: pointer;
}

/* ---------------------------------------------------------------- messages */

.alert-error, .alert-info {
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    max-width: 48rem;
    margin: 1rem 0;
}

.alert-error { border: 1px solid #f5c2c7; background: #f8d7da; color: #842029; }
.alert-info  { border: 1px solid #b6d4fe; background: #cfe2ff; color: #084298; }

.alert-error p, .alert-info p { margin: 0.5rem 0 0.75rem; }

.alert-error button {
    padding: 0.35rem 0.9rem;
    border: 1px solid #842029;
    background: transparent;
    color: #842029;
    border-radius: 0.375rem;
    cursor: pointer;
}

.form-error { color: #b02a37; font-size: 0.9rem; margin: 0.5rem 0; }
.warn { color: #b5820a; font-size: 0.85rem; margin-top: 0.35rem; }

/* ---------------------------------------------------------------- badges */

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-ok    { background: #d1e7dd; color: #0f5132; }
.badge-draft { background: #fff3cd; color: #664d03; }
.badge-muted { background: #e9ecef; color: #495057; }

/* ---------------------------------------------------------------- formulaires */

.card-form, .block {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin: 1rem 0;
    background: #fff;
}

.card-form label, .question-editor label:not(.check) {
    display: block;
    margin-bottom: 0.85rem;
    font-size: 0.9rem;
    color: #495057;
}

.card-form input, .card-form select,
textarea, .question-editor input, .question-editor select {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-actions { display: flex; gap: 0.75rem; margin-top: 0.5rem; }

.inline-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.inline-form input, .inline-form select { width: auto; margin-top: 0; }
.inline-form .grow { flex: 1 1 18rem; }
.full { width: 100%; margin-bottom: 0.75rem; }

.check {
    display: flex !important;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    margin: 0 !important;
}

.check input { width: auto; margin: 0; }

/* ---------------------------------------------------------------- questionnaire */

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.section-head h3 { margin: 0 0 0.75rem; }

ol.questions { padding-left: 1.25rem; margin: 0 0 1rem; }
ol.questions > li { margin-bottom: 0.85rem; }

.question-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.type-tag {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.5rem;
    background: #e9ecef;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    color: #495057;
}

.required { color: #b02a37; margin-left: 0.2rem; font-weight: 700; }
.help { font-size: 0.85rem; color: #6c757d; margin-top: 0.2rem; }

ul.choices {
    margin: 0.35rem 0 0;
    padding-left: 1.1rem;
    font-size: 0.88rem;
    color: #495057;
}

.question-editor {
    border-top: 1px dashed #dee2e6;
    padding-top: 1rem;
    margin-top: 0.5rem;
}

.choices-editor { margin-bottom: 0.75rem; }

.hint {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 0.35rem 0 0;
}

.hint-ok   { color: #0f5132; }
.hint-warn { color: #b5820a; }

.form-actions .hint { align-self: center; margin: 0; }

/* ---------------------------------------------------------------- saisie */

.save-bar {
    display: flex;
    align-items: center;
    min-height: 1.6rem;
    margin: 0.5rem 0 1rem;
}

.intro-block {
    background: #f8f9fa;
    font-style: italic;
    color: #495057;
}

.question-block {
    padding: 0.85rem 1rem;
    border-left: 3px solid transparent;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
}

.question-block.missing {
    border-left-color: #b02a37;
    background: #fdf3f4;
}

.question-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.answer-field input[type="text"],
.answer-field input[type="number"],
.answer-field input[type="date"],
.answer-field textarea {
    width: 100%;
    max-width: 32rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-family: inherit;
}

.answer-field .options {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.25rem;
}

.answer-field .option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* Cible tactile confortable : cet ecran est utilise sur iPad, debout. */
    min-height: 2.5rem;
    cursor: pointer;
}

.answer-field .option input {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
}

.version-tag {
    margin-left: 0.4rem;
    padding: 0.05rem 0.4rem;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

/* ---------------------------------------------------------------- signatures */

.signature-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.signature-slot {
    flex: 1 1 20rem;
    min-width: 18rem;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 0.9rem;
}

.signature-slot-title {
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.signature-empty {
    padding: 1.75rem 0;
    text-align: center;
    color: #adb5bd;
    font-style: italic;
    border: 1px dashed #dee2e6;
    border-radius: 0.375rem;
    margin-bottom: 0.7rem;
}

.signature-image {
    display: block;
    width: 100%;
    max-width: 20rem;
    border-bottom: 1px solid #212529;
    margin-bottom: 0.4rem;
}

.signature-caption {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.signature-pad {
    border: 1px solid #ced4da;
    border-radius: 0.5rem;
    padding: 0.7rem;
    background: #fff;
}

.signature-pad-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.signature-canvas {
    display: block;
    width: 100%;
    height: 180px;
    background: #fdfdfe;
    border: 1px dashed #ced4da;
    border-radius: 0.375rem;
    /* Indispensable au tactile : sans cette regle, le geste de trace fait defiler
       la page au lieu de dessiner. */
    touch-action: none;
    cursor: crosshair;
}

.signature-pad-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}

.publish-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 0 2rem;
}

/* --- Zone dangereuse : suppression et effacement -------------------------
   Visuellement mise a l'ecart du reste. Ces actions sont irreversibles et ne
   doivent pas se cliquer par inadvertance en parcourant la page. */

.danger-block {
    border: 1px solid #f1c9c9;
    background: #fffafa;
}

.danger-block h3 {
    color: #a02020;
}

.danger-block .btn-danger,
.danger-block .btn-danger-plain {
    margin-right: 0.6rem;
}

.btn-danger {
    background: #b02a37;
    color: #fff;
    border: 1px solid #b02a37;
    border-radius: 0.375rem;
    padding: 0.45rem 0.9rem;
    cursor: pointer;
}

.btn-danger:disabled {
    background: #d9a1a7;
    border-color: #d9a1a7;
    cursor: not-allowed;
}

.badge-erased {
    background: #e9ecef;
    color: #6c757d;
}
