/* ============================================================
   Anagrafica Bimbi (FASE 08) - layout moderno coerente
   con il design system Chronos.
   ============================================================ */

/* ========== Toolbar (search + filtri stato + add) ========== */
.children-toolbar {
    background: #ffffff;
    border: 1px solid #e3ece0;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 2px 6px rgba(69, 130, 58, 0.05);
}

/* Filtri stato a pillole (radio nascosti, label = pillola cliccabile) */
.children-status-filters {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.children-status-filters input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.children-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    user-select: none;
    border: 1px solid transparent;
}
.children-status-pill .material-symbols-outlined {
    font-size: 1.05rem !important;
}
.children-status-pill:hover {
    background: var(--color-border);
    color: var(--color-text);
}
.children-status-filters input[type="radio"]:checked + .children-status-pill {
    background: linear-gradient(135deg, var(--section-d) 0%, var(--section-l) 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 2px 4px var(--section-ring);
}
.children-status-filters input[type="radio"]:focus-visible + .children-status-pill {
    outline: 2px solid var(--section-l);
    outline-offset: 2px;
}

/* Slot azioni toolbar (Nuovo bimbo + back-to-grid) */
.children-toolbar-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

/* Pulsante Nuovo bimbo - colore brand (palette unica del portale) */
.btn-children-add {
    background: linear-gradient(135deg, var(--section-d) 0%, var(--section-l) 100%);
    border: none;
    color: #ffffff;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 6px var(--section-ring);
}
.btn-children-add:hover {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--section-d) 100%);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px var(--section-ring);
}
.btn-children-add .material-symbols-outlined {
    font-size: 1.15rem !important;
}

/* ========== Meta sopra alla tabella (badge totale) ========== */
.children-grid-meta {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 6px;
}
.children-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--section-ring);
    color: var(--section-d);
    border: 1px solid var(--section-ring);
    border-radius: 999px;
    padding: 4px 12px;
    font-weight: 700;
    font-family: TitilliumWeb-Bold, sans-serif;
}
.children-count-badge .material-symbols-outlined {
    font-size: 1.1rem !important;
    color: var(--section-d);
}
.children-count-label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 600;
}

/* ========== Riga bimbo ========== */
.children-container .row.record {
    border-radius: 8px;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.children-container .row.record:hover {
    box-shadow: 0 4px 10px rgba(69, 130, 58, 0.10);
}

/* Avatar (iniziali) */
.children-name-cell {
    display: flex !important;
    align-items: center;
    gap: 12px;
}
.children-avatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--section-d) 0%, var(--section-l) 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: TitilliumWeb-Bold, sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.10);
}
.children-name-text {
    flex: 1 1 auto;
    min-width: 0;
}
.children-name-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}
.children-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    line-height: 1.4;
}
.children-tag .material-symbols-outlined {
    font-size: 0.95rem !important;
}
.children-tag.tag-allergy {
    background: #fee2e2;
    color: #991b1b;
}
.children-tag.tag-birthday {
    background: linear-gradient(135deg, #fde68a 0%, #fbbf24 100%);
    color: #78350f;
}
.children-tag.tag-enrollment-pending {
    background: #fef3c7;
    color: #92400e;
}
.children-tag.tag-enrollment-rejected {
    background: #fee2e2;
    color: #991b1b;
}
.children-tag.tag-enrollment-withdrawn {
    background: #f3f4f6;
    color: #4b5563;
}

.children-text-muted {
    color: var(--color-text-muted);
}

.children-age-badge {
    display: inline-block;
    background: #f1f7ee;
    color: #2f4f29;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    border: 1px solid #d4e9d1;
}

/* Stato attivo / storico - centrato in cella 36x36 */
.children-active-on,
.children-active-off {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    line-height: 1;
}
.children-active-on .material-symbols-outlined {
    color: var(--color-brand-text);
    font-size: 1.4rem !important;
}
.children-active-off .material-symbols-outlined {
    color: #9ca3af;
    font-size: 1.4rem !important;
}

/* Link "storico accessi" - icon button 36x36 centrato */
.children-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--color-brand-text);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    line-height: 1;
}
.children-action-link:hover {
    background-color: #d4e9d1;
    color: #1d5313;
}

/* Riga bambino storico (active=False) */
.children-container .row.record.is-inactive {
    opacity: 0.65;
    background-color: #fafbfc !important;
}
.children-container .row.record.is-inactive:hover {
    opacity: 1;
}

/* Riga compleanno: accent oro/giallo */
.children-container .row.record.is-birthday {
    background-color: #fffbeb !important;
    border-left: 3px solid #f59e0b;
}

/* Icone azione - icon button 32x32 centrato (colonna Azioni: dettaglio,
   modifica, elimina) */
.children-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    line-height: 1;
    color: #6b7280;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.children-action-icon:hover {
    background-color: #f3f4f6;
    color: #111827;
}
.children-actions-cell {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 2px;
}
.children-action-icon.action-delete {
    color: #b91c1c;
}
.children-action-icon.action-delete:hover {
    background-color: #fee2e2;
    color: #7f1d1d;
}

