@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

/* Screen reader only content for SEO */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    background-color: #0a0a0f;
}

/* === reCAPTCHA v3 badge in alto a destra === */
/* Badge reCAPTCHA v3 in alto a destra, solo icona */
.grecaptcha-badge {
    display: none !important;
}

/* SPINNER LOADER */
.spinner-container {
    width: 100vw;
    height: 100vh;
    background-color: #0a0a0f;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0px;
    left: 0px;
    z-index: 99999999999999999999999999999999999999999;
    flex-direction: column;
    gap: 24px;
}

.spinner {
    position: relative;
    width: 40px;
    height: 40px;
}

.spinner div {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    animation: spinner-4t3wzl 1.25s infinite backwards;
}

.spinner div:nth-child(1) {
    animation-delay: 0.15s;
    background-color: rgba(99, 102, 241, 0.9);
}

.spinner div:nth-child(2) {
    animation-delay: 0.3s;
    background-color: rgba(99, 102, 241, 0.7);
}

.spinner div:nth-child(3) {
    animation-delay: 0.45s;
    background-color: rgba(139, 92, 246, 0.6);
}

.spinner div:nth-child(4) {
    animation-delay: 0.6s;
    background-color: rgba(139, 92, 246, 0.4);
}

.spinner div:nth-child(5) {
    animation-delay: 0.75s;
    background-color: rgba(139, 92, 246, 0.3);
}

@keyframes spinner-4t3wzl {
    0% {
        transform: rotate(0deg) translateY(-200%);
    }

    60%,
    100% {
        transform: rotate(360deg) translateY(-200%);
    }
}

/* SPINNER LOADER END */

.logo {
    max-width: 120px;
}

.title {
    color: white;
}

#row-title {
    height: 120px;
}

.height100 {
    height: 100%;
}

.centered {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.text-white {
    color: white;
}

.height-remaining {
    height: calc(70vh - 120px);
}

.align-items-center {
    align-items: center;
}

.justify-content-center {
    justify-content: center;
}

.d-flex {
    display: flex;
}

.container {
    height: 100vh;
    width: 100vw;
    display: flex;
    background-color: #0a0a0f;
    overflow: hidden;
    position: relative;
}

#it-img {
    width: 50%;
    background-image: url('../img/it_bg.jpg');
    background-size: 100vw;
    background-position-y: bottom;
    background-position-x: left;
    background-repeat: no-repeat;
    position: relative;
    /* transition: width 0.05s linear; */
    overflow: hidden;
}

/* Subtle dark overlay for better text contrast */
#it-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(6, 6, 22, 0.35) 0%, rgba(6, 6, 22, 0.15) 100%);
    pointer-events: none;
    z-index: 1;
}

#pianist-img {
    width: calc(50% + 3px);
    margin-left: -3px;
    background-image: url('../img/pianist_bg.jpg');
    background-size: 100vw;
    background-position-y: bottom;
    background-position-x: right;
    background-repeat: no-repeat;
    position: relative;
    /* transition: width 0.05s linear; */
    overflow: hidden;
}

#pianist-img::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 3px;
    background: linear-gradient(225deg, rgba(6, 6, 22, 0.35) 0%, rgba(6, 6, 22, 0.15) 100%);
    pointer-events: none;
    z-index: 1;
}



.fixed-pianist {
    position: fixed;
    right: 3%;
    top: 20%;
    z-index: 20;
    font-size: 42px;
    font-weight: 800;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    text-align: center;
    color: white;
    
    /* Premium Glass Effect - Dark */
    background: rgba(10, 10, 30, 0.4);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    
    /* Refined borders */
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    
    padding: 44px 56px;
    border-radius: 28px;
    
    box-shadow: 
        0 24px 60px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset,
        0 1px 0 rgba(255, 255, 255, 0.05) inset;
    text-shadow: 0 2px 20px rgba(139, 92, 246, 0.3);
    letter-spacing: -0.03em;
    line-height: 1.15;
    
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    cursor: pointer;
}

