/*
========================================================================================
    CSS OVERLAY RICERCA CORSI SUGGERITI - NonSoloFitness
========================================================================================
    Richiede: css_2026_Variabili_globali.css
    Prefisso classi: rcs- (ricerca-corso-suggeriti)
    Usato nella pagina iscrizione per cercare corsi da aggiungere al carrello
========================================================================================
*/


/* ============================================
   OVERLAY FULLSCREEN (centrato)
   ============================================ */
.rcs-overlay {
    position: fixed; inset: 0; z-index: 99999;
    display: none; flex-direction: column; align-items: center; justify-content: center;
    background: var(--nsf-black-85);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    overflow-x: hidden; overflow-y: auto; opacity: 0; transition: opacity .25s ease; }

.rcs-overlay.rcs-visible {
    display: flex; }

.rcs-overlay.rcs-active {
    opacity: 1; }


/* ============================================
   CONTAINER (centrato, no margin-top)
   ============================================ */
.rcs-container {
    width: 94%; max-width: 660px; padding:10px;
    position: relative; transform: translateY(-16px); opacity: 0;
    transition: transform .3s cubic-bezier(.22,.9,.36,1), opacity .25s ease; background-color:#ffffff; }

.rcs-overlay.rcs-active .rcs-container {
    transform: translateY(0); opacity: 1; }


/* ============================================
   CHIUDI
   ============================================ */
.rcs-close {
    position: absolute; top: -44px; right: 0;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
    color: rgba(255,255,255,.6); font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all .15s;
    padding: 0; box-shadow: none; line-height: 1; }

.rcs-close:hover {
    background: rgba(255,255,255,.15); color: var(--nsf-white); }


/* ============================================
   INPUT
   ============================================ */
.rcs-input-wrap {
    position: relative; background: var(--nsf-white); border-radius: 28px;
    border: 1px solid var(--nsf-gray-750); transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box; max-width: 100%; }

.rcs-input-wrap.rcs-has-results {
    border-radius: 28px; }

.rcs-input-wrap:hover {
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1); }

.rcs-input-wrap:focus-within {
    border-color: var(--nsf-gray-400); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15); }

.rcs-input-icon-logo {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    width: 15px; height: 15px; opacity: 0.4; pointer-events: none; }

.rcs-input-icon-search {
    position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; fill: var(--nsf-gray-500); pointer-events: none; }

.rcs-input {
    width: 100% !important; border: none !important; outline: none !important;
    padding: 14px 44px 14px 46px !important;
    font-size: 16px !important; font-weight: 400 !important; line-height: 1.4 !important;
    color: var(--nsf-black-soft) !important; background: transparent !important;
    border-radius: 28px !important; box-shadow: none !important; font-family: inherit !important; }

.rcs-input:focus {
    border: none !important; outline: none !important; box-shadow: none !important; }

.rcs-input::placeholder {
    color: var(--nsf-gray-500); font-size: 14px; opacity: 1; }

.rcs-input::-webkit-search-cancel-button {
    -webkit-appearance: none; appearance: none; display: none; }

.rcs-clear {
    position: absolute; right: 42px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px;
    background: none; border: none; color: var(--nsf-gray-500);
    display: none; align-items: center; justify-content: center;
    cursor: pointer; transition: color .15s;
    padding: 0; box-shadow: none; line-height: 1; font-size: 14px; }

.rcs-clear.rcs-shown {
    display: flex; }

.rcs-clear:hover {
    color: var(--nsf-red); }


/* ============================================
   RISULTATI
   ============================================ */
.rcs-results {
    margin-top: 12px; background: var(--nsf-white);
    
    max-height: 420px; overflow-y: auto; box-sizing: border-box; max-width: 100%;
    scrollbar-width: thin; scrollbar-color: var(--nsf-gray-400) transparent; }

.rcs-results::-webkit-scrollbar {
    width: 5px; }

.rcs-results::-webkit-scrollbar-track {
    background: transparent; }

.rcs-results::-webkit-scrollbar-thumb {
    background: var(--nsf-gray-400); border-radius: 3px; }

.rcs-results:empty {
    display: none; }

.rcs-section {
    padding: 10px 16px 6px; font-size: 11px; font-weight: 600;
    letter-spacing: .04em; text-transform: uppercase; color: var(--nsf-gray-700); }


/* ============================================
   SINGOLO ITEM
   ============================================ */
.rcs-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    text-decoration: none; color: inherit;
    border-bottom: 1px solid var(--nsf-gray-200);
    transition: background .12s, opacity .3s ease, max-height .35s ease, padding .35s ease;
    cursor: pointer; overflow: hidden; }

.rcs-item:last-child {
    border-bottom: none; }

.rcs-item:hover {
    background: var(--nsf-gray-100); }

.rcs-item.rcs-focused {
    background: var(--nsf-gray-100); }

