/**
 * Hotel Porto Brasil - Chatbot Styles v2.0 (Modernizado)
 */

:root {
    --chat-primary: #6B4423;
    --chat-primary-hover: #8a562c;
    --chat-bg: #ffffff;
    --chat-surface: #f8fafc;
    --chat-border: #e2e8f0;
    --chat-text: #0f172a;
    --chat-text-secondary: #64748b;
    --chat-bubble-user: #1f2937;
    --chat-bubble-bot: #ffffff;
    --chat-shadow: rgba(15, 23, 42, 0.1);
    --chat-shadow-lg: rgba(15, 23, 42, 0.28);
}

[data-theme="dark"] {
    --chat-primary: #dcb86a;
    --chat-primary-hover: #e8c781;
    --chat-bg: #1a1a1a;
    --chat-surface: #2d2d2d;
    --chat-border: #404040;
    --chat-text: #e5e5e5;
    --chat-text-secondary: #a3a3a3;
    --chat-bubble-user: #dcb86a;
    --chat-bubble-bot: #2d2d2d;
    --chat-shadow: rgba(0, 0, 0, 0.3);
    --chat-shadow-lg: rgba(0, 0, 0, 0.5);
}

/* Chatbot Container */
#hpb-chatbot {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 2147483000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* Launcher */
.hpb-chat-launcher {
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    min-height: 86px;
}

/* Promo Balloon */
.hpb-chat-promo {
    position: absolute;
    right: 84px;
    bottom: 10px;
    width: 248px;
    border-radius: 18px;
    background: linear-gradient(135deg, #8a562c 0%, #6B4423 100%);
    color: #fff;
    box-shadow: 0 12px 32px rgba(107, 68, 35, 0.4);
    cursor: pointer;
    overflow: visible;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.hpb-chat-promo:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 16px 40px rgba(107, 68, 35, 0.5);
}

.hpb-chat-promo::after {
    content: '';
    position: absolute;
    right: -10px;
    bottom: 20px;
    border-left: 10px solid #6B4423;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
}

.hpb-chat-promo strong {
    display: block;
    padding: 16px 16px 0;
    font-size: 1.05rem;
    line-height: 1.2;
    font-weight: 700;
}

.hpb-chat-promo span {
    display: block;
    padding: 5px 16px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.95;
}

.hpb-chat-promo-cta {
    padding: 10px 14px;
    background: linear-gradient(135deg, #fbf6f1 0%, #f5ece4 100%);
    color: #6B4423;
    font-weight: 700;
    text-align: center;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.hpb-chat-promo-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.hpb-chat-promo:hover .hpb-chat-promo-cta::before {
    left: 100%;
}

.hpb-chat-promo-close {
    position: absolute;
    right: 6px;
    top: 6px;
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    border-radius: 50%;
    display: grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
    line-height: 1;
    font-size: 14px;
    font-weight: 400;
    box-shadow: none;
    transition: all 0.2s ease;
    z-index: 10;
    opacity: 0.8;
}

.hpb-chat-promo-close:hover {
    background: rgba(0, 0, 0, 0.45);
    opacity: 1;
    transform: scale(1.1);
}

/* FAB Button */
.hpb-chat-fab {
    position: relative;
    width: 80px;
    height: 80px;
    border: 3px solid #dcb86a;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 12px 28px var(--chat-shadow-lg);
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hpb-chat-fab:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 16px 36px var(--chat-shadow-lg);
    border-color: var(--chat-primary);
}

.hpb-chat-fab:active {
    transform: translateY(-1px) scale(1.02);
}

.hpb-chat-fab-avatar {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--chat-text);
}

.hpb-chat-fab-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hpb-chat-fab-badge {
    position: absolute;
    right: -4px;
    top: -4px;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    border-radius: 999px;
    border: 3px solid #fff;
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    animation: pulse 2s infinite;
}

.hpb-chat-fab-badge.hidden {
    display: none;
}

.hpb-chat-launcher.promo-hidden .hpb-chat-promo {
    display: none;
}

/* Panel */
.hpb-chat-panel {
    position: absolute;
    right: 0;
    bottom: 100px;
    width: 420px;
    max-width: calc(100vw - 20px);
    height: 640px;
    max-height: calc(100vh - 130px);
    display: none;
    flex-direction: column;
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 56px var(--chat-shadow-lg);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hpb-chat-panel.open {
    display: flex;
}

/* Header */
.hpb-chat-header {
    background: linear-gradient(135deg, var(--chat-primary), #1f2937);
    padding: 16px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.hpb-chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent);
    border-radius: 50%;
}

.hpb-chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.hpb-chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    overflow: hidden;
    display: grid;
    place-items: center;
    color: var(--chat-text);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hpb-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hpb-chat-avatar-fallback i {
    font-size: 1.25rem;
}

.hpb-chat-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
}

.hpb-chat-subtitle {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-top: 2px;
}

.hpb-chat-header-actions {
    display: flex;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.hpb-chat-icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.hpb-chat-icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.hpb-chat-icon-btn:active {
    transform: scale(0.95);
}

/* Body */
.hpb-chat-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    background: var(--chat-surface);
    position: relative;
}

.hpb-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.hpb-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.hpb-chat-messages::-webkit-scrollbar-thumb {
    background: var(--chat-border);
    border-radius: 10px;
}

.hpb-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--chat-text-secondary);
}

