/* demo-share.css — Partage & documents du Carnet de Vie (Lot 6).
   Chargé dans l'app (variables --c-* garanties par demo-core.css). Bottom sheet,
   liste de liens, card de scan, toast undo, boutons de gestion des pièces jointes. */

/* ---------- Bouton Partager (header carnet) ---------- */
.health-view-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--c-bg-warm);
    border: 1px solid var(--c-border);
    color: var(--c-primary);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}
.health-view-share-btn:hover { background: var(--c-primary); color: var(--c-text-inverse); }
.health-view-share-btn:active { transform: scale(0.96); }

/* ---------- Bottom sheet ---------- */
.share-sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 9650;
    display: flex;
    align-items: center;      /* modale centrée (retour utilisateur : bottom-sheet « fait bizarre ») */
    justify-content: center;
    padding: 20px;
    background: rgba(19, 21, 22, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
}
.share-sheet-overlay.active { opacity: 1; pointer-events: auto; }

.share-sheet {
    width: 100%;
    max-width: 480px;
    max-height: min(88vh, 720px);
    overflow-y: auto;
    background: var(--c-bg-warm);
    border-radius: 20px;
    padding: 18px;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 12px 40px rgba(19, 21, 22, 0.25);
    -webkit-overflow-scrolling: touch;
}
.share-sheet-overlay.active .share-sheet { transform: translateY(0) scale(1); }

.share-sheet-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.share-sheet-title { flex: 1; font-size: 1.05rem; font-weight: 700; color: var(--c-text); }

.share-sheet-close, .share-sheet-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: none;
    border: none;
    color: var(--c-text-muted);
    cursor: pointer;
    flex-shrink: 0;
}
.share-sheet-close:hover, .share-sheet-back:hover { background: var(--c-bg-card); }

.share-sheet-sub { margin: 0 0 14px; font-size: 0.86rem; color: var(--c-text-secondary); line-height: 1.45; }
.share-sheet-note { margin: 14px 0 0; font-size: 0.78rem; color: var(--c-text-muted); }

/* ---------- Options de partage ---------- */
.share-opts { display: flex; flex-direction: column; gap: 10px; }

/* Bloc « carte-bilan » (partage image, distinct des liens read-only) : séparé du groupe
   ci-dessus (sinon « collé »). Rendu uniquement dans le shell (cf. demo-share.js). */
.share-opts--bilan { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--c-border-light); }

.share-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border-light);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.1s ease;
}
.share-opt:hover { border-color: var(--c-primary-soft); }
.share-opt:active { transform: scale(0.99); }

.share-opt-ico { font-size: 1.5rem; flex-shrink: 0; }
.share-opt-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.share-opt-title { font-size: 0.92rem; font-weight: 700; color: var(--c-text); }
.share-opt-desc { font-size: 0.78rem; color: var(--c-text-muted); line-height: 1.35; }
.share-opt-arrow { color: var(--c-text-muted); font-size: 1.3rem; flex-shrink: 0; }

/* ---------- Choix de période / durée (chips) ---------- */
.share-sheet-label {
    margin: 14px 0 8px;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--c-text-muted);
}
.share-chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.share-chip {
    flex: 1 1 auto;
    min-width: 68px;
    padding: 10px 12px;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--c-text);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.share-chip:hover { border-color: var(--c-primary-soft); }
.share-chip.active { border-color: var(--c-primary-soft); background: var(--c-primary-light); color: var(--c-primary); }

.share-create-btn {
    width: 100%;
    margin-top: 18px;
    padding: 13px 18px;
    background: var(--c-primary);
    color: var(--c-text-inverse);
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}
.share-create-btn:hover { background: var(--c-primary-hover); }
.share-create-btn:disabled { opacity: 0.6; cursor: default; }

/* ---------- Lien créé ---------- */
.share-url-row { display: flex; gap: 8px; margin-bottom: 12px; }
.share-url-input {
    flex: 1;
    min-width: 0;
    padding: 11px 12px;
    font-size: 16px; /* iOS anti-zoom */
    border: 1px solid var(--c-border);
    border-radius: 12px;
    background: var(--c-bg-card);
    color: var(--c-text);
}
.share-url-copy, .share-native-btn, .share-done-btn, .share-scan-create {
    padding: 11px 18px;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}
