/* ==========================================================================
   Isaias 42 — Wizard frontend styles
   ========================================================================== */

/* Contenitore principale */
.isaias42-wizard {
    max-width: 680px;
    margin: 0 auto;
    font-size: 1rem;
    line-height: 1.5;
    color: inherit;
}

/* ── Notice (utente non autorizzato / nessuna chiesa) ─────────────────── */
.isaias42-notice {
    padding: 0.85rem 1.1rem;
    border-left: 4px solid #ccc;
    border-radius: 0 4px 4px 0;
    background: #f9f9f9;
    margin-bottom: 1.2rem;
}
.isaias42-notice-warning { border-color: #dba617; background: #fff8e5; }
.isaias42-notice-error   { border-color: #d63638; background: #fdf2f2; }

/* ── Indicatore step ──────────────────────────────────────────────────── */
.wizard-steps-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    user-select: none;
}

.wizard-step-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.35;
    transition: opacity 0.25s ease;
}
.wizard-step-indicator.active,
.wizard-step-indicator.completed {
    opacity: 1;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #8c8f94;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: background 0.25s ease;
}
.wizard-step-indicator.active    .step-number { background: #2271b1; }
.wizard-step-indicator.completed .step-number { background: #00a32a; }

.step-label {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.wizard-step-divider {
    flex: 1;
    height: 2px;
    background: #ddd;
    margin: 0 0.75rem;
}

/* ── Titolo e hint step ───────────────────────────────────────────────── */
.wizard-step-title {
    margin: 0 0 1.2rem;
    font-size: 1.15rem;
    font-weight: 700;
}
.wizard-step-hint {
    margin: -0.5rem 0 1.2rem;
    font-size: 0.9rem;
    color: #666;
}

/* ── Campi step 1 e step 3 ────────────────────────────────────────────── */
.wizard-field {
    margin-bottom: 1.1rem;
}
.wizard-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
}
.wizard-field select,
.wizard-field input[type="text"],
.wizard-field input[type="date"],
.wizard-field input[type="time"] {
    display: block;
    width: 100%;
    max-width: 380px;
    padding: 0.5rem 0.7rem;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 1rem;
    background: #fff;
    color: inherit;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.wizard-field select:focus,
.wizard-field input[type="text"]:focus,
.wizard-field input[type="date"]:focus,
.wizard-field input[type="time"]:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.25);
}

.wizard-field textarea {
    display: block;
    width: 100%;
    max-width: 560px;
    padding: 0.5rem 0.7rem;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    color: inherit;
    box-sizing: border-box;
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.wizard-field textarea:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.25);
}

.wizard-field-hint {
    font-size: 0.8rem;
    color: #666;
    margin: 0.3rem 0 0;
}

