/**
 * CSBL Chatbot Styles
 * Modern chat interface with green theme
 */

/* Support Section */
.support {
    padding: 60px 0 80px 0;
    background: #f8f9fa;
    min-height: calc(100vh - 200px);
}

.support .section-title {
    text-align: center;
    padding-bottom: 30px;
}

.support .section-title h2 {
    font-size: 32px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 20px;
    padding-bottom: 0;
    color: #2c3e50;
}

.support .section-title p {
    margin-bottom: 0;
    font-size: 16px;
    color: #6c757d;
}

/* Chatbot Container */
.chatbot-container {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 30px;
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #198754 0%, #157347 100%);
    color: #fff;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-header h4 {
    margin: 0 0 5px 0;
    font-size: 20px;
    font-weight: 600;
}

.chatbot-header h4 i {
    margin-right: 8px;
}

.chatbot-header .chat-status {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
}

.chatbot-header .chat-status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

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

/* Chat Messages Area */
.chatbot-messages {
    height: 500px;
    overflow-y: auto;
    padding: 25px;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

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

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

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

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

/* Welcome Message */
.welcome-message {
    margin-bottom: 20px;
}

/* Message Bubbles */
.bot-message,
.user-message {
    display: flex;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease-out;
}

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

.bot-message {
    justify-content: flex-start;
}

.user-message {
    justify-content: flex-end;
}

/* Message Avatar */
.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bot-message .message-avatar {
    background: #198754;
    color: #fff;
    margin-right: 12px;
}

.user-message .message-avatar {
    background: #2c3e50;
    color: #fff;
    margin-left: 12px;
}

.message-avatar i {
    font-size: 20px;
}

/* Message Content */
.message-content {
    max-width: 70%;
    background: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.bot-message .message-content {
    border-bottom-left-radius: 4px;
}

.user-message .message-content {
    background: #198754;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message-content p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-content p + p {
    margin-top: 6px;
}

.message-content ul,
.message-content ol {
    margin: 4px 0;
    padding-left: 20px;
}

.message-content li {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 2px;
}

.message-content strong {
    font-weight: 600;
}

.msg-spacer {
    height: 6px;
}

.message-time {
    display: block;
    font-size: 11px;
    margin-top: 6px;
    opacity: 0.7;
}

.user-message .message-time {
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    padding: 0 25px;
    background: #f8f9fa;
}

.typing-dots {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    margin: 0 2px;
    background: #198754;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite;
}

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

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

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

/* Input Area */
.chatbot-input-area {
    padding: 20px 25px;
    background: #fff;
    border-top: 1px solid #e9ecef;
}

.chatbot-input-area .input-group {
    display: flex;
}

.chatbot-input-area .form-control {
    border: 2px solid #e9ecef;
    border-radius: 25px 0 0 25px;
    padding: 12px 20px;
    font-size: 15px;
    transition: border-color 0.3s ease;
}

.chatbot-input-area .form-control:focus {
    border-color: #198754;
    box-shadow: none;
    outline: none;
}

.chatbot-input-area .btn-send {
    background: #198754;
    color: #fff;
    border: 2px solid #198754;
    border-radius: 0 25px 25px 0;
    padding: 12px 25px;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.chatbot-input-area .btn-send:hover {
    background: #157347;
    border-color: #157347;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(25, 135, 84, 0.3);
}

.chatbot-input-area .btn-send:active {
    transform: translateY(0);
}

.chatbot-input-area .btn-send:disabled {
    background: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.chatbot-input-area .btn-send i {
    margin-right: 5px;
}

/* Error Message */
.error-message {
    color: #dc3545;
    font-size: 14px;
    padding: 10px 0 0 0;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .support {
        padding: 40px 0 60px 0;
    }

    .support .section-title h2 {
        font-size: 28px;
    }

    .chatbot-messages {
        height: 400px;
        padding: 20px 15px;
    }

    .message-content {
        max-width: 85%;
    }

    .chatbot-input-area {
        padding: 15px;
    }

    .chatbot-input-area .form-control {
        padding: 10px 15px;
        font-size: 14px;
    }

    .chatbot-input-area .btn-send {
        padding: 10px 20px;
        font-size: 14px;
    }

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

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

@media (max-width: 480px) {
    .chatbot-messages {
        height: 350px;
    }

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

    .message-avatar i {
        font-size: 18px;
    }

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

    .chatbot-input-area .btn-send span {
        display: none;
    }

    .chatbot-input-area .btn-send i {
        margin-right: 0;
    }
}

/* =============================================
   Floating Chat Widget
   ============================================= */

/* Toggle button */
.chat-widget-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #25d366;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    /*box-shadow: 0 4px 15px rgba(37, 211, 102, 0.45);*/
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.45);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    color: #fff;
    font-size: 24px;
}

.chat-widget-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(25, 135, 84, 0.6);
}

.chat-widget-toggle .chat-icon-open,
.chat-widget-toggle .chat-icon-close {
    line-height: 1;
}

/* Widget box */
.chat-widget-box {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 370px;
    max-height: 560px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    overflow: hidden;
    display: none;
    flex-direction: column;
    animation: widgetSlideUp 0.3s ease-out;
}

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

/* Constrain messages height inside the widget */
.chat-widget-box .chatbot-messages {
    height: 320px;
    flex: 1 1 auto;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .chat-widget-box {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 90px;
    }

    .chat-widget-toggle {
        bottom: 20px;
        right: 20px;
    }
}

/* Widget-specific input size (slightly larger than default) */
.chat-widget-box .chatbot-input-area .form-control {
    padding: 15px 20px;
    min-height: 50px;
}

.chat-widget-box .chatbot-input-area .btn-send {
    padding: 15px 25px;
}

/* Expand-to-full-page link in widget header */
.widget-fullpage-link {
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    text-decoration: none;
    transition: opacity 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.widget-fullpage-link:hover {
    color: #fff;
    opacity: 1;
}