.fixed-pianist:hover {
    background: rgba(139, 92, 246, 0.08);
    transform: translateY(-6px) scale(1.03);
    box-shadow: 
        0 32px 70px rgba(0, 0, 0, 0.35),
        0 0 40px rgba(139, 92, 246, 0.1),
        0 0 0 1px rgba(139, 92, 246, 0.15) inset;
    border-color: rgba(139, 92, 246, 0.25);
    text-shadow: 0 2px 30px rgba(139, 92, 246, 0.5);
}

.fixed-it {
    position: fixed;
    left: 3%;
    top: 20%;
    z-index: 20;
    font-size: 42px;
    font-weight: 800;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    text-align: center;
    color: white;
    
    /* Premium Glass Effect - Dark */
    background: rgba(10, 10, 30, 0.4);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    
    /* Refined borders */
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    
    padding: 44px 56px;
    border-radius: 28px;
    
    box-shadow: 
        0 24px 60px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset,
        0 1px 0 rgba(255, 255, 255, 0.05) inset;
    text-shadow: 0 2px 20px rgba(99, 102, 241, 0.3);
    letter-spacing: -0.03em;
    line-height: 1.15;
    
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    cursor: pointer;
}

.fixed-it:hover {
    background: rgba(99, 102, 241, 0.08);
    transform: translateY(-6px) scale(1.03);
    box-shadow: 
        0 32px 70px rgba(0, 0, 0, 0.35),
        0 0 40px rgba(99, 102, 241, 0.1),
        0 0 0 1px rgba(99, 102, 241, 0.15) inset;
    border-color: rgba(99, 102, 241, 0.25);
    text-shadow: 0 2px 30px rgba(99, 102, 241, 0.5);
}

.loading-bar {
    position: fixed;
    height: 3px;
    bottom: 0px;
    left: 0px;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #a78bfa);
    z-index: 2147483647;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.6);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.loading-text {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 100%;
    text-align: left;
    color: rgba(255, 255, 255, 0.7);
    display: none;
    z-index: 2147483647;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.title {
    display: none;
}

.opacity {
    background-color: #0a0a0f;
    position: fixed;
    top: 0px;
    left: 0px;
    width: 100vw;
    height: 100vh;
    opacity: 0;
    z-index: 0;
}

/* Minimum aspect ratio */
@media (min-aspect-ratio: 8/5) {}

/* Maximum aspect ratio */
@media (max-aspect-ratio: 12/10) {
    #it-img {
        background-image: url('../img/it_bg_mobile.jpg');
    }

    #pianist-img {
        background-image: url('../img/pianist_bg_mobile.jpg');
        -webkit-mask-image: none;
        mask-image: none;
    }

    .fixed-pianist {
        font-size: 18px;
        top: 18%;
        padding: 14px 24px;
        border-radius: 16px;
        font-weight: 700;
        letter-spacing: -0.02em;
    }

    .fixed-it {
        font-size: 18px;
        top: 18%;
        padding: 14px 24px;
        border-radius: 16px;
        font-weight: 700;
        letter-spacing: -0.02em;
    }

    #firma {
        display: none;
    }

    .loading-text {
        text-shadow: 0px 0px 10px rgba(0, 0, 0, 0.8);
    }

    /* Overlay sfumato nero→trasparente in alto per transizione morbida */
    /* Disabilita overlay singoli pannelli su mobile */
    #it-img::after,
    #pianist-img::after {
        background: transparent !important;
    }

    /* Unico overlay sul container — nessuna giuntura */
    .container::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(to bottom, rgba(10, 10, 15, 1) 0%, rgba(10, 10, 15, 1) 10%, rgba(10, 10, 15, 0.6) 25%, transparent 40%);
        pointer-events: none;
        z-index: 2;
    }

    .title {
        display: block;
        position: fixed;
        top: 4%;
        width: 100vw;
        text-align: center;
        font-size: 32px;
        font-weight: 800;
        font-family: 'Space Grotesk', 'Inter', sans-serif;
        letter-spacing: -0.03em;
        text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6);
        z-index: 50;
    }

    @media screen and (max-width:420px) {
        #it-img {
            background-image: url('../img/it_bg_phone.jpg');
        }

        #pianist-img {
            background-image: url('../img/pianist_bg_phone.jpg');
        }
        
        .fixed-pianist {
            font-size: 15px;
            padding: 12px 20px;
        }

        .fixed-it {
            font-size: 15px;
            padding: 12px 20px;
        }

    }
}