/* Messages */
.hpb-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: messageSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hpb-chat-message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.hpb-chat-message.bot {
    align-self: flex-start;
    align-items: flex-start;
}

.hpb-chat-bubble {
    padding: 12px 15px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 2px 8px var(--chat-shadow);
    transition: all 0.2s ease;
}

.hpb-chat-message.user .hpb-chat-bubble {
    background: var(--chat-bubble-user);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.hpb-chat-message.bot .hpb-chat-bubble {
    background: var(--chat-bubble-bot);
    color: var(--chat-text);
    border: 1px solid var(--chat-border);
    border-bottom-left-radius: 4px;
}

.hpb-chat-bubble:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--chat-shadow);
}

.hpb-chat-time {
    font-size: 0.7rem;
    color: var(--chat-text-secondary);
    margin-top: 5px;
    padding: 0 4px;
}

/* Rating Buttons */
.hpb-chat-rating {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.hpb-chat-rating-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--chat-border);
    background: var(--chat-bg);
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.hpb-chat-rating-btn:hover {
    transform: scale(1.1);
    border-color: var(--chat-primary);
}

.hpb-chat-rating-btn.liked {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.hpb-chat-rating-btn.disliked {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

/* Action Buttons */
.hpb-chat-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.hpb-chat-action {
    border: 1px solid var(--chat-border);
    background: var(--chat-bg);
    color: var(--chat-text);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.hpb-chat-action:hover {
    border-color: var(--chat-primary);
    background: var(--chat-surface);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--chat-shadow);
}

.hpb-chat-action.whatsapp {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: #fff;
    border-color: #25d366;
}

.hpb-chat-action.whatsapp:hover {
    background: linear-gradient(135deg, #128c7e, #075e54);
    border-color: #128c7e;
}

/* Flow Buttons */
.hpb-chat-flow {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.hpb-chat-flow-btn {
    border: 1px solid var(--chat-primary);
    background: transparent;
    color: var(--chat-primary);
    border-radius: 999px;
    padding: 7px 13px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hpb-chat-flow-btn:hover {
    background: var(--chat-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 68, 35, 0.3);
}

/* Room Carousel */
.hpb-chat-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 12px 0;
    margin-top: 12px;
    scroll-snap-type: x mandatory;
}

.hpb-chat-carousel::-webkit-scrollbar {
    height: 4px;
}

.hpb-chat-carousel::-webkit-scrollbar-thumb {
    background: var(--chat-primary);
    border-radius: 10px;
}

.hpb-chat-room-card {
    min-width: 200px;
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--chat-bg);
    scroll-snap-align: start;
    transition: all 0.3s ease;
}

.hpb-chat-room-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px var(--chat-shadow);
}

.hpb-chat-room-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.hpb-chat-room-info {
    padding: 10px;
}

.hpb-chat-room-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--chat-text);
    margin-bottom: 4px;
}