.wizard-required      { color: #d63638; }
.wizard-required-note { font-size: 0.8rem; color: #666; margin: 0.5rem 0 1.2rem; }

/* ── Azioni (pulsanti) ────────────────────────────────────────────────── */
.wizard-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}
.wizard-actions-step2,
.wizard-actions-step3 {
    justify-content: space-between;
    border-top: 1px solid #eee;
    padding-top: 1.2rem;
    margin-top: 1.5rem;
}
.wizard-actions-left,
.wizard-actions-right {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* ── Pulsanti ─────────────────────────────────────────────────────────── */
.isaias42-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1.1rem;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}
.isaias42-btn:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Primary */
.isaias42-btn-primary {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}
.isaias42-btn-primary:hover {
    background: #135e96;
    border-color: #135e96;
}

/* Secondary (aggiungi canto) */
.isaias42-btn-secondary {
    background: #f0f0f1;
    color: #2c3338;
    border-color: #8c8f94;
}
.isaias42-btn-secondary:hover {
    background: #dcdcde;
    border-color: #646970;
}

/* Danger (elimina) */
.isaias42-btn-danger {
    background: #fff1f1;
    color: #b42318;
    border-color: #fda29b;
}
.isaias42-btn-danger:hover {
    background: #ffe4e4;
    border-color: #f97066;
}

/* Outline (indietro) */
.isaias42-btn-outline {
    background: transparent;
    color: #2271b1;
    border-color: #2271b1;
}
.isaias42-btn-outline:hover {
    background: #f0f6fc;
}

/* Ghost (annulla) */
.isaias42-btn-ghost {
    background: transparent;
    color: #646970;
    border-color: transparent;
}
.isaias42-btn-ghost:hover {
    color: #d63638;
    text-decoration: underline;
}

/* Icona rimuovi riga */
.wizard-remove-song {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: #8c8f94;
    padding: 0.25rem;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 1.6rem;
    transition: color 0.15s ease;
}
.wizard-remove-song:hover { color: #d63638; }

/* ── Testo libero (riga canto) ────────────────────────────────────────── */

/* Il wrapper è già in colonna dentro .wizard-song-fields, nessun margin-top extra */
.wizard-song-freetext-wrap label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.wizard-song-freetext-wrap .song-free-text {
    width: 100%;
    padding: 0.42rem 0.6rem;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 0.95rem;
    background: #fff;
    color: inherit;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wizard-song-freetext-wrap .song-free-text:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.25);
}

.wizard-optional {
    font-weight: 400;
    color: #888;
    font-size: 0.85em;
    text-transform: none;
    letter-spacing: 0;
}

/* ── Quick edit: testo libero ─────────────────────────────────────────── */

.qe-freetext-wrap {
    padding: 0.4rem 1rem 0.6rem;
    background: #f9f9f9;
    border-top: 1px dashed #e0e0e0;
}

.qe-freetext-wrap .qe-song-free-text {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    box-sizing: border-box;
    background: #fff;
}

.qe-freetext-wrap .qe-song-free-text:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.15);
}


