/* ================================================
   TUTORIAL TOUR - Stili lista tutorial + tour guidato
   ================================================ */

/* --- Sezione Tutorial nella pagina Profilo --- */

.tutorial-intro {
    margin-bottom: 1.5rem;
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.5;
}

.tutorial-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
    align-items: stretch;
}

.tutorial-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    min-height: 80px;
    background: var(--gradient-card, linear-gradient(145deg, #ffffff 0%, #fafbfc 100%));
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.tutorial-item:hover {
    border-color: var(--accent-blue, #0d0d0d);
    box-shadow: 0 4px 12px rgba(13, 13, 13, 0.15);
    transform: translateY(-1px);
}

.tutorial-item:active {
    transform: translateY(0);
}

.tutorial-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    background: var(--gradient-purple, linear-gradient(135deg, #0d0d0d 0%, #1f1f1f 100%));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
}

.tutorial-info {
    flex: 1;
    min-width: 0;
}

.tutorial-info h4 {
    margin: 0 0 0.15rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
}

.tutorial-info p {
    margin: 0;
    font-size: 0.8rem;
    color: #94a3b8;
    white-space: normal;
    overflow: visible;
}

.tutorial-action {
    color: var(--accent-blue, #0d0d0d);
    font-size: 1rem;
    min-width: 20px;
    text-align: center;
}

/* --- Overlay Tour --- */

.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99998;
    pointer-events: auto;
}

.tour-overlay svg {
    width: 100%;
    height: 100%;
}

/* --- Elemento evidenziato --- */

.tour-highlight {
    position: relative;
    z-index: 99999 !important;
    box-shadow: 0 0 0 4px rgba(13, 13, 13, 0.5), 0 0 20px rgba(13, 13, 13, 0.3) !important;
    border-radius: 8px;
}

/* --- Popover Tour --- */

.tour-popover {
    position: fixed;
    z-index: 100000;
    width: 360px;
    max-width: calc(100vw - 32px);
    max-height: calc(100dvh - 32px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: tourPopoverIn 0.3s ease;
}

@keyframes tourPopoverIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.tour-popover-header {
    background: var(--gradient-purple, linear-gradient(135deg, #0d0d0d 0%, #1f1f1f 100%));
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tour-popover-header i {
    font-size: 1.2rem;
    opacity: 0.9;
}

.tour-popover-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
}

.tour-popover-body {
    padding: 1.25rem;
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.tour-popover-body-text {
    flex: 1;
    min-width: 0;
}

.tour-popover-body-text ul {
    margin: 0.4rem 0 0 0;
    padding-left: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* --- Bink mascot inside popover body --- */
.tour-bink {
    width: 160px;
    flex-shrink: 0;
    align-self: center;
    pointer-events: none;
    user-select: none;
    margin-left: 4px;
}

.tour-popover-footer {
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
}

.tour-step-counter {
    font-size: 0.8rem;
    color: #94a3b8;
    font-weight: 500;
}

.tour-popover-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Pulsanti navigazione tour */
.tour-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.tour-btn-prev {
    background: #f1f5f9;
    color: #475569;
}

.tour-btn-prev:hover {
    background: #e2e8f0;
}

.tour-btn-next {
    background: var(--accent-blue, #0d0d0d);
    color: #fff;
}

.tour-btn-next:hover {
    opacity: 0.9;
    box-shadow: 0 2px 8px rgba(13, 13, 13, 0.4);
}

.tour-btn-finish {
    background: var(--accent-green, #10b981);
    color: #fff;
}

.tour-btn-finish:hover {
    opacity: 0.9;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.tour-btn-close {
    background: #f1f5f9;
    color: #475569;
}

.tour-btn-close:hover {
    background: #e2e8f0;
}

/* Freccia popover */
.tour-popover-arrow {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05);
}

.tour-popover-arrow.arrow-top {
    top: -8px;
    left: calc(50% - 8px);
    background: var(--gradient-purple-start, #0d0d0d);
}

.tour-popover-arrow.arrow-bottom {
    bottom: -8px;
    left: calc(50% - 8px);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
}

/* --- Popover centrato (quando l'elemento non esiste) --- */

.tour-popover.tour-popover-centered {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
}

/* --- Popover slide (con anteprima HTML integrata) --- */

.tour-popover.tour-popover-slide {
    width: min(620px, 94vw);
}

.tour-slide-preview {
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    overflow: hidden;
    max-height: 270px;
    overflow-y: auto;
}

/* --- Responsive --- */

@media (max-width: 768px) {
    .tour-popover {
        width: calc(100vw - 24px);
        max-height: calc(100dvh - 24px);
        left: 12px !important;
        right: 12px !important;
    }

    /* Popover ancorati all'elemento: la posizione verticale la decide il JS
       (sopra o sotto il pulsante), cosi' il pulsante indicato resta sempre visibile. */
    .tour-popover.tour-popover-sopra,
    .tour-popover.tour-popover-sotto {
        transform: none !important;
    }

    /* Popover senza elemento di riferimento: restano centrati */
    .tour-popover.tour-popover-slide,
    .tour-popover.tour-popover-centered {
        width: calc(100vw - 24px);
        top: 50% !important;
        transform: translateY(-50%) !important;
    }

    .tutorial-item {
        padding: 0.85rem 1rem;
        gap: 0.75rem;
    }

    .tutorial-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
        border-radius: 10px;
        font-size: 1rem;
    }

    .tutorial-info h4 {
        font-size: 0.9rem;
    }

    .tutorial-info p {
        font-size: 0.75rem;
    }

    .tour-popover-header {
        padding: 0.85rem 1rem;
    }

    .tour-popover-body {
        padding: 1rem;
        font-size: 0.85rem;
        gap: 4px;
    }

    .tour-bink {
        width: 100px;
    }

    .tour-popover-footer {
        padding: 0.65rem 1rem;
    }

    .tour-btn {
        padding: 0.45rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* Schermi molto stretti: la mascotte ruberebbe lo spazio al testo */
@media (max-width: 400px) {
    .tour-bink {
        display: none;
    }
}
