/* =========================================================================
   CF Spotlight — ricerca rapida paziente al banco (overlay macOS-style).
   Look portato da public/mockup/scheda-cliente-finale.html (tema V3 verde),
   prefisso .gal-sp* per non collidere con le classi Filament. Caricato dal
   render hook HEAD_END del trait ConfiguresGaleniciPanel (admin/operatore).

   Le variabili V3 sono dichiarate qui in locale: i pannelli Filament non
   espongono il :root del mockup. Valori allineati a public/css/sidebar.css.
   ========================================================================= */
.gal-sp {
    --gal-brand: #006636;
    --gal-brand-2: #00a86b;
    --gal-brand-deep: #004a27;
    --gal-brand-glow: rgba(0, 168, 107, .22);
    --gal-ink: #0f1a14;
    --gal-ink-soft: #42554a;
    --gal-ink-mute: #7b8b82;
    --gal-line: #e4ece7;
    --gal-line-soft: #eef3f0;
    --gal-grad: linear-gradient(135deg, #006636 0%, #00a86b 100%);
    --gal-shadow-md: 0 6px 18px rgba(0, 82, 46, .08), 0 2px 6px rgba(0, 82, 46, .05);
    --gal-ff-display: "Bricolage Grotesque", sans-serif;
    --gal-ff-body: "Inter", sans-serif;
}

/* --- Overlay --- */
/* z-index 100000: sopra la sidebar, l'overlay drag (.gal-drop-overlay = 99999)
   e i toast (99998). Montato in BODY_END (fuori da .fi-main), mai clippato. */
.gal-sp {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 14vh 24px 24px;
}

.gal-sp-back {
    position: absolute;
    inset: 0;
    background: radial-gradient(60% 60% at 50% 30%, rgba(0, 74, 39, .5), rgba(0, 40, 22, .7));
    backdrop-filter: blur(14px) saturate(120%);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
}

.gal-sp-card {
    position: relative;
    width: min(620px, 94vw);
    background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(247, 251, 248, .98));
    border: 1px solid rgba(255, 255, 255, .6);
    border-radius: 22px;
    box-shadow: 0 44px 110px -34px rgba(0, 40, 22, .7), inset 0 1px 0 rgba(255, 255, 255, .85);
    overflow: hidden;
    animation: gal-sp-rise .34s cubic-bezier(.2, 1.3, .4, 1) both;
}

@keyframes gal-sp-rise {
    from { opacity: 0; transform: scale(.94) translateY(-8px); }
    to   { opacity: 1; transform: none; }
}

.gal-sp-card form { margin: 0; }

.gal-sp-input-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 22px;
}

.gal-sp-input-wrap > svg {
    width: 24px;
    height: 24px;
    color: var(--gal-brand);
    flex: none;
}

.gal-sp-input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-family: var(--gal-ff-display);
    font-weight: 500;
    font-size: 1.4rem;
    letter-spacing: .01em;
    color: var(--gal-ink);
    min-width: 0;
    text-transform: uppercase;
    box-shadow: none;
}

.gal-sp-input:focus { outline: 0; box-shadow: none; }

.gal-sp-input::placeholder {
    color: var(--gal-ink-mute);
    font-family: var(--gal-ff-body);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.gal-sp-enter {
    font-family: var(--gal-ff-body);
    font-size: .66rem;
    color: var(--gal-ink-mute);
    border: 1px solid var(--gal-line);
    border-radius: 7px;
    padding: 4px 9px;
    background: var(--gal-line-soft);
    font-weight: 600;
    flex: none;
    white-space: nowrap;
}

.gal-sp-divider {
    height: 1px;
    background: var(--gal-line);
    margin: 0 22px;
}

.gal-sp-foot { padding: 14px 22px 18px; }

/* --- Esito: errore inline (CF non valido) --- */
.gal-sp-err {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 15px;
    border-radius: 13px;
    background: rgba(214, 69, 90, .08);
    border: 1px solid rgba(214, 69, 90, .25);
    color: #b03a4a;
    font-family: var(--gal-ff-body);
    font-size: .86rem;
    font-weight: 500;
}

.gal-sp-err.on { animation: gal-sp-shake .4s; }
.gal-sp-err svg { width: 18px; height: 18px; flex: none; }

@keyframes gal-sp-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* --- Esito: CF valido ma assente -> crea paziente --- */
.gal-sp-empty {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.gal-sp-empty.on { animation: gal-sp-fade .34s ease; }

.gal-sp-empty-row {
    display: flex;
    align-items: center;
    gap: 11px;
    font-family: var(--gal-ff-body);
    font-size: .9rem;
    font-weight: 500;
    color: var(--gal-ink-soft);
}

.gal-sp-empty-row svg { width: 18px; height: 18px; flex: none; color: var(--gal-ink-mute); }

@keyframes gal-sp-fade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}

.gal-sp-create {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--gal-brand-deep);
    color: #fff;
    border: 0;
    border-radius: 11px;
    padding: 9px 15px;
    font-family: var(--gal-ff-body);
    font-weight: 600;
    font-size: .82rem;
    cursor: pointer;
    text-decoration: none;
    box-shadow: var(--gal-shadow-md);
    transition: transform .2s, filter .2s;
    flex: none;
}

.gal-sp-create svg { width: 16px; height: 16px; }
.gal-sp-create:hover { transform: translateY(-2px); filter: brightness(1.12); }

/* --- Hint / stato di ricerca --- */
.gal-sp-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-family: var(--gal-ff-body);
    font-size: .78rem;
    color: var(--gal-ink-mute);
}

.gal-sp-hint .lh { display: flex; align-items: center; gap: 8px; }
.gal-sp-hint .lh svg { width: 15px; height: 15px; color: var(--gal-ink-mute); }

.gal-sp-busy {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--gal-brand);
    font-weight: 600;
}

.gal-sp-busy svg { width: 15px; height: 15px; animation: gal-sp-spin .8s linear infinite; }

@keyframes gal-sp-spin { to { transform: rotate(360deg); } }

/* =========================================================================
   Pulsante di lancio in cima alla sidebar (render hook SIDEBAR_START).
   Stile coerente con la card .gal-brand già presente.
   ========================================================================= */
.gal-cf-launch {
    display: flex;
    align-items: center;
    gap: 10px;
    width: calc(100% - 1.5rem);
    margin: 0 .75rem .5rem;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .08);
    color: #eafaf1;
    font-family: var(--gal-ff-body, "Inter", sans-serif);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background .18s, border-color .18s, transform .18s;
}

.gal-cf-launch:hover {
    background: rgba(255, 255, 255, .16);
    border-color: rgba(255, 255, 255, .32);
    transform: translateY(-1px);
}

.gal-cf-launch svg.gal-cf-ico { width: 17px; height: 17px; flex: none; opacity: .92; }
.gal-cf-launch .lab { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.gal-cf-launch kbd {
    flex: none;
    font-family: var(--gal-ff-body, "Inter", sans-serif);
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .02em;
    color: #d9f3e6;
    background: rgba(0, 0, 0, .22);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 6px;
    padding: 3px 6px;
    line-height: 1;
}