/* ===================================================== */
/*   CHATBOT & WIDGETS (Fixed & Clean 2025)              */
/* ===================================================== */

:root {
    --chat-primary: #6366f1;
    --chat-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --chat-bg: rgba(10, 10, 25, 0.97);
    --chat-text: #f8fafc;
}

/* ============================================= */
/*   BOTTOM BAR - Unified Navigation Bar          */
/* ============================================= */

.bottom-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    background: rgba(10, 10, 25, 0.85);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    animation: bottomBarIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}

@keyframes bottomBarIn {
    0% { opacity: 0; transform: translateX(-50%) translateY(30px); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Shared button style inside bottom bar */
.bottom-bar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 20px;
    border: none;
    border-radius: 100px;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
}

.bottom-bar-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.bottom-bar-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

.bottom-bar-btn:active {
    transform: scale(0.96);
}

/* Primary accent button (chat) */
.bottom-bar-btn.btn-primary {
    background: var(--chat-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.bottom-bar-btn.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    filter: brightness(1.1);
}

/* Label text - hidden on small screens */
.bottom-bar-btn .btn-label {
    pointer-events: none;
}

/* Divider between groups */
.bottom-bar-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

/* Responsive: collapse labels on small screens */
@media (max-width: 540px) {
    .bottom-bar {
        gap: 4px;
        padding: 5px;
        bottom: 20px;
    }
    
    .bottom-bar-btn {
        padding: 0 14px;
        height: 42px;
    }
    
    .bottom-bar-btn .btn-label {
        display: none;
    }
}

@media (max-width: 360px) {
    .bottom-bar-btn {
        padding: 0 12px;
        height: 40px;
    }
}

/* Hide bottom bar during page transition / loading */
.bottom-bar.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(-50%) translateY(20px) !important;
    transition: all 0.3s ease;
}

/* Legacy IDs kept for JS compatibility but visually hidden */
#chat-launcher, #contact-launcher {
    display: none !important;
}

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* --- 3. Chat Box (Fixed) --- */
#chat-box {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px) scale(0.95);
    width: 380px;
    height: 560px;
    max-height: 70vh;
    background: var(--chat-bg);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 
        0 25px 60px -12px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(99, 102, 241, 0.05);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#chat-box.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}

/* Desktop contextual placement: opens centered, then can move left/right by chat context */
@media (min-width: 769px) {
    #chat-box {
        --chat-shift-x: 0px;
        bottom: 96px;
        left: 50%;
        right: auto;
        transform: translateX(calc(-50% + var(--chat-shift-x))) translateY(20px) scale(0.95);
        transition:
            opacity 0.35s ease-in-out,
            visibility 0.35s,
            transform 0.55s ease-in-out;
        will-change: transform;
    }

    #chat-box.chat-pos-left {
        --chat-shift-x: calc(-50vw + 214px);
    }

    #chat-box.chat-pos-left.show {
        transform: translateX(calc(-50% + var(--chat-shift-x))) translateY(0) scale(1);
    }

    #chat-box.chat-pos-right {
        --chat-shift-x: calc(50vw - 214px);
    }

    #chat-box.chat-pos-right.show {
        transform: translateX(calc(-50% + var(--chat-shift-x))) translateY(0) scale(1);
    }

    #chat-box.show {
        transform: translateX(calc(-50% + var(--chat-shift-x))) translateY(0) scale(1);
    }
}

/* Header */
#chat-header {
    padding: 16px 20px;
    background: rgba(99, 102, 241, 0.04);
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--chat-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.avatar-image { width: 100%; height: 100%; object-fit: cover; }

.header-info h3 {
    color: white;
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.header-info span {
    color: #94a3b8;
    font-size: 12px;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#chat-close {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.25s ease;
}

#chat-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

#chat-clear {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fecaca;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px) saturate(1.2);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
}

#chat-clear:hover {
    background: rgba(239, 68, 68, 0.24);
    border-color: rgba(252, 165, 165, 0.55);
    color: #fee2e2;
}

.close-text {
    font-size: 13px;
    font-weight: 500;
    display: none; /* Hidden by default on desktop */
}

.close-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-icon svg {
    width: 20px;
    height: 20px;
}

/* Messages */
#chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE 10+ */
}

#chat-messages::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Webkit */
    width: 0;
    height: 0;
}

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

.message.bot {
    align-self: flex-start;
    background: rgba(255,255,255,0.1);
    color: #e2e8f0;
    border-bottom-left-radius: 4px;
}

.message.user {
    align-self: flex-end;
    background: var(--chat-gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.message.bot.typing {
    background: rgba(255,255,255,0.06);
    padding: 12px 16px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    display: flex;
    align-items: center;
    min-height: 40px;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.1);
    margin-bottom: 10px;
}

.dots {
    display: flex;
    gap: 4px;
}

.dots i {
    width: 8px;
    height: 8px;
    background: #6366f1;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.dots i:nth-child(1) { animation-delay: -0.32s; }
.dots i:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
.chat-input-area {
    padding: 16px;
    background: rgba(0,0,0,0.25);
    border-top: 1px solid rgba(99, 102, 241, 0.08);
}

.chat-clear-modal {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.chat-clear-modal.show {
    display: flex;
}

.chat-clear-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 7, 18, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.chat-clear-modal-content {
    position: relative;
    z-index: 1;
    width: min(320px, calc(100% - 20px));
    background: rgba(10, 10, 26, 0.86);
    border: 1px solid rgba(248, 113, 113, 0.32);
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

.chat-clear-modal-content h4 {
    margin: 0 0 8px;
    color: #fee2e2;
    font-size: 16px;
}

.chat-clear-modal-content p {
    margin: 0;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.45;
}

.chat-clear-modal-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.chat-clear-cancel,
.chat-clear-confirm {
    border-radius: 18px;
    padding: 8px 12px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
}

.chat-clear-cancel {
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    border-color: rgba(255, 255, 255, 0.12);
}

.chat-clear-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-clear-confirm {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(248, 113, 113, 0.4);
    color: #fecaca;
    backdrop-filter: blur(8px) saturate(1.15);
    -webkit-backdrop-filter: blur(8px) saturate(1.15);
}

.chat-clear-confirm:hover {
    background: rgba(239, 68, 68, 0.28);
    border-color: rgba(252, 165, 165, 0.58);
    color: #fee2e2;
}

.chat-clear-confirm svg {
    width: 15px;
    height: 15px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 14px;
    padding: 4px 4px 4px 12px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.08);
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    padding: 8px 0;
    outline: none;
    resize: none;
    overflow-y: auto;
    max-height: 60px; /* Approx 3 lines */
    line-height: 1.4;
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#chat-input::-webkit-scrollbar {
    display: none;
}

#chat-send {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 4px;
}

#chat-send:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--chat-primary);
    transform: scale(1.05);
}

#chat-send svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

/* Mic Button */
.mic-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
}

#chat-mic {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    /* margin-right: 4px; Removed, moved to wrapper */
}

#chat-mic:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

#chat-mic.listening {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    animation: pulse-red 1.5s infinite;
}

