/* 914Chat Embed Styles with Bootstrap */

/* Chat Widget Button */
.chat914-widget-button {
    position: fixed !important;
    bottom: 20px;
    z-index: 9998;
    background: var(--chat914-primary-color, #2374c4) !important;
    color: white !important;
    border: none !important;
    border-radius: 50px !important;
    padding: 12px 24px !important;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.chat914-widget-button:hover {
    transform: translateY(-2px);
    background: var(--chat914-primary-color, #2374c4) !important;
    opacity: 0.9;
}

.chat914-widget-button.bottom-right {
    right: 20px;
}

.chat914-widget-button.bottom-left {
    left: 20px;
}

/* Chat Window */
.chat914-chat-window {
    position: fixed;
    bottom: 90px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.chat914-chat-window.active {
    display: flex;
}

.chat914-chat-window.bottom-right {
    right: 20px;
}

.chat914-chat-window.bottom-left {
    left: 20px;
}

/* Chat Header */
.chat914-chat-header {
    background: var(--chat914-primary-color, #2374c4);
    color: white;
    padding: 20px;
}

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

.chat914-chat-close {
    border: none !important;
    background: transparent !important;
    color: white !important;
    opacity: 0.8;
    transition: all 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    line-height: 1;
    cursor: pointer;
}

.chat914-chat-close:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border-radius: 4px !important;
}

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

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

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

.chat914-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat914-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Message Bubbles */
.chat914-message {
    display: flex;
    animation: messageSlideIn 0.3s ease;
    align-items: flex-start;
    margin-bottom: 12px;
}

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

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

.chat914-message.assistant {
    justify-content: flex-start;
}

.chat914-message-content {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    font-size: 15px;
}

.chat914-message.assistant .chat914-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.chat914-message.user .chat914-message-content {
    background: var(--chat914-primary-color, #2374c4);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Links in messages */
.chat914-message-content a {
    color: inherit;
    text-decoration: underline;
    font-weight: 500;
    transition: opacity 0.2s;
}

.chat914-message-content a:hover {
    opacity: 0.8;
}

.chat914-message.assistant .chat914-message-content a {
    color: #2374c4;
}

.chat914-message.user .chat914-message-content a {
    color: white;
    text-decoration-color: rgba(255, 255, 255, 0.7);
}

/* Typing Indicator */
.chat914-typing-indicator {
    display: none;
    gap: 10px;
    align-items: flex-start;
}

.chat914-typing-indicator.active {
    display: flex !important;
}

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

.chat914-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c1c1c1;
    display: inline-block;
    animation: typingBounce 1.4s infinite;
}

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

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

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

/* Chat Input */
.chat914-chat-input {
    background: white;
    padding: 16px 20px;
    border-top: 1px solid #e9ecef;
}

.chat914-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat914-message-input {
    flex: 1;
    border: 1px solid #ced4da !important;
    border-radius: 20px !important;
    padding: 10px 16px !important;
    font-size: 15px !important;
    resize: none;
    max-height: 100px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    line-height: 1.5;
}

.chat914-message-input:focus {
    outline: none !important;
    border-color: var(--chat914-primary-color, #2374c4) !important;
    box-shadow: 0 0 0 0.2rem rgba(35, 116, 196, 0.15) !important;
}

.chat914-send-button {
    background: var(--chat914-primary-color, #2374c4) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    flex-shrink: 0;
    transition: all 0.3s ease;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
}

.chat914-send-button i {
    font-size: 16px;
}

.chat914-send-button:hover:not(:disabled) {
    transform: scale(1.08);
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(35, 116, 196, 0.3);
}

.chat914-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Error Message */
.chat914-error-message {
    padding: 12px 16px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 12px;
    border: 1px solid #f5c6cb;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat914-chat-window {
        width: 100vw;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile */
        bottom: 0;
        left: 0 !important;
        right: 0 !important;
        border-radius: 0;
        max-width: 100vw;
        max-height: 100vh;
        max-height: 100dvh;
    }
    
    .chat914-widget-button {
        bottom: 15px;
        padding: 12px 20px !important;
        font-size: 14px;
        max-width: calc(100vw - 30px);
        box-sizing: border-box;
    }
    
    .chat914-widget-button.bottom-right {
        right: 15px;
    }
    
    .chat914-widget-button.bottom-left {
        left: 15px;
    }
    
    .chat914-message-content {
        max-width: 85%;
        font-size: 14px;
    }
    
    .chat914-chat-header {
        padding: 16px;
    }
    
    .chat914-chat-header h3 {
        font-size: 16px;
    }
    
    .chat914-chat-messages {
        padding: 16px;
    }
    
    .chat914-chat-input {
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    /* Prevent body scroll when chat is open */
    body.chat914-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

/* Prevent horizontal overflow from widget */
.chat914-widget-button,
.chat914-chat-window {
    box-sizing: border-box;
}

/* Shortcode Container */
.chat914-shortcode-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat914-shortcode-container .chat914-chat-header {
    border-radius: 0;
}

.chat914-shortcode-container .chat914-chat-messages {
    border-radius: 0;
    flex: 1;
}

.chat914-shortcode-container .chat914-chat-input {
    border-radius: 0;
}

/* Powered By Footer */
.chat914-footer {
    background: #1a1a2e;
    padding: 10px 16px;
    text-align: center;
    font-size: 11px;
    color: #a0a0a0;
    border-top: 1px solid #2d2d44;
}

.chat914-footer a {
    color: #a0a0a0;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.chat914-footer a:hover {
    color: #fff;
}

.chat914-footer-logo {
    height: 14px;
    width: auto;
    vertical-align: middle;
}