/* ══════════════════════════════════════════════
   ASSISTENTE BIGLIETTI - CSS
   ══════════════════════════════════════════════ */

/* ── Wrapper ── */
.ab-wrapper {
    margin-bottom: 20px;
}

/* ── Bottone trigger ── */
.ab-trigger {
    width: 100%;
    padding: 16px 20px;
    border: 2px dashed #818cf8;
    border-radius: 14px;
    background: linear-gradient(135deg, #eef2ff, #faf5ff);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(129, 140, 248, 0.1);
    text-align: left;
    font-family: inherit;
}

.ab-trigger:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 20px rgba(129, 140, 248, 0.2);
    transform: translateY(-1px);
}

.ab-trigger.active {
    border-color: #6366f1;
    border-style: solid;
    background: linear-gradient(135deg, #e0e7ff, #ede9fe);
}

.ab-trigger-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.ab-trigger-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ab-trigger-title {
    font-weight: 700;
    font-size: 15px;
    color: #312e81;
}

.ab-trigger-sub {
    font-size: 13px;
    color: #6366f1;
}

.ab-trigger-arrow {
    font-size: 20px;
    color: #818cf8;
    transition: transform 0.3s;
}

.ab-trigger:hover .ab-trigger-arrow {
    transform: translateX(4px);
}


/* ── Anteprima fac-simile ── */
.ab-preview {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s ease, opacity 0.4s ease, margin 0.4s ease;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    margin-top: 0;
}

.ab-preview.visible {
    max-height: 500px;
    opacity: 1;
    margin-top: 16px;
    padding: 20px 24px;
    border: 1px solid #e5e7eb;
}

.ab-preview-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px;
}

.ab-preview-header p {
    font-size: 13px;
    color: #94a3b8;
    margin: 0 0 12px;
}

.ab-preview-canvas {
    display: flex;
    justify-content: center;
    padding: 10px 0;
}

.ab-preview-canvas svg {
    width: 100%;
    max-width: 460px;
    height: auto;
}

.ab-preview-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    margin-top: 10px;
    font-size: 12px;
    color: #64748b;
}

.ab-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ab-legend-dash {
    width: 16px;
    height: 0;
    border-top: 2px dashed #999;
}

.ab-legend-num {
    color: #c0392b;
    font-weight: 700;
}

.ab-legend-holo {
    font-weight: 700;
    background: linear-gradient(90deg, #a78bfa, #60a5fa, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* ── Overlay ── */
.ab-overlay {
    position: fixed;
    top: var(--ab-navbar-height, 60px);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.ab-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}


/* ── Sidebar ── */
/* Imposta qui l'altezza della tua navbar, oppure sovrascrivila nel CSS del sito */
:root {
    --ab-navbar-height: 60px;
}

.ab-sidebar {
    position: fixed;
    right: -420px;
    top: var(--ab-navbar-height, 60px);
    bottom: 0;
    width: min(400px, 90vw);
    background: #fff;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid #e5e7eb;
}

.ab-sidebar.open {
    right: 0;
}

.ab-sidebar-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #1e40af, #7c3aed);
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.ab-sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.ab-sidebar-title {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ab-sidebar-title strong {
    font-size: 15px;
}

.ab-sidebar-title span {
    font-size: 12px;
    opacity: 0.85;
}

.ab-sidebar-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ab-sidebar-close:hover {
    background: rgba(255, 255, 255, 0.35);
}


/* ── Progress ── */
.ab-progress {
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.ab-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
}

.ab-progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.ab-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}


/* ── Chat ── */
.ab-chat {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Messaggi */
.ab-msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: abFadeUp 0.3s ease;
}

.ab-msg-bot {
    flex-direction: row;
}

.ab-msg-user {
    flex-direction: row-reverse;
}

.ab-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ede9fe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.ab-msg-bubble {
    border-radius: 4px 16px 16px 16px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 85%;
}

.ab-msg-bot .ab-msg-bubble {
    background: #f1f5f9;
    color: #334155;
}

.ab-msg-user .ab-msg-bubble {
    background: linear-gradient(135deg, #3b82f6, #7c3aed);
    color: white;
    border-radius: 16px 16px 4px 16px;
    font-weight: 600;
}

/* Tip */
.ab-msg-tip .ab-msg-avatar {
    background: #fef3c7;
}

.ab-msg-tip .ab-msg-bubble {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    font-size: 13px;
}

/* Completion */
.ab-msg-done .ab-msg-avatar {
    background: #d1fae5;
}

.ab-msg-done .ab-msg-bubble {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

/* Opzioni */
.ab-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-left: 40px;
    animation: abFadeUp 0.3s ease;
}

.ab-option-btn {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    transition: all 0.2s ease;
    line-height: 1.3;
    text-align: left;
    font-family: inherit;
}

.ab-option-btn:hover {
    border-color: #818cf8;
    background: #eef2ff;
    color: #4338ca;
}

.ab-option-btn .ab-option-desc {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #94a3b8;
    margin-top: 2px;
}


/* ── Footer sidebar ── */
.ab-sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.ab-btn-reset,
.ab-btn-done {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s;
}

.ab-btn-reset {
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
}

.ab-btn-reset:hover {
    background: #f1f5f9;
}

.ab-btn-done {
    border: none;
    background: linear-gradient(135deg, #3b82f6, #7c3aed);
    color: white;
    font-weight: 600;
}

.ab-btn-done:hover {
    opacity: 0.9;
}


/* ── FAB ── */
.ab-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ab-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(99, 102, 241, 0.5);
}


/* ── Highlight barra header sezione ── */

.ab-highlight-bar {
    background: linear-gradient(135deg, #fef08a, #fde047) !important;
    border-color: #eab308 !important;
    position: relative;
    animation: abPulseBar 2s ease-in-out infinite;
    transition: background 0.4s ease;
}

@keyframes abPulseBar {
    0%, 100% { box-shadow: inset 0 0 0 0 rgba(234, 179, 8, 0); }
    50%      { box-shadow: inset 0 0 20px rgba(234, 179, 8, 0.15); }
}

/* Badge "Seleziona qui" sulla barra */
.ab-bar-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #b45309;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    margin-left: 12px;
    animation: abFadeUp 0.3s ease;
    vertical-align: middle;
    white-space: nowrap;
}


/* ── Animazioni ── */
@keyframes abFadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ── Responsive ── */
@media (max-width: 640px) {
    .ab-trigger {
        padding: 12px 14px;
        gap: 10px;
    }

    .ab-trigger-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .ab-trigger-title {
        font-size: 14px;
    }

    .ab-trigger-sub {
        font-size: 12px;
    }

    .ab-sidebar {
        width: 100vw;
        right: -100vw;
    }

    .ab-preview.visible {
        padding: 16px;
    }
}