#chat-mic svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #chat-box {
        width: calc(100vw - 24px);
        max-width: 380px;
        left: 50%;
        right: auto;
    }

    .close-text {
        display: block; /* Show text on mobile */
    }

    #chat-close {
        background: rgba(239, 68, 68, 0.1);
        border-color: rgba(239, 68, 68, 0.2);
        color: #fca5a5;
        padding: 8px 16px;
    }

    #chat-clear {
        background: rgba(239, 68, 68, 0.16);
        border-color: rgba(248, 113, 113, 0.35);
        color: #fecaca;
        padding: 8px 16px;
    }
    
    #chat-close:active {
        background: rgba(239, 68, 68, 0.2);
    }

    #chat-clear:active {
        background: rgba(239, 68, 68, 0.28);
    }

    #chat-launcher {
        bottom: 30px;
        left: 30px;
        z-index: 10000; /* Ensure it's above chat box if needed, but usually we hide it or move it */
    }
    
    /* Blog post page specific mobile styles */
    .blog-post-page #chat-box {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        min-height: -webkit-fill-available !important;
        max-height: none !important;
        border-radius: 0 !important;
        border: none !important;
        z-index: 99999 !important;
        background: #0a0a1a !important;
        transform: none !important;
    }
    
    .blog-post-page #chat-box.show {
        transform: none !important;
    }
    
    /* Block body scroll when chat is open on blog */
    .blog-post-page:has(#chat-box.show) {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }

    .blog-post-page .chat-input-area,
    .blog-post-page #chat-form {
        padding: 12px !important;
        padding-bottom: 10px !important;
        background: #0a0a1a !important;
        border-radius: 0 !important;
    }

    .input-wrapper {
        max-width: calc(100% - 8px);
        margin: 0 auto;
    }

    /* Adjust input area to avoid overlap with bottom buttons if they are visible */
    /* But wait, if chat is full screen, the buttons should be hidden or behind */
    
    /* Hide launchers when chat is open on mobile */
    #chat-box.show ~ #chat-launcher,
    #chat-box.show ~ #contact-launcher {
        display: none !important;
    }
    
    /* Hide bottom bar when chat is fullscreen on mobile */
    #chat-box.show ~ .bottom-bar {
        display: none !important;
    }

    /* Prevent zoom on input focus */
    #chat-input {
        font-size: 16px !important;
    }

    /* Hide speech-to-text on mobile */
    .mic-wrapper {
        display: none !important;
    }
}


/* === Custom Audio Player (SoundCloud style) === */
.custom-audio-player {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 100%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.custom-audio-player .player-main-row {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 4px;
}

.custom-audio-player .play-btn {
    background: var(--chat-gradient);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 12px;
    font-size: 14px;
    flex-shrink: 0;
    transition: transform 0.1s ease;
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.3);
}

.custom-audio-player .play-btn:active {
    transform: scale(0.95);
}

.custom-audio-player .time-display {
    font-size: 10px;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    font-weight: 500;
    padding-left: 48px; /* Align with waveform start (36px btn + 12px margin) */
}

/* Track Title in Custom Player */
.custom-audio-player .track-title {
    font-size: 12px;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Audio Loading Placeholder */
.audio-loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    margin: 10px 0;
    width: 100%;
    height: 100px;
    padding: 0 20px;
    box-sizing: border-box;
    animation: pulse-bg 1.5s infinite ease-in-out;
}

.audio-loading-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    width: auto;
    max-width: 100%;
}

.audio-loading-content i {
    font-size: 20px;
    margin: 0;
    padding: 0;
    display: block;
    flex-shrink: 0;
}

.audio-loading-content span {
    margin: 0;
    padding: 0;
    line-height: 1.4;
    display: block;
}

@keyframes pulse-bg {
    0% { background-color: rgba(255, 255, 255, 0.05); }
    50% { background-color: rgba(255, 255, 255, 0.1); }
    100% { background-color: rgba(255, 255, 255, 0.05); }
}

/* --- Quick Replies (Chips) --- */
.chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
    margin-top: 10px;
}

.chat-chip {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chat-chip:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    color: white;
    transform: translateY(-1px);
}

/* --- TTS Speaker Icon --- */
.message-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    opacity: 0.7;
}

.tts-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tts-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.tts-btn.playing {
    color: #6366f1;
    animation: pulse-blue 1.5s infinite;
}