.share-url-copy { background: var(--c-primary); color: var(--c-text-inverse); flex-shrink: 0; }
.share-native-btn { width: 100%; background: var(--c-primary-light); color: var(--c-primary); margin-bottom: 10px; }
.share-done-btn { width: 100%; background: var(--c-bg-card); border: 1px solid var(--c-border); color: var(--c-text-secondary); }

/* ---------- Liens actifs ---------- */
.share-links { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--c-border); }
.share-links-title {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--c-text-muted);
    margin-bottom: 10px;
}
.share-link-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--c-border-light);
}
.share-link-ico { font-size: 1.15rem; flex-shrink: 0; }
.share-link-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.share-link-type { font-size: 0.85rem; font-weight: 600; color: var(--c-text); }
.share-link-meta { font-size: 0.74rem; color: var(--c-text-muted); }
.share-link-revoke {
    padding: 6px 12px;
    background: none;
    border: 1px solid var(--c-border);
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--c-danger);
    cursor: pointer;
    flex-shrink: 0;
}
.share-link-revoke:hover { background: var(--c-danger); color: var(--c-text-inverse); border-color: var(--c-danger); }

/* ---------- Scan de document ---------- */
.share-scan-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 28px 8px;
    justify-content: center;
    color: var(--c-text-secondary);
    font-size: 0.9rem;
}
.share-scan-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--c-border);
    border-top-color: var(--c-primary-soft);
    border-radius: 50%;
    animation: share-spin 0.8s linear infinite;
}
@keyframes share-spin { to { transform: rotate(360deg); } }

.share-scan-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
}
.share-scan-type { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.share-scan-badge {
    padding: 4px 12px;
    background: var(--c-primary-light);
    color: var(--c-primary);
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 700;
}
.share-scan-conf { font-size: 0.85rem; font-weight: 700; color: var(--c-text-muted); }
.share-scan-field { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--c-border-light); }
.share-scan-k { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-text-muted); }
.share-scan-v { font-size: 0.92rem; color: var(--c-text); }
.share-scan-disclaimer { margin: 0 0 12px; font-size: 0.76rem; color: var(--c-text-muted); line-height: 1.4; }
.share-scan-create { width: 100%; background: var(--c-primary); color: var(--c-text-inverse); margin-bottom: 8px; }
.share-scan-archive { width: 100%; padding: 11px 18px; background: var(--c-bg-card); border: 1px solid var(--c-border); border-radius: 12px; font-size: 0.9rem; font-weight: 600; color: var(--c-text-secondary); cursor: pointer; }
.share-scan-failed { text-align: center; padding: 20px 8px; }
.share-scan-failed p { color: var(--c-text-secondary); margin: 0 0 16px; }

/* ---------- Toast « Annuler » (undo 6s — B-6) ---------- */
.undo-toast {
    position: fixed;
    left: 50%;
    /* Décalé au-dessus des toasts globaux (bottom-center, z 9999) pour ne pas masquer
       le bouton « Annuler » quand les deux coexistent (revue Lot 6). */
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: min(420px, calc(100vw - 32px));
    padding: 12px 14px 12px 18px;
    background: var(--c-text);
    color: var(--c-text-inverse);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.undo-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.undo-toast-msg { font-size: 0.88rem; }
.undo-toast-btn {
    background: none;
    border: none;
    color: var(--c-primary-soft);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
    padding: 4px 6px;
}

/* ---------- Boutons de gestion des pièces jointes (B-6) ---------- */
.photo-tile-detach, .photo-tile-rename {
    position: absolute;
    top: 3px;
    left: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(19, 21, 22, 0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    padding: 0;
}
.photo-tile-detach:hover, .photo-tile-rename:hover { background: var(--c-primary); }

.photo-tile-rename-input {
    width: 100%;
    font-size: 12px;
    padding: 2px 4px;
    border: 1px solid var(--c-primary-soft);
    border-radius: 6px;
    background: var(--c-bg-card);
    color: var(--c-text);
}

/* Cible tactile : boutons toujours visibles sur mobile (pas de hover-only). */
@media (hover: none) and (pointer: coarse) {
    .photo-tile-detach, .photo-tile-rename { background: rgba(19, 21, 22, 0.55); }
}

@media (prefers-reduced-motion: reduce) {
    .share-sheet, .share-sheet-overlay, .undo-toast { transition: none; }
    .share-scan-spinner { animation-duration: 1.6s; }
}