/* Scheda dettaglio (modal icona occhio) */
.children-detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    margin: 0;
}
.children-detail-list dt {
    color: #6b7280;
    font-weight: 600;
    font-size: 0.85rem;
}
.children-detail-list dd {
    margin: 0;
}
.children-detail-list-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Empty state */
.children-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
    background: #fafbfc;
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    margin-top: 20px;
}
.children-empty-state .material-symbols-outlined {
    font-size: 3.5rem !important;
    display: block;
    margin-bottom: 8px;
    opacity: 0.6;
}

/* ============================================================
   Griglia semplificata: sottoriga età·città, tendina abbonamento,
   contatori servizi/tutori
   ============================================================ */
.children-container .row.children-row {
    align-items: center;
    padding-top: 6px;
    padding-bottom: 6px;
}
.children-subline {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.3;
}
.children-subline-sep {
    margin: 0 5px;
}
.children-tag.tag-inactive {
    background: #f3f4f6;
    color: #4b5563;
}

/* Tendina abbonamento */
.children-subscription-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.child-subscription-select {
    min-width: 0;
    flex: 1 1 auto;
    cursor: pointer;
}
.child-subscription-select.is-empty {
    border-color: #f59e0b;
    background-color: #fffbeb;
    color: #92400e;
}
.children-subscription-status {
    flex: 0 0 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.children-subscription-status .material-symbols-outlined {
    font-size: 1.25rem !important;
}
.children-subscription-status.is-saved { color: var(--color-brand-text); }
.children-subscription-status.is-error { color: #b91c1c; cursor: help; }
.children-subscription-status.is-saving { color: var(--color-text-muted); }

/* Contatori servizi / tutori */
.children-counters-cell {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.children-counter {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 9px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 700;
    font-size: 0.82rem;
}
.children-counter .material-symbols-outlined {
    font-size: 1rem !important;
}
.children-counter.is-missing {
    background: #fef3c7;
    color: #92400e;
}
.children-actions-cell a.children-action-icon {
    text-decoration: none;
}

/* Mobile: ogni riga diventa una scheda */
.children-cell-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-muted);
    font-weight: 600;
    margin-bottom: 2px;
}
@media (max-width: 767.98px) {
    .children-container .row.children-row {
        border: 1px solid #e5e7eb;
        margin: 0 0 10px 0;
        padding: 10px 6px;
        row-gap: 8px;
    }
    .children-counters-cell,
    .children-actions-cell {
        justify-content: flex-start !important;
    }
    .children-counters-cell {
        display: inline-flex !important;
        width: auto;
    }
    .children-actions-cell {
        width: auto;
        margin-left: auto;
    }
}

/* ============================================================
   Form modifica bimba/o: schede, fisarmoniche, barra salvataggio
   ============================================================ */
.child-form {
    padding-top: 4px;
}
.child-form-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 4px 0 16px;
}
.child-form-avatar {
    width: 48px;
    height: 48px;
    font-size: 1rem;
}
.child-form-title {
    font-family: TitilliumWeb-Bold, sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.2;
}
.child-form-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}
.child-form-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.child-form-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--color-text);
}
.child-form-card-title .material-symbols-outlined {
    font-size: 1.25rem !important;
    color: var(--section-d);
}
.child-form .form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 3px;
}
.child-form-switches {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}
.child-form-switches .form-check-label small {
    display: block;
    color: var(--color-text-muted);
    font-size: 0.76rem;
}

/* Fisarmoniche */
.child-form-collapsible {
    padding: 0;
}
.child-collapsible-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    padding: 14px 18px;
    text-align: left;
    font-weight: 700;
    color: var(--color-text);
    border-radius: 12px;
}
.child-collapsible-toggle:hover {
    background: #fafafa;
}
.child-collapsible-toggle:focus-visible {
    outline: 2px solid var(--section-l);
    outline-offset: -2px;
}
.child-collapsible-icon {
    color: var(--section-d);
    font-size: 1.3rem !important;
}
.child-collapsible-title {
    flex: 1 1 auto;
}
.child-collapsible-chevron {
    transition: transform 0.2s ease;
    color: var(--color-text-muted);
}
.child-form-collapsible.is-open .child-collapsible-chevron {
    transform: rotate(180deg);
}
.child-form-collapsible.is-open .child-collapsible-toggle {
    border-bottom: 1px solid #f0f0f0;
    border-radius: 12px 12px 0 0;
}
.child-collapsible-body {
    padding: 12px 18px 16px;
}

/* Messaggio esito salvataggio + barra fissa in basso */
.child-form-message:empty {
    display: none;
}
.child-form-message {
    margin-bottom: 12px;
}
.child-form-savebar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 16px;
    margin: 0 -4px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    border-top: 1px solid #e5e7eb;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
}
.child-form-savebar .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
@media (max-width: 575.98px) {
    .child-form-savebar .btn { flex: 1 1 0; justify-content: center; }
}