.hpb-chat-room-price {
    color: var(--chat-primary);
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.hpb-chat-room-btn {
    width: 100%;
    padding: 6px;
    border: 1px solid var(--chat-primary);
    background: var(--chat-primary);
    color: #fff;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hpb-chat-room-btn:hover {
    background: var(--chat-primary-hover);
    transform: scale(1.02);
}

/* Quick Buttons */
.hpb-chat-quick {
    padding: 12px;
    border-top: 1px solid var(--chat-border);
    background: var(--chat-bg);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    overflow: auto;
    max-height: 100px;
}

.hpb-chat-quick-btn {
    border: 1px solid var(--chat-border);
    background: var(--chat-surface);
    color: var(--chat-text);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    gap: 6px;
    align-items: center;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.hpb-chat-quick-btn:hover {
    background: #eef2ff;
    border-color: #818cf8;
    color: #4f46e5;
    transform: scale(1.05);
}

/* Footer */
.hpb-chat-footer {
    padding: 12px;
    border-top: 1px solid var(--chat-border);
    background: var(--chat-bg);
}

.hpb-chat-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

#hpb-chat-input {
    flex: 1;
    border: 1px solid var(--chat-border);
    border-radius: 999px;
    padding: 11px 14px;
    font-size: 0.9rem;
    outline: none;
    background: var(--chat-surface);
    color: var(--chat-text);
    transition: all 0.2s ease;
}

#hpb-chat-input:focus {
    border-color: var(--chat-primary);
    box-shadow: 0 0 0 3px rgba(107, 68, 35, 0.1);
    background: var(--chat-bg);
}

#hpb-chat-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 0;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-hover));
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(107, 68, 35, 0.3);
}

#hpb-chat-send:hover {
    background: linear-gradient(135deg, var(--chat-primary-hover), var(--chat-primary));
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(107, 68, 35, 0.4);
}

#hpb-chat-send:active {
    transform: scale(0.95);
}

#hpb-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.hpb-chat-note {
    margin-top: 8px;
    font-size: 0.7rem;
    color: var(--chat-text-secondary);
    text-align: center;
}

/* Typing Indicator */
.hpb-chat-typing {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
}

.hpb-chat-typing span {
    width: 8px;
    height: 8px;
    background: var(--chat-text-secondary);
    border-radius: 50%;
    animation: typingBounce 1.2s infinite;
}

.hpb-chat-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.hpb-chat-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Proactive Message */
.hpb-chat-proactive {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 12px;
    max-width: 320px;
    padding: 14px 16px;
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    border-radius: 14px;
    box-shadow: 0 12px 28px var(--chat-shadow-lg);
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.hpb-chat-proactive:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px var(--chat-shadow-lg);
}

.hpb-chat-proactive-text {
    color: var(--chat-text);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 10px;
}

.hpb-chat-proactive-btn {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--chat-primary);
    background: var(--chat-primary);
    color: #fff;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hpb-chat-proactive-btn:hover {
    background: var(--chat-primary-hover);
}

/* Animations */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes typingBounce {
    0%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

/* Responsive */
@media (max-width: 560px) {
    #hpb-chatbot {
        right: 10px;
        bottom: 10px;
    }
    
    .hpb-chat-promo {
        right: 70px;
        bottom: 8px;
        width: 220px;
    }
    
    .hpb-chat-fab {
        width: 70px;
        height: 70px;
    }
    
    .hpb-chat-panel {
        right: 0;
        left: 0;
        bottom: 88px;
        width: calc(100vw - 20px);
        height: 75vh;
        max-height: 75vh;
        margin: 0 10px;
    }
    
    .hpb-chat-proactive {
        max-width: 280px;
    }
}
