﻿/* mobile search base */
.mobile-search-container {
    display: block;
    max-height: 0;
    overflow: hidden;
    transition: max-height 220ms ease, padding 220ms ease, opacity 220ms ease;
    opacity: 0;
    pointer-events: none;
    width: 100%;
}

    .mm-navbar__title > span {
        overflow: visible !important;
    }

    .morning-shift {
        margin-inline-end: 0.5em;
    }

    .evening-shift {
        margin-inline-start: 0.5em;
    }
    /* Houtube Lazy Loading */
    .embed-youtube {
        background-color: #000;
        margin-bottom: 30px;
        position: relative;
        padding-top: 56.25%;
        overflow: hidden;
        cursor: pointer;
    }

    .embed-youtube img {
        width: 100%;
        top: -16.84%;
        left: 0;
    }

    .embed-youtube .embed-youtube-play {
        width: 68px;
        height: 48px;
        background-color: #333;
        box-shadow: 0 0 30px rgba( 0,0,0,0.6 );
        z-index: 1;
        opacity: 0.8;
        border-radius: 6px;
    }

    .embed-youtube .embed-youtube-play:before {
        content: "";
        border-style: solid;
        border-width: 15px 0 15px 26.0px;
        border-color: transparent transparent transparent #fff;
    }

    .embed-youtube img, .embed-youtube .embed-youtube-play {
        cursor: pointer;
    }

    .embed-youtube img, .embed-youtube iframe, .embed-youtube .embed-youtube-play, .embed-youtube .embed-youtube-play:before {
        position: absolute;
    }

    .embed-youtube .embed-youtube-play, .embed-youtube .embed-youtube-play:before {
        top: 50%;
        left: 50%;
        transform: translate3d( -50%, -50%, 0 );
    }

    .embed-youtube iframe {
        height: 100%;
        width: 100%;
        top: 0;
        left: 0;
    }

    .embed-youtube .embed-youtube-play:hover {
        background-color: #f00;
    }


/* CKEditor 5 tables + Bootstrap responsive wrapper */
.ck-content .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

    .ck-content .table-responsive > figure.table {
        width: 100%;
        margin: 0; /* elimina margini default del figure */
    }

        .ck-content .table-responsive > figure.table > table {
            width: 100%;
            max-width: 100%;
        }

/* opzionale: se vuoi che sembri una bootstrap table */
.ck-content figure.table > table {
    border-collapse: collapse;
}
.brands-search {
    max-width: 320px;
}

/*Gestione pagina brands*/

.brand-letter {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.5rem;
    font-weight: 600;
}

.alphabet-nav {
    gap: 0.5rem;
    align-items: center;
}

    .alphabet-nav a {
        color: #333;
        text-decoration: none;
        font-weight: 600;
        margin-right: 0.5rem;
    }

        .alphabet-nav a.active {
            color: #b30000;
        }

    .alphabet-nav .disabled {
        color: #c0c0c0;
        pointer-events: none;
        margin-right: 0.5rem;
    }

.brand-card .card-image {
    min-height: 100px;
    align-items: center;
    justify-content: center;
}

.card-title {
    font-size: 0.9rem;
}
.brand-letter {
    scroll-margin-top: 160px !important;
}



 /* Gestione AI */

.ai-floating-trigger {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(180deg,#7b4de6,#5a2aa6);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1055;
    cursor: pointer;
    color: #fff;
    border: none;
}

.ai-floating-trigger:focus {
    outline: 2px solid rgba(255,255,255,0.25);
    outline-offset: 2px;
}

.ai-floating-trigger .ai-icon {
    font-size: 24px;
    line-height: 1;
}

.ai-floating-trigger .ai-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff3b30;
    color: #fff;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
}

.btn-ai__text {
    display: none;
}

@media(min-width:1200px) {
    .ai-floating-trigger {
        right: 30px;
        bottom: 30px;
    }
}