.tts-btn svg {
    width: 14px;
    height: 14px;
}

@keyframes pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

/* --- TTS Button Text --- */
.tts-btn {
    border-radius: 16px; /* Più arrotondato per contenere il testo */
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.05);
}

.tts-btn span {
    margin-left: 6px;
    font-size: 12px;
    font-weight: 500;
}

.tts-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* --- Chat Headers --- */
.message h1, 
.message h2, 
.message h3 {
    margin-top: 10px;
    margin-bottom: 5px;
    font-weight: 600;
    line-height: 1.3;
}

.message h1 { font-size: 1.4em; }
.message h2 { font-size: 1.2em; }
.message h3 { font-size: 1.1em; }

/* --- Chat Links --- */
.message a,
.contact-link {
    color: #a78bfa !important; /* Soft violet */
    text-decoration: underline;
    text-decoration-color: rgba(167, 139, 250, 0.3);
    text-underline-offset: 2px;
    font-weight: 500;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.message a:hover,
.contact-link:hover {
    color: #c4b5fd !important; /* Lighter violet on hover */
    text-decoration-color: rgba(196, 181, 253, 0.6);
}

/* --- Social Icons Hover Effect --- */
.social-icons {
    transition: filter 0.3s ease;
}

.social-icons:hover {
    filter: brightness(0) invert(1);
}

/* Legacy blog link - now in bottom bar */
.home-blog-link {
    display: none !important;
}

/* === CRT Overlay Effect === */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 11;
    pointer-events: none;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%,
        rgba(0, 0, 0, 0.25) 50%
    ), linear-gradient(
        90deg,
        rgba(255, 0, 0, 0.06),
        rgba(0, 255, 0, 0.02),
        rgba(0, 0, 255, 0.06)
    );
    background-size: 100% 4px, 6px 100%;
    opacity: 0;
    transition: opacity 0.8s ease;
}

/* ============================================= */
/*   PREMIUM DARK THEME - ADDITIONAL STYLES      */
/* ============================================= */

/* Spinner Name */
.spinner-name {
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 6px;
    text-transform: uppercase;
    animation: fadeInName 1.5s ease-in-out;
}

@keyframes fadeInName {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Name Badge (Signature area) */
.name-badge {
    position: absolute;
    bottom: 20px;
    right: 40px;
    z-index: 20;
    text-align: center;
    filter: brightness(1.2);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.name-badge:hover {
    opacity: 1;
}

/* Card Label Numbers */
.card-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 4px;
    opacity: 0.35;
    margin-bottom: 12px;
    font-family: 'Space Grotesk', monospace;
}

/* Card Arrow */
.card-arrow {
    display: block;
    margin-top: 16px;
    opacity: 0.3;
    transition: all 0.4s ease;
}

.card-arrow svg {
    width: 20px;
    height: 20px;
}

.fixed-it:hover .card-arrow,
.fixed-pianist:hover .card-arrow {
    opacity: 0.8;
    transform: translateX(6px);
}

/* Smooth entrance animations */
@keyframes slideInLeft {
    0% { opacity: 0; transform: translateX(-30px); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    0% { opacity: 0; transform: translateX(30px); }
    100% { opacity: 1; transform: translateX(0); }
}

.fixed-it {
    animation: slideInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}

.fixed-pianist {
    animation: slideInRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}




/* Hide card elements on mobile */
@media (max-aspect-ratio: 12/10) {
    .card-arrow {
        display: none;
    }
    
    .card-label {
        display: none;
    }
    
    .name-badge {
        display: none;
    }
}

/* Audio player gradient update */
.custom-audio-player .play-btn {
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Scrollbar for all scroll areas */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.4);
}

/* Blog mobile responsive for chat close */
@media (max-width: 768px) {
    .blog-post-page #chat-box {
        background: #0a0a0f !important;
    }
    
    .blog-post-page .chat-input-area,
    .blog-post-page #chat-form {
        background: #0a0a0f !important;
    }
}
