/* Chatbot Widget Styles - Matching Guestlyhub Theme */

:root {
    --chatbot-primary: #ff6b6b;
    --chatbot-secondary: #c44569;
    --chatbot-bg: #ffffff;
    --chatbot-user-bg: #ff6b6b;
    --chatbot-bot-bg: #f1f3f5;
    --chatbot-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* Prevent iOS zoom on any text */
* {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Chatbot Button (Floating) */
.chatbot-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--chatbot-shadow);
    z-index: 9998;
    transition: all 0.3s ease;
    border: none;
    /* Better touch target on mobile */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 50px rgba(255, 107, 107, 0.3);
}

.chatbot-button i {
    color: white;
    font-size: 28px;
}

.chatbot-button.open {
    transform: rotate(90deg);
}

/* Chatbot Notification Badge */
.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff3b3b;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid white;
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 600px;
    background: var(--chatbot-bg);
    border-radius: 16px;
    box-shadow: var(--chatbot-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    animation: slideUp 0.3s ease;
    /* Better mobile behavior */
    -webkit-overflow-scrolling: touch;
}

.chatbot-window.open {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

.chatbot-header-text h3 {
    font-size: 16px;
    margin-bottom: 2px;
}

.chatbot-header-text p {
    font-size: 12px;
    opacity: 0.9;
}

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

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chatbot Messages */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.chatbot-message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message.user {
    align-items: flex-end;
}

.chatbot-message.bot {
    align-items: flex-start;
}

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

.chatbot-message.user .chatbot-message-content {
    background: var(--chatbot-user-bg);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-message.bot .chatbot-message-content {
    background: var(--chatbot-bot-bg);
    color: #333;
    border-bottom-left-radius: 4px;
}

.chatbot-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

/* Chatbot Typing Indicator */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.chatbot-typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* Quick Replies */
.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 20px;
}

.chatbot-quick-reply {
    background: white;
    border: 2px solid var(--chatbot-primary);
    color: var(--chatbot-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-quick-reply:hover {
    background: var(--chatbot-primary);
    color: white;
}

/* Suggested Articles */
.chatbot-article-card {
    background: white;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    border-left: 3px solid var(--chatbot-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-article-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chatbot-article-title {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    margin-bottom: 5px;
}

.chatbot-article-desc {
    font-size: 12px;
    color: #666;
}

/* Chatbot Input */
.chatbot-input {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
}

.chatbot-input input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.chatbot-input input:focus {
    border-color: var(--chatbot-primary);
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-send-btn:hover {
    transform: scale(1.1);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        max-height: -webkit-fill-available; /* iOS viewport fix */
        border-radius: 0;
        animation: slideUpMobile 0.3s ease;
        /* Prevent zoom on iOS */
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }

    .chatbot-button {
        bottom: 20px;
        bottom: calc(20px + env(safe-area-inset-bottom)); /* iOS safe area */
        right: 20px;
        right: calc(20px + env(safe-area-inset-right));
        width: 56px;
        height: 56px;
    }

    .chatbot-button i {
        font-size: 24px;
    }

    .chatbot-header {
        padding: 16px 20px;
    }

    .chatbot-header-text h3 {
        font-size: 15px;
    }

    .chatbot-header-text p {
        font-size: 11px;
    }

    .chatbot-messages {
        padding: 16px;
    }

    .chatbot-message-content {
        max-width: 85%;
        font-size: 15px; /* Increased to prevent zoom */
    }

    .chatbot-input {
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom)); /* iOS safe area */
    }

    .chatbot-input input {
        font-size: 16px; /* Prevents zoom on iOS */
        /* Additional iOS zoom prevention */
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    .chatbot-quick-replies {
        padding: 10px 16px;
    }

    .chatbot-quick-reply {
        padding: 10px 16px;
        font-size: 15px; /* Increased to prevent zoom */
    }

    .chatbot-article-card {
        margin-top: 8px;
    }

    .chatbot-article-title {
        font-size: 15px; /* Increased to prevent zoom */
    }

    .chatbot-article-desc {
        font-size: 14px; /* Increased to prevent zoom */
    }
}

/* Tablet Responsive */
@media (max-width: 768px) and (min-width: 481px) {
    .chatbot-window {
        bottom: 90px;
        right: 20px;
        width: 400px;
        height: 550px;
        border-radius: 16px;
    }
}

/* Small Mobile (iPhone SE, etc.) */
@media (max-width: 375px) {
    .chatbot-header {
        padding: 14px 16px;
    }

    .chatbot-avatar {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .chatbot-messages {
        padding: 12px;
    }

    .chatbot-input {
        padding: 12px;
    }

    .chatbot-send-btn {
        width: 40px;
        height: 40px;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .chatbot-window {
        height: 100vh;
        max-height: none;
    }

    .chatbot-messages {
        padding: 12px 16px;
    }
}

/* Scrollbar Styling */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}