/* Modal as fixed chat panel bottom-right */
.modal.fade .modal-dialog {
    transition: none;
}

#aiAgentModal .modal-dialog {
    position: fixed;
    right: 20px;
    bottom: 90px;
    margin: 0;
    width: 360px;
    max-width: calc(100% - 40px);
    height: 620px;
    z-index: 1060;
}

#aiAgentModal .ai-modal {
    height: 100%;
    border-radius: 12px;
    overflow: visible; /* prima era hidden: causava il clipping */
    display: flex;
    flex-direction: column;
}

.ai-actions {
    position: absolute;
    top: -22px; /* meno negativo, si vede meglio */
    right: 12px; /* sposta leggermente verso l'interno */
    display: flex;
    gap: 8px;
    z-index: 2099; /* più alto del modal per essere visibile */
    pointer-events: auto;
}

.ai-action {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #2bb0ff;
    color: #fff;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

    .ai-action:nth-child(2) {
        background: #ff6b6b;
    }

    .ai-action:nth-child(3) {
        background: #7a4de6;
    }

.ai-modal .modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.ai-chat-window {
    flex: 1 1 auto;
    background: #f7f8fa;
    padding: 12px;
    overflow: hidden;
}

.ai-messages {
    height: 100%;
    overflow-y: auto;
    padding-right: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

    .ai-msg .avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 6px rgba(0,0,0,0.06);
        flex: 0 0 36px;
        font-size: 18px;
    }

    .ai-msg .bubble {
        background: #fff;
        padding: 10px 12px;
        border-radius: 8px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.04);
        max-width: 78%;
        font-size: 14px;
        line-height: 1.35;
    }

    .ai-msg.ai-user {
        flex-direction: row-reverse;
    }

        .ai-msg.ai-user .bubble {
            background: #e9f3ff;
        }

        .ai-msg.ai-user .avatar {
            background: #e9f3ff;
        }

.ai-suggestions {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-suggestion {
    background: #fff;
    border: 1px solid #e6e6e6;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
}

.ai-input-area {
    border-top: 1px solid #eee;
    background: transparent;
}

.ai-input {
    border-radius: 24px;
    padding: 12px 16px;
    border: 1px solid #dfe6f3;
}

.ai-send {
    margin-left: 8px;
    border-radius: 24px;
    padding: 8px 12px;
}

/* small screens: full width bottom */
@media (max-width: 576px) {
    #aiAgentModal .modal-dialog {
        right: 8px;
        left: 8px;
        bottom: 10px;
        width: auto;
        height: 70vh;
    }
}

/* Chat modal: body scorre verticalmente mantenendo header/footer fissi */
#aiAgentModal .ai-modal {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#aiAgentModal .modal-header {
    flex: 0 0 auto;
}

#aiAgentModal .modal-footer {
    flex: 0 0 auto;
}

/* Assicura che il body sia un contenitore flessibile che occupa lo spazio rimanente */
#aiAgentModal .modal-body.p-0 {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* overflow gestito dal pannello interno */
}

/* Il pannello dei messaggi scrolla verticalmente */
#aiAgentModal .ai-chat-window {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* scorrimento fluido su mobile */
    padding: 12px;
}

/* I messaggi si impilano verticalmente (senza forzare altezza fissa) */
#aiAgentModal .ai-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
/* Loader */
.ai-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.75);
    z-index: 1080;
    pointer-events: auto;
}

    .ai-loader.d-none {
        display: none;
    }

.ai-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e6e6e6;
    border-top-color: #0d6efd; /* bootstrap primary */
    border-radius: 50%;
    animation: ai-spin 1s linear infinite;
}

@keyframes ai-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Ensure chat window is scrollable and loader sits above it */
#aiAgentModal .ai-chat-window {
    flex: 1 1 auto;
    overflow: hidden;
}

#aiAgentModal .ai-messages {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

</style >

