/* Hotel Chatbot - Z-INDEX FIX + Visual Debug */

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ============================================
   CHATBOT TOGGLE BUTTON - CRITICAL Z-INDEX
   ============================================ */
.hcb-toggle {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 80px !important;
    height: 80px !important;
    min-width: 80px !important;
    min-height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    border-radius: 50% !important;
    background: url('https://mammalolita.it/wp-content/uploads/2026/06/mammanew.jpg') center center no-repeat !important;
    background-size: cover !important;
    border: 3px solid #BD9035 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
    cursor: pointer !important;
    /* CRITICAL: Z-index altissimo */
    z-index: 666998 !important;
    overflow: visible !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0 !important;
    padding: 0 !important;
    /* CRITICAL: Assicura che sia cliccabile */
    pointer-events: auto !important;
}

.hcb-toggle:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 6px 16px rgba(189, 144, 53, 0.4) !important;
    /* Debug visivo */
    outline: 2px solid red !important;
}

.hcb-toggle:active {
    transform: scale(0.95) !important;
    /* Debug visivo */
    outline: 4px solid green !important;
}

/* ============================================
   NOTIFICATION BADGE
   ============================================ */
.hcb-badge {
    position: absolute !important;
    top: -10px !important;
    right: -10px !important;
    background: #ff4444 !important;
    color: white !important;
    border-radius: 50% !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: bold !important;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.5) !important;
    z-index: 666998 !important;
    border: 2px solid white !important;
    animation: hcb-pulse 2s infinite !important;
    pointer-events: none !important;
}

@keyframes hcb-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============================================
   CHATBOT CONTAINER
   ============================================ */
.hcb-container {
    position: fixed !important;
    bottom: 110px !important;
    right: 20px !important;
    width: 400px !important;
    max-width: calc(100vw - 40px) !important;
    height: 600px !important;
    max-height: calc(100vh - 140px) !important;
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2) !important;
    z-index: 666998 !important;
    overflow: hidden !important;
    flex-direction: column !important;
    display: none !important;
}

.hcb-container:not(.hidden) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ============================================
   HEADER
   ============================================ */
.hcb-header {
    background: linear-gradient(135deg, #BD9035 0%, #D4A855 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    gap: 12px;
}

/* Contenitore bottoni header */
.hcb-header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
}

.hcb-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.hcb-header .hcb-avatar {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    border-radius: 50% !important;
    background: url('https://mammalolita.it/wp-content/uploads/2026/06/mammanew.jpg') center center no-repeat !important;
    background-size: cover !important;
    border: 2px solid white !important;
    font-size: 0 !important;
    flex-shrink: 0 !important;
}

.hcb-header-text h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.hcb-header-text p {
    margin: 4px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hcb-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: hcb-blink 2s infinite;
}

@keyframes hcb-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.hcb-close {
    background: rgba(255,255,255,0.2) !important;
    border: none !important;
    border-radius: 8px !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s ease !important;
    font-size: 24px !important;
    line-height: 1 !important;
    color: white !important;
    padding: 0 !important;
    font-weight: normal !important;
    flex-shrink: 0 !important;
}

.hcb-close:hover {
    background: rgba(255,255,255,0.3) !important;
}

/* Bottone cancella cronologia */
.hcb-clear-history {
    background: rgba(255,255,255,0.2) !important;
    border: none !important;
    border-radius: 8px !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s ease !important;
    font-size: 18px !important;
    line-height: 1 !important;
    color: white !important;
    padding: 0 !important;
    font-weight: normal !important;
    flex-shrink: 0 !important;
}

.hcb-clear-history:hover {
    background: rgba(255,100,100,0.3) !important;
}

/* ============================================
   MESSAGES AREA
   ============================================ */
.hcb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hcb-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: hcb-slide-in 0.3s ease;
}

@keyframes hcb-slide-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hcb-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.hcb-message-bot .hcb-message-avatar {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    background: url('https://mammalolita.it/wp-content/uploads/2026/06/mammanew.jpg') center center no-repeat !important;
    background-size: cover !important;
    border: 1px solid #BD9035 !important;
    font-size: 0 !important;
}

.hcb-message-user .hcb-message-avatar {
    display: none !important;
}

.hcb-message-content {
    flex: 1;
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
    color: #333;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.hcb-message-user .hcb-message-content {
    background: #BD9035;
    color: white;
}

.hcb-message-actions {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hcb-action-button {
    padding: 10px 16px;
    border: 1px solid #BD9035;
    background: white;
    color: #BD9035;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: left;
    text-decoration: none;
    display: block;
}

.hcb-action-button:hover {
    background: #BD9035;
    color: white;
    transform: translateX(2px);
}

/* ============================================
   TYPING INDICATOR
   ============================================ */
.hcb-typing {
    display: flex;
    gap: 10px;
    max-width: 85%;
    padding: 0 20px 10px 20px;
}

.hcb-typing .hcb-message-avatar {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    background: url('https://mammalolita.it/wp-content/uploads/2026/06/mammanew.jpg') center center no-repeat !important;
    background-size: cover !important;
    border: 1px solid #BD9035 !important;
    font-size: 0 !important;
}

.hcb-typing-dots {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    gap: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.hcb-typing-dot {
    width: 8px;
    height: 8px;
    background: #BD9035;
    border-radius: 50%;
    animation: hcb-typing 1.4s infinite;
}

.hcb-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.hcb-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes hcb-typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* ============================================
   INPUT AREA
   ============================================ */
.hcb-input {
    padding: 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.hcb-input-field {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.hcb-input-field:focus {
    border-color: #BD9035;
}

.hcb-send {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    background: #BD9035 !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s ease, transform 0.2s ease !important;
    flex-shrink: 0 !important;
    color: white !important;
    font-size: 20px !important;
    line-height: 1 !important;
    padding: 0 !important;
}

.hcb-send:hover {
    background: #D4A855 !important;
    transform: scale(1.05) !important;
}

.hcb-send:active {
    transform: scale(0.95) !important;
}

/* ============================================
   NOTIFICATION BUBBLE
   ============================================ */
.hcb-notification-bubble {
    position: fixed;
    bottom: 110px;
    right: 110px;
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    max-width: 280px;
    z-index: 666998;
    animation: hcb-slide-in-right 0.4s ease;
}

@keyframes hcb-slide-in-right {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.hcb-notification-close {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    font-size: 20px !important;
    line-height: 1 !important;
    color: #999 !important;
    transition: color 0.2s ease !important;
}

.hcb-notification-close:hover {
    color: #333 !important;
}

.hcb-notification-content {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    padding-right: 20px;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .hcb-container {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 90px;
        height: calc(100vh - 120px);
    }
    
    .hcb-toggle {
        right: 10px !important;
        bottom: 10px !important;
        width: 60px !important;
        height: 60px !important;
        min-width: 60px !important;
        max-width: 60px !important;
        min-height: 60px !important;
        max-height: 60px !important;
    }
    
    .hcb-notification-bubble {
        right: 80px;
        bottom: 80px;
        max-width: calc(100vw - 100px);
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
.hcb-messages::-webkit-scrollbar {
    width: 6px;
}

.hcb-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.hcb-messages::-webkit-scrollbar-thumb {
    background: #BD9035;
    border-radius: 3px;
}

.hcb-messages::-webkit-scrollbar-thumb:hover {
    background: #D4A855;
}