/* ============================================================
   Form bimba/o: neutralizza le vecchie regole globali di site.css
   (header grigi/hover arancione, contenitori verdi)
   ============================================================ */
.child-form .child-collapsible-toggle.add-allergies-list-service,
.child-form .child-collapsible-toggle.add-price-list-service,
.child-form .child-collapsible-toggle.add-parents-guardians {
    background: transparent;
    text-align: left;
    color: var(--color-text);
    padding: 14px 18px;
}
.child-form .child-collapsible-toggle.add-allergies-list-service:hover,
.child-form .child-collapsible-toggle.add-price-list-service:hover,
.child-form .child-collapsible-toggle.add-parents-guardians:hover {
    background: #f9fafb;
    color: var(--color-text);
}
.child-form .child-collapsible-toggle .badge {
    min-width: 26px;
    font-size: 0.75rem;
}
.child-form .parents-guardians-container {
    background: transparent;
    padding: 0;
    border-radius: 0;
}
.child-form .parents-guardians-container + .parents-guardians-container {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #e5e7eb;
}

/* Bottoni con icona: icona e testo centrati, niente testo che esce */
.child-form .btn,
.child-form-savebar .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    line-height: 1.2;
    padding: 9px 18px;
    border-radius: 8px;
    font-weight: 600;
}
.child-form .btn .material-symbols-outlined {
    font-size: 1.2rem !important;
    line-height: 1;
    vertical-align: 0;
}

/* ========== Liste nelle sezioni (allergie, servizi, genitori) ========== */
.child-list {
    display: flex;
    flex-direction: column;
}
.child-list-hint {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin: 0 0 10px;
}
.child-list-group {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 14px 0 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
}
.child-list-group:first-of-type {
    margin-top: 0;
}
.child-list-group-note {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: #9ca3af;
}
.child-list-row {
    display: block;
    border: 1px solid #eef0f3;
    border-radius: 10px;
    background: #ffffff;
    margin-bottom: 6px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.child-list-main {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    min-height: 46px;
}
.child-list-main > .form-check-input {
    flex: 0 0 auto;
    margin: 0;
    width: 1.15em;
    height: 1.15em;
    cursor: pointer;
}
.child-list-label {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    cursor: pointer;
    line-height: 1.3;
}
.child-list-label small {
    display: block;
    color: var(--color-text-muted);
    font-size: 0.78rem;
}
.child-list-selectable {
    cursor: pointer;
}
.child-list-selectable:hover,
.child-list-row.allergie-row:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}
/* Riga selezionata: tinta leggera del brand */
.child-list-row.allergie-row-active,
.child-list-row.children-service-price:has(input:checked) {
    background: var(--section-tint);
    border-color: var(--section-ring);
}
.child-list-price {
    flex: 0 0 auto;
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.child-list-price small {
    display: block;
    font-weight: 400;
    font-size: 0.72rem;
    color: var(--color-text-muted);
}
.child-list-price.is-missing {
    font-weight: 500;
    font-size: 0.78rem;
    color: #9ca3af;
}

/* Allergie: interruttore "Grave" + info */
.child-list-severe {
    flex: 0 0 auto;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 2.6em;
    font-size: 0.82rem;
    color: #6b7280;
}
.child-list-severe .form-check-input:checked {
    background-color: #dc2626;
    border-color: #dc2626;
}
.child-list-severe .form-check-input:checked + .form-check-label {
    color: #b91c1c;
    font-weight: 700;
}
.child-list-note {
    padding: 0 12px 10px 42px;
    font-size: 0.82rem;
    color: #4b5563;
}
.child-list-note.h-limit {
    display: none;
}

/* Bottone icona tondo 36x36 (info, chiudi, rimuovi relazione) */
.child-list-iconbtn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    line-height: 1;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.child-list-iconbtn .material-symbols-outlined {
    font-size: 1.25rem !important;
    line-height: 1;
}
.child-list-iconbtn:hover,
.child-list-iconbtn.is-active {
    background: #f3f4f6;
    color: #111827;
}
.child-list-iconbtn.is-danger:hover {
    background: #fee2e2;
    color: #b91c1c;
}

/* Genitori */
.child-list-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.7rem;
}
.child-list-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 0.75rem;
    font-weight: 700;
}
.child-list-chip .material-symbols-outlined {
    font-size: 0.95rem !important;
}
.child-parents-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 8px;
}
.child-form .child-list-add {
    margin-top: 10px;
    align-self: flex-start;
    padding: 6px 14px;
}
.child-list-empty {
    padding: 16px;
    text-align: center;
    color: #9ca3af;
    border: 1px dashed #e5e7eb;
    border-radius: 10px;
}

@media (max-width: 575.98px) {
    .child-list-main { flex-wrap: wrap; }
    .child-list-severe { padding-left: 2.6em; }
}

/* site.css: .view-all-allergy/.icon-allergy pensati per la vecchia griglia */
.child-form .view-all-allergy,
.child-form .view-all-allergy:hover {
    border: none;
    text-align: center;
}