/* ── Handle drag-to-reorder ──────────────────────────────────────────── */
.wizard-drag-handle {
    flex-shrink: 0;
    align-self: center;
    font-size: 1.3rem;
    color: #b5b5b5;
    cursor: grab;
    padding: 0.2rem 0.1rem;
    line-height: 1;
    user-select: none;
    transition: color 0.15s ease;
}
.wizard-drag-handle:hover  { color: #646970; }
.wizard-drag-handle:active { cursor: grabbing; }

/* Placeholder visibile durante il drag */
.wizard-sort-placeholder {
    background: #e8f0fb;
    border: 2px dashed #2271b1;
    border-radius: 6px;
    visibility: visible !important;
    height: 60px;
    margin-bottom: 0.65rem;
}

/* Riga in fase di trascinamento */
.ui-sortable-helper.wizard-song-row {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    border-color: #2271b1;
}

/* ── Riga canto ───────────────────────────────────────────────────────── */
.wizard-song-row {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.9rem 1rem;
    margin-bottom: 0.65rem;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.wizard-song-row:hover { border-color: #b5b5b5; }

/* ── Raggruppamento visivo canti alternativi (stesso momento) ─────────── */

/* Sfondo e bordo comuni a tutte le righe del gruppo */
.wizard-row-same-moment {
    background: #fffbf0;
    border-color: #f0a500;
    border-width: 2px;
}
.wizard-row-same-moment:hover { border-color: #c88000; }

/* Prima riga: angoli arrotondati solo in alto, nessun bordo inferiore */
.wizard-row-group-first {
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    margin-bottom: 0;
}

/* Riga intermedia: nessun bordo superiore ne inferiore, nessun arrotondamento */
.wizard-row-group-middle {
    border-top: none;
    border-bottom: none;
    border-radius: 0;
    margin-bottom: 0;
}

/* Ultima riga: angoli arrotondati solo in basso, nessun bordo superiore */
.wizard-row-group-last {
    border-top: none;
    border-radius: 0 0 6px 6px;
    margin-top: 0;
}

/* Divisore "oppure" tra righe alternative dello stesso momento */
.wizard-oppure-divider {
    display: flex;
    align-items: center;
    padding: 0.28rem 1rem;
    margin: 0;
    border-left: 2px solid #f0a500;
    border-right: 2px solid #f0a500;
    background: #fffbf0;
}
.wizard-oppure-divider::before,
.wizard-oppure-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #f0a500;
    opacity: 0.45;
}
.wizard-oppure-divider span {
    padding: 0 0.7rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: #c88000;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ── Struttura interna riga canto ─────────────────────────────────────── */

/*
 * Layout a due livelli:
 *   .wizard-song-row-inner  →  flex row: [handle] [fields] [remove-btn]
 *   .wizard-song-fields     →  flex column: [fields-top] [freetext]
 *   .wizard-song-fields-top →  flex row: [momento] [canto]
 */
.wizard-song-row-inner {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

/* Contenitore colonne + testo libero */
.wizard-song-fields {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Riga superiore: momento + canto */
.wizard-song-fields-top {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

/* Colonna momento liturgico */
.wizard-song-moment-wrap {
    flex: 0 0 185px;
    min-width: 140px;
}

/* Colonna ricerca canto */
.wizard-song-search-wrap {
    flex: 1;
    min-width: 160px;
}

.wizard-song-moment-wrap label,
.wizard-song-search-wrap label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.wizard-song-moment-wrap select,
.wizard-song-moment-wrap .song-moment-custom,
.wizard-song-search-wrap .song-search-input {
    width: 100%;
    padding: 0.42rem 0.6rem;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 0.95rem;
    background: #fff;
    color: inherit;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.wizard-song-moment-wrap select:focus,
.wizard-song-moment-wrap .song-moment-custom:focus,
.wizard-song-search-wrap .song-search-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.25);
}

.wizard-song-moment-wrap .song-moment-custom {
    margin-top: 0.4rem;
}

/* ── Ricerca canto con autocomplete ──────────────────────────────────── */
.song-search-container {
    position: relative;
}

.song-search-results {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #8c8f94;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    max-height: 220px;
    overflow-y: auto;
}

.song-result-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.92rem;
    border-bottom: 1px solid #f0f0f1;
    transition: background 0.1s ease;
}
.song-result-item:last-child { border-bottom: none; }
.song-result-item:hover,
.song-result-item:focus      { background: #f0f6fc; outline: none; }

.song-search-loading,
.song-search-no-results,
.song-search-error {
    padding: 0.6rem 0.75rem;
    font-size: 0.88rem;
    color: #666;
    font-style: italic;
}
.song-search-error { color: #d63638; }

/* Canto selezionato */
.song-selected {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.35rem;
    padding: 0.35rem 0.6rem;
    background: #e8f4e8;
    border: 1px solid #7ad03a;
    border-radius: 4px;
    font-size: 0.9rem;
}
.song-selected-title {
    flex: 1;
    font-weight: 600;
    color: #1a6b1a;
}
.song-clear-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 0.85rem;
    padding: 0 0.2rem;
    line-height: 1;
    border-radius: 3px;
    transition: color 0.15s ease;
}
.song-clear-btn:hover { color: #d63638; }

/* ── Animazioni riposizionamento automatico ───────────────────────────── */

.wizard-row-moving {
    opacity: 0.25;
    transition: opacity 0.3s ease;
}

@keyframes wizardRowHighlight {
    0%   { background-color: #dbeafe; border-color: #2271b1; }
    100% { background-color: #f9f9f9; border-color: #ddd; }
}
.wizard-row-moved {
    animation: wizardRowHighlight 0.7s ease forwards;
}

/* ── Pulsante aggiungi canto ──────────────────────────────────────────── */
#wizard-add-song {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

/* ── Pulsante "Seleziona strofe" ──────────────────────────────────────── */
.song-strophes-wrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.45rem;
}

.song-strophes-btn {
    font-size: 0.82rem;
    padding: 0.3rem 0.75rem;
    border-width: 1px;
}

/* Link di anteprima strofe nello step 2 */
.strophes-preview-link {
    font-size: 0.82rem;
    color: #2271b1;
    text-decoration: underline;
    white-space: nowrap;
}
.strophes-preview-link:hover { color: #135e96; }

/* ── Dialog selezione strofe ──────────────────────────────────────────── */
.isaias42-dialog {
    border: none;
    border-radius: 8px;
    padding: 1.5rem 1.75rem;
    max-width: 420px;
    width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    background: #fff;
    color: inherit;
}

/* Backdrop nativo del <dialog> */
.isaias42-dialog::backdrop {
    background: rgba(0, 0, 0, 0.45);
}

/* ── Dialog eliminazione ──────────────────────────────────────────────── */
.isaias42-delete-dialog {
    max-width: 520px;
}

.delete-dialog-body p {
    margin: 0 0 0.65rem;
}

.delete-dialog-warning {
    background: #fff8e5;
    border: 1px solid #f0d48a;
    border-radius: 6px;
    padding: 0.7rem 0.85rem;
    margin-bottom: 0.8rem;
}

.delete-dialog-switch-wrap {
    border: 1px solid #d0d7de;
    border-radius: 6px;
    background: #f9fafb;
    padding: 0.45rem 0.65rem;
}

.delete-dialog-switch-wrap .ui-checkboxradio-label {
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    line-height: 1.35;
    color: inherit;
}

.delete-dialog-switch-wrap .ui-checkboxradio-icon {
    margin-right: 0.55rem;
}

.dialog-title {
    margin: 0 0 0.4rem;
    font-size: 1.05rem;
    font-weight: 700;
}

.dialog-hint {
    font-size: 0.82rem;
    color: #666;
    margin: 0 0 1rem;
    font-style: italic;
}

.strophes-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 1.25rem;
    max-height: 260px;
    overflow-y: auto;
}

.strophes-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: background 0.1s ease;
}
.strophes-checkbox-label:hover { background: #f0f6fc; }
.strophes-checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #2271b1;
}

/* Sezione anteprima nel dialog */
.dialog-preview-wrap {
    margin-bottom: 0.9rem;
    min-height: 1.4rem;
}
.dialog-preview-link {
    font-size: 0.85rem;
    color: #2271b1;
    text-decoration: underline;
}
.dialog-preview-link:hover { color: #135e96; }

.dialog-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}
.dialog-actions-spacer { flex: 1; }

/* ── Lista playlist ──────────────────────────────────────────────────── */
.wizard-playlist-item {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
}

.wizard-playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.wizard-playlist-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.wizard-playlist-status {
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    margin-left: 0.5rem;
}

.wizard-playlist-status-publish {
    background-color: #e6f7e6;
    color: #2e7d32;
}

.wizard-playlist-status-pending {
    background-color: #fff8e1;
    color: #ff8f00;
}

.wizard-playlist-status-draft {
    background-color: #f3f4f6;
    color: #4b5563;
}

.wizard-playlist-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.wizard-playlist-meta-item {
    display: flex;
    align-items: center;
}

.wizard-playlist-meta-icon {
    margin-right: 0.3rem;
}

.wizard-playlist-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.wizard-playlist-action {
    font-size: 0.9rem;
    padding: 0.3rem 0.7rem;
}

.wizard-loading {
    padding: 1rem;
    text-align: center;
    color: #666;
}

.wizard-notice {
    padding: 1rem;
    background-color: #f8f9fa;
    border-left: 4px solid #6c757d;
    margin-bottom: 1.5rem;
}

/* ── Dialog modifica rapida ──────────────────────────────────────────── */
.isaias42-quick-edit-dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(96vw, 560px);
    max-height: 92dvh;
    border: none;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
    background: #fff;
}

.isaias42-quick-edit-dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}

/* Header */
.qe-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}

.qe-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
}

.qe-close-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.qe-close-btn:hover { background: #f3f4f6; color: #111; }

/* Body — scrollabile */
.qe-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 1.25rem;
}

.qe-hint {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0 0 1rem 0;
}

.qe-loading,
.qe-empty,
.qe-error {
    text-align: center;
    padding: 1.5rem 0;
    color: #6b7280;
    font-size: 0.95rem;
}
.qe-error { color: #dc2626; }

/* Lista canti */
.qe-songs-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.qe-song-row {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.qe-moment-label {
    background: #f3f4f6;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #4b5563;
    border-bottom: 1px solid #e5e7eb;
}

.qe-song-field {
    padding: 0.6rem 0.75rem;
}

/* Canto selezionato */
.qe-song-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.qe-song-title {
    font-size: 1rem;
    font-weight: 500;
    color: #111827;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qe-song-change-btn {
    flex-shrink: 0;
    background: #e0e7ff;
    color: #3730a3;
    border: none;
    border-radius: 6px;
    padding: 0.45rem 0.9rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    /* Target touch grande */
    min-height: 44px;
    min-width: 80px;
    transition: background 0.15s;
}
.qe-song-change-btn:hover { background: #c7d2fe; }

/* Area ricerca */
.qe-song-search {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.qe-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    border: 2px solid #6366f1;
    border-radius: 6px;
    outline: none;
    /* Target touch grande */
    min-height: 48px;
}
.qe-search-input:focus { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }

.qe-search-results {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
}

.qe-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.95rem;
    border-bottom: 1px solid #f3f4f6;
    /* Target touch grande */
    min-height: 48px;
    display: flex;
    align-items: center;
    transition: background 0.1s;
}
.qe-result-item:last-child { border-bottom: none; }
.qe-result-item:hover,
.qe-result-item:focus { background: #eef2ff; outline: none; }

.qe-search-loading,
.qe-search-no-results,
.qe-search-error {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: #6b7280;
    text-align: center;
}
.qe-search-error { color: #dc2626; }

.qe-search-cancel-btn {
    align-self: flex-start;
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
}

/* Footer */
.qe-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}

/* Mobile: footer a piena larghezza con bottoni grandi */
@media (max-width: 480px) {
    .isaias42-quick-edit-dialog {
        width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
        inset: 0;
        margin: 0;
    }

    .qe-footer {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .qe-footer .isaias42-btn {
        width: 100%;
        text-align: center;
        min-height: 52px;
        font-size: 1rem;
    }

    .qe-song-change-btn {
        min-height: 48px;
        min-width: 90px;
        font-size: 1rem;
    }

    .qe-search-input {
        font-size: 1rem;
        min-height: 52px;
    }

    .qe-result-item {
        min-height: 52px;
        font-size: 1rem;
    }
}

/* ── Area risultato ───────────────────────────────────────────────────── */
.wizard-result {
    margin: 2rem 0;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    border-left: 4px solid;
}

.wizard-result-success {
    background-color: #f0f9eb;
    border-color: #67c23a;
    color: #3c763d;
}

.wizard-result-error {
    background-color: #fef0f0;
    border-color: #f56c6c;
    color: #a94442;
}

.wizard-result p {
    margin: 0.5rem 0;
}

.wizard-result a {
    color: #2271b1;
    text-decoration: underline;
}

.wizard-result a:hover {
    color: #135e96;
}

/* ── Responsive: schermi piccoli ──────────────────────────────────────── */
@media (max-width: 520px) {
    /* Su mobile la riga superiore si impila verticalmente */
    .wizard-song-fields-top {
        flex-direction: column;
        gap: 0.5rem;
    }
    .wizard-song-moment-wrap {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
    }
    .wizard-song-search-wrap {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
    }
    .wizard-remove-song {
        margin-top: 0;
        align-self: center;
    }
    .wizard-actions-step2,
    .wizard-actions-step3 {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
    }
    .wizard-actions-left,
    .wizard-actions-right {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }
    .wizard-actions-right {
        flex-direction: row;
        margin-left: auto;
    }
    .isaias42-btn {
        justify-content: center;
    }
}
