/* Chatbot Styles for Internet Pros */

/* Chat Button */
.chatbot-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e84444 0%, #c73636 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(232, 68, 68, 0.4);
    z-index: 9999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(232, 68, 68, 0.5);
}

.chatbot-button svg {
    width: 28px;
    height: 28px;
    fill: #fff;
    transition: transform 0.3s ease;
}

.chatbot-button.active svg.chat-icon {
    display: none;
}

.chatbot-button svg.close-icon {
    display: none;
}

.chatbot-button.active svg.close-icon {
    display: block;
}

.chatbot-button.active svg.chat-icon {
    display: none;
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

.chatbot-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chatbot-header {
    background: linear-gradient(135deg, #303032 0%, #1a1a1b 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e84444 0%, #c73636 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-avatar svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

.chatbot-header-info h4 {
    color: #fff;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-header-info p {
    color: rgba(255, 255, 255, 0.7);
    margin: 2px 0 0;
    font-size: 12px;
}

.chatbot-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.chatbot-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Chat Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f8f9fa;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

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

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

.chat-message.bot {
    align-self: flex-start;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e84444 0%, #c73636 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-avatar svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

.chat-message.user .message-avatar {
    background: #303032;
}

.message-content {
    background: #fff;
    padding: 12px 16px;
    border-radius: 16px;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chat-message.user .message-content {
    background: linear-gradient(135deg, #e84444 0%, #c73636 100%);
    color: #fff;
    border-radius: 16px;
    border-top-right-radius: 4px;
}

.message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

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

.chat-message.user .message-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 16px;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #ccc;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); background: #ccc; }
    30% { transform: translateY(-5px); background: #e84444; }
}

/* Quick Replies */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.quick-reply-btn {
    background: #fff;
    border: 1px solid #e84444;
    color: #e84444;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-reply-btn:hover {
    background: #e84444;
    color: #fff;
}

/* Chat Input */
.chatbot-input {
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-input input {
    flex: 1;
    border: 1px solid #e5e5e5;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.chatbot-input input:focus {
    border-color: #e84444;
}

.chatbot-input input::placeholder {
    color: #aaa;
}

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

.chatbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(232, 68, 68, 0.4);
}

.chatbot-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.chatbot-send-btn svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* Mobile Responsive - Medium screens */
@media (max-width: 768px) {
    .chatbot-window {
        width: 340px;
        height: 480px;
    }

    .chatbot-header {
        padding: 15px;
    }

    .chatbot-avatar {
        width: 40px;
        height: 40px;
    }

    .chatbot-header-info h4 {
        font-size: 15px;
    }

    /* Quick replies - larger touch targets */
    .quick-reply-btn {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .chatbot-button.near-footer {
        bottom: 80px;
    }
}

/* Mobile Responsive - Small screens */
@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: calc(100vh - 70px);
        max-height: none;
        border-radius: 16px 16px 0 0;
    }

    .chatbot-button {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .chatbot-header {
        padding: 15px;
    }

    .chatbot-avatar {
        width: 38px;
        height: 38px;
    }

    .chatbot-avatar svg {
        width: 20px;
        height: 20px;
    }

    .chatbot-header-info h4 {
        font-size: 14px;
    }

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

    .chatbot-messages {
        padding: 15px;
        gap: 12px;
    }

    .message-content {
        padding: 10px 14px;
    }

    .message-content p {
        font-size: 14px;
    }

    /* Quick replies - optimized for thumb navigation */
    .quick-replies {
        gap: 8px;
        margin-top: 12px;
    }

    .quick-reply-btn {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px;
        border-radius: 22px;
        flex: 1 1 auto;
        min-width: calc(50% - 4px);
        text-align: center;
    }

    /* Chat input - larger for mobile */
    .chatbot-input {
        padding: 12px 15px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .chatbot-input input {
        padding: 14px 18px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 48px;
    }

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

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

/* Extra small screens */
@media (max-width: 320px) {
    .chatbot-button {
        bottom: 15px;
        right: 15px;
        width: 52px;
        height: 52px;
    }

    .chatbot-button svg {
        width: 24px;
        height: 24px;
    }

    .quick-reply-btn {
        padding: 10px 12px;
        font-size: 13px;
        min-width: 100%;
    }

    .message-content p {
        font-size: 13px;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .chatbot-window {
        height: 90vh;
        max-height: 90vh;
    }

    .chatbot-header {
        padding: 10px 15px;
    }

    .chatbot-avatar {
        width: 35px;
        height: 35px;
    }

    .chatbot-messages {
        padding: 10px 15px;
    }
}

/* Safe area support for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 480px) {
        .chatbot-window {
            padding-bottom: env(safe-area-inset-bottom);
        }

        .chatbot-input {
            padding-bottom: calc(12px + env(safe-area-inset-bottom));
        }
    }
}