.rcs-item-img {
    width: 40px; height: 40px; border-radius: 4px;
    object-fit: cover; flex-shrink: 0; background: var(--nsf-gray-200);
    align-self: flex-start; margin-top: 2px; }

.rcs-item-info {
    flex: 1; min-width: 0; }

.rcs-item-name {
    font: 500 14px/1.3 'Poppins', sans-serif; color: var(--nsf-gray-950);
    overflow-wrap: break-word; word-wrap: break-word; }

.rcs-item-name mark {
    background: transparent; color: var(--nsf-red); font-weight: 600; }

.rcs-item-price {
    font: 600 15px/1 'Poppins', sans-serif; color: var(--nsf-gray-950);
    white-space: nowrap; flex-shrink: 0; text-align: right; }

.rcs-item-price span {
    font-size: 12px; font-weight: 400; }


/* ============================================
   ANIMAZIONE CORSO AGGIUNTO → SPARISCE
   ============================================ */
.rcs-item.rcs-aggiunto {
    background: var(--nsf-gray-200); opacity: 0.4; pointer-events: none; }

.rcs-item.rcs-sparisce {
    opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0;
    border-bottom-width: 0; }


/* ============================================
   PULSANTE AGGIUNGI (+)
   ============================================ */
.rcs-item-add {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: transparent; border: 1px solid var(--nsf-gray-400);
    color: var(--nsf-gray-700); font-size: 20px; font-weight: 300;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all .2s ease;
    padding: 0; box-shadow: none; line-height: 1; }

.rcs-item:hover .rcs-item-add {
    border-color: var(--nsf-success-alt); color: var(--nsf-success-alt); }

.rcs-item-add:hover {
    background: var(--nsf-success-alt); border-color: var(--nsf-success-alt);
    color: var(--nsf-white); transform: scale(1.1); }

@media (hover: none) {
    .rcs-item:hover .rcs-item-add {
        border-color: var(--nsf-gray-400);
        color: var(--nsf-gray-700);
    }
    .rcs-item:hover {
        background: transparent;
    }
}


/* ============================================
   TOAST
   ============================================ */
.rcs-toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--nsf-success-alt); color: var(--nsf-white);
    padding: 12px 24px; border-radius: 6px; font-size: 14px; font-weight: 500;
    box-shadow: 0 8px 24px var(--nsf-black-25);
    opacity: 0; transition: opacity .25s ease, transform .25s ease;
    z-index: 100000; pointer-events: none; white-space: nowrap; }

.rcs-toast.rcs-toast-visible {
    opacity: 1; transform: translateX(-50%) translateY(0); }


/* ============================================
   NESSUN RISULTATO
   ============================================ */
.rcs-empty {
    padding: 32px 16px; text-align: center; }

.rcs-empty-title {
    font: 500 14px/1.4 'Poppins', sans-serif; color: var(--nsf-gray-800); margin-bottom: 4px; }

.rcs-empty-text {
    font-size: 13px; color: var(--nsf-gray-600); }


/* ============================================
   LINK TORNA ALL'ISCRIZIONE (sempre visibile, a sinistra)
   ============================================ */
.rcs-footer {
    background: var(--nsf-white);padding: 12px 16px; }

.rcs-footer-link {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--nsf-info); font-size: 14px; font-weight: 500;
    text-decoration: none; cursor: pointer; transition: opacity .2s ease; }

.rcs-footer-link:hover {
    opacity: 0.7; }

.rcs-footer-link svg {
    width: 16px; height: 16px; fill: var(--nsf-info); flex-shrink: 0; }


/* ============================================
   H4-SCONTO FLEX (lente a destra)
   ============================================ */
.h4-sconto-flex {
    display: flex; align-items: center; gap: 0; }

.h4-sconto-flex .h4-sconto {
    flex: 1; margin-bottom: 0; }

.h4-sconto-flex .rcs-trigger {
    width: 50px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0; border: none; background: transparent;
    transition: transform .2s ease; }

.h4-sconto-flex .rcs-trigger svg {
    width: 40px; height: 40px; fill: var(--nsf-info); transition: fill .2s ease; }

.h4-sconto-flex .rcs-trigger:hover {
    transform: scale(1.15); }

.h4-sconto-flex .rcs-trigger:hover svg {
    fill: var(--nsf-black-soft); }


/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {

    .rcs-overlay {
        justify-content: flex-start; }

    .rcs-container {
        width: 100%; max-width: 100%; padding: 12px 10px 0; box-sizing: border-box; }

    .rcs-close {
        top: 12px; right: 12px; position: fixed; }

    .rcs-results {
        max-height: 50vh; }

    .rcs-item {
        padding: 8px 12px; gap: 10px; }

    .rcs-item-name {
        font-size: 13px; }

    .rcs-item-price {
        font-size: 14px; }

    .rcs-toast {
        bottom: 20px; font-size: 13px; padding: 10px 20px; }

}