/* Composants partagés : cases à cocher, interrupteurs, contrôle segmenté, couleurs, listes de propriétés, listes. */

/* ---------- Case à cocher / interrupteur ---------- */

.choice {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    cursor: pointer;
}

.choice.is-disabled { opacity: 0.55; cursor: not-allowed; }

.choice input {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--color-accent);
    cursor: inherit;
}

.choice-switch input { position: absolute; opacity: 0; pointer-events: none; }

.switch-track {
    position: relative;
    flex-shrink: 0;
    width: 32px;
    height: 18px;
    margin-top: 1px;
    border-radius: var(--radius-full);
    background: var(--color-border-strong);
    transition: background var(--duration) var(--ease-out);
}

.switch-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-xs);
    transition: transform var(--duration) var(--ease-out);
}

.choice-switch input:checked + .switch-track { background: var(--color-accent); }
.choice-switch input:checked + .switch-track::after { transform: translateX(14px); }
.choice-switch input:focus-visible + .switch-track { box-shadow: var(--focus-ring); }

.choice-text { display: flex; flex-direction: column; min-width: 0; }
.choice-label { font-weight: var(--weight-medium); }
.choice-description { font-size: var(--text-sm); color: var(--color-text-muted); }

/* ---------- Contrôle segmenté ---------- */

.segmented {
    display: inline-flex;
    max-width: 100%;
    overflow-x: auto;
    gap: 2px;
    padding: 3px;
    border-radius: var(--radius-md);
    background: var(--color-surface-sunken);
}

.segmented-option {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: calc(var(--control-height) - 6px);
    padding: 0 var(--space-4);
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-muted);
    font-weight: var(--weight-medium);
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}

.segmented-option:hover { color: var(--color-text); }

.segmented-option.is-selected {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}

/* ---------- Couleurs d'équipe ---------- */

.color-picker { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.color-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 2px solid var(--swatch-bg);
    border-radius: 50%;
    background: var(--swatch-bg);
    color: var(--swatch-fg);
    box-shadow: inset 0 0 0 7px var(--swatch-bg), inset 0 0 0 20px var(--swatch-fg);
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-out);
}

.color-swatch:hover { transform: scale(1.08); }
.color-swatch.is-selected { border-color: var(--swatch-fg); box-shadow: none; }

/* ---------- Liste de propriétés ---------- */

.property-list { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; }

.property-list-grid {
    display: grid;
    grid-template-columns: repeat(var(--property-columns), minmax(0, 1fr));
    gap: var(--space-4) var(--space-6);
}

.property-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.property-item dt { font-size: var(--text-xs); color: var(--color-text-subtle); font-weight: var(--weight-medium); }
.property-item dd { margin: 0; color: var(--color-text); overflow-wrap: anywhere; }

@media (max-width: 700px) {
    .property-list-grid { grid-template-columns: 1fr; }
}

/* ---------- Listes d'éléments (lignes cliquables) ---------- */

.item-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }

.item-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--row-padding-y) var(--space-5);
    border-top: 1px solid var(--color-border);
    color: inherit;
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease-out);
}

.item-list > li:first-child > .item-row { border-top: 0; }
a.item-row:hover, button.item-row:hover { background: var(--color-surface-hover); text-decoration: none; }

button.item-row { width: 100%; border-right: 0; border-bottom: 0; border-left: 0; background: transparent; text-align: left; cursor: pointer; }

.item-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.item-title { font-weight: var(--weight-medium); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.item-meta { font-size: var(--text-sm); color: var(--color-text-muted); }
.item-aside { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }

/* ---------- Encadrés d'information ---------- */

.callout {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: var(--text-sm);
}

.callout-warning { background: var(--color-warning-soft); color: var(--color-warning-text); }
.callout-info { background: var(--color-info-soft); color: var(--color-info-text); }
.callout-success { background: var(--color-success-soft); color: var(--color-success-text); }
.callout-danger { background: var(--color-danger-soft); color: var(--color-danger-text); }
.callout-neutral { background: var(--color-surface-subtle); border-color: var(--color-border); color: var(--color-text-muted); }
.callout strong { color: inherit; }

.item-list > li:first-child > .note-ligne { border-top: 0; }

/* ---------- Médicaments prescrits pendant une note (chronologie, note de suivi) ---------- */
.pastilles-medicaments { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }

.pastille-medicament {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    max-width: 100%;
    padding: 2px 10px;
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-full);
    background: var(--color-accent-soft);
    color: var(--color-accent-text);
    font-size: var(--text-xs);
}

.pastille-medicament svg { align-self: center; flex-shrink: 0; }
.pastille-nom { font-weight: var(--weight-semibold); }
.pastille-posologie { color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pastille-medicament.revoquee { border-color: var(--color-border-strong); background: transparent; color: var(--color-text-subtle); }
.pastille-medicament.revoquee .pastille-nom { text-decoration: line-through; }
