/* 
 * WLIQ Chatbot - Modern Elegant Stylesheet
 * 
 * This CSS file contains modern, elegant styles for the Chatbot plugin.
 * Designed with a focus on user experience and visual appeal.
 * 
 */

/* ===============================================
   CSS Variables for Easy Customization
   =============================================== */
:root {
    /* Primary Colors */
    --chat-primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --chat-secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --chat-accent-color: #000;
    --chat-accent-hover: #000;
    
    /* Background Colors */
    --chat-bg-primary: #ffffff;
    --chat-bg-secondary: #f7fafc;
    --chat-bg-tertiary: #edf2f7;
    --chat-header-bg: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    
    /* Text Colors */
    --chat-text-primary: #2d3748;
    --chat-text-secondary: #4a5568;
    --chat-text-light: #718096;
    --chat-text-white: #ffffff;
    
    /* Message Bubble Colors */
    --chat-user-bubble: linear-gradient(135deg, #000 0%, #764ba2 100%);
    --chat-bot-bubble: #f7fafc;
    --chat-bot-text: #2d3748;
    
    /* Shadows and Effects */
    --chat-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
    --chat-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --chat-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --chat-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --chat-shadow-glow: 0 0 20px rgba(102, 126, 234, 0.5);
    
    /* Border Radius */
    --chat-radius-sm: 8px;
    --chat-radius-md: 12px;
    --chat-radius-lg: 16px;
    --chat-radius-xl: 20px;
    --chat-radius-full: 9999px;
    
    /* Transitions */
    --chat-transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --chat-transition-medium: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --chat-transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --chat-bg-primary: #1a202c;
        --chat-bg-secondary: #2d3748;
        --chat-bg-tertiary: #4a5568;
        --chat-text-primary: #f7fafc;
        --chat-text-secondary: #e2e8f0;
        --chat-bot-bubble: #2d3748;
        --chat-bot-text: #f7fafc;
    }
}

/* ===============================================
   Base Styles and Resets
   =============================================== */
.chatbot-container *,
#chatbot-chatgpt *,
.chatbot-embedded-style *,
.chatbot-floating-style * {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-sizing: border-box;
}

/* ===============================================
   Avatar Styles
   =============================================== */
.chatbot-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--chat-radius-full);
    box-shadow: var(--chat-shadow-md);
    transition: var(--chat-transition-fast);
}

.chatbot-avatar:hover {
    transform: scale(1.05);
    box-shadow: var(--chat-shadow-lg);
}

#chatgpt-open-btn.avatar-icon {
    width: 64px;
    height: 64px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===============================================
   Chat Bubble with Modern Animation
   =============================================== */
.chatbot-bubble {
    background: var(--chat-bg-primary);
    color: var(--chat-text-primary);
    border-radius: var(--chat-radius-lg);
    padding: 12px 18px;
    margin: 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: absolute;
    right: 80px;
    bottom: 80px;
    z-index: 100;
    white-space: normal;
    display: inline-block;
    box-shadow: var(--chat-shadow-lg);
    min-width: 250px;
    max-width: 400px;
    max-height: 120px;
    overflow-y: auto;
    animation: bubbleFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

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

/* ===============================================
   Main Chatbot Container Styles
   =============================================== */
#chatbot-chatgpt {
    transition: var(--chat-transition-medium);
    width: 1px;
    height: 1px;
    overflow: hidden;
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    border-radius: var(--chat-radius-xl);
    box-shadow: var(--chat-shadow-xl);
}

#chatbot-chatgpt.chatbot-wide {
    width: 420px !important;
    height: 600px !important;
    background: var(--chat-bg-primary);
    overflow: visible;
}

#chatbot-chatgpt.chatbot-narrow {
    width: 360px !important;
    height: 500px !important;
    background: var(--chat-bg-primary);
    overflow: visible;
}

#chatbot-chatgpt.chatbot-full {
    width: 100% !important;
    height: 100% !important;
    max-width: 500px;
    max-height: 80vh;
    background: var(--chat-bg-primary);
    overflow: visible;
}

/* Floating Style */
.chatbot-floating-style {
    width: 1px;
    height: 1px;
    overflow: hidden;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--chat-bg-primary);
    border-radius: var(--chat-radius-xl);
    box-shadow: var(--chat-shadow-xl);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Embedded Style */
.chatbot-embedded-style {
    height: 600px !important;
    overflow: hidden;
    position: relative !important;
    margin: 20px auto;
    padding: 0;
    background: var(--chat-bg-primary);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--chat-radius-xl);
    box-shadow: var(--chat-shadow-lg);
    left: 0;
    right: 0;
    max-width: 500px;
}

/* ===============================================
   Header Styles
   =============================================== */
#chatbot-chatgpt-header,
#chatbot-chatgpt-header-embedded {
    background: var(--chat-header-bg);
    color: var(--chat-text-white);
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 600;
    border-top-left-radius: var(--chat-radius-xl);
    border-top-right-radius: var(--chat-radius-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */
    position: relative;
}

#chatbot-chatgpt-title {
    color: var(--chat-text-white);
    font-size: 16px;
    font-weight: 600;
    flex-grow: 1;
    letter-spacing: 0.025em;
}

/* ===============================================
   Conversation Area
   =============================================== */
#chatbot-chatgpt-conversation {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--chat-bg-secondary);
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
#chatbot-chatgpt-conversation::-webkit-scrollbar {
    width: 8px;
}

#chatbot-chatgpt-conversation::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

#chatbot-chatgpt-conversation::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

#chatbot-chatgpt-conversation::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ===============================================
   Message Styles
   =============================================== */
.chat-message {
    margin: 12px 0;
    padding: 0;
    max-width: 85%;
    word-wrap: break-word;
    animation: messageFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.user-message {
    text-align: right;
    margin-left: auto;
}

.bot-message {
    text-align: left;
}

/* Message Bubbles */
.chatbot-user-text {
    display: inline-block;
    background: var(--chat-user-bubble);
    color: var(--chat-text-white);
    padding: 12px 18px;
    border-radius: 20px 20px 4px 20px;
    overflow-wrap: anywhere;
    box-shadow: var(--chat-shadow-sm);
    line-height: 1.5;
    font-size: 14px;
    max-width: 100%;
    position: relative;
    transition: var(--chat-transition-fast);
}

.chatbot-bot-text {
    display: inline-block;
    background: var(--chat-bot-bubble);
    color: var(--chat-bot-text);
    padding: 12px 18px;
    border-radius: 20px 20px 20px 4px;
    overflow-wrap: anywhere;
    box-shadow: var(--chat-shadow-sm);
    line-height: 1.5;
    font-size: 14px;
    max-width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
}

/* Bot Avatar for Messages - Removed as per user request */

/* Error Message */
.error-message {
    display: inline-block;
    background: #fee;
    color: #c33;
    padding: 12px 18px;
    border-radius: var(--chat-radius-md);
    overflow-wrap: anywhere;
    border: 1px solid #fcc;
    font-size: 14px;
}

.message-space {
    height: 8px;
}

/* ===============================================
   Input Area
   =============================================== */
#chatbot-chatgpt-input {
    display: flex;
    padding: 16px;
    background: var(--chat-bg-primary);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom-left-radius: var(--chat-radius-xl);
    border-bottom-right-radius: var(--chat-radius-xl);
}

#chatbot-chatgpt-input-area {
    flex-grow: 1;
    display: flex;
    align-items: center;
}

#chatbot-chatgpt-message {
    flex-grow: 1;
    border: 2px solid #e2e8f0;
    border-radius: var(--chat-radius-full);
    padding: 12px 20px;
    font-size: 14px;
    background: #ffffff !important;
    color: #2d3748 !important;
    resize: none;
    outline: none;
    transition: var(--chat-transition-fast);
    line-height: 1.4;
}

#chatbot-chatgpt-message:focus {
    border-color: var(--chat-accent-color);
    background: #ffffff !important;
    color: #2d3748 !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#chatbot-chatgpt-message::placeholder {
    color: #718096 !important;
    opacity: 0.7;
}

/* ===============================================
   Button Styles
   =============================================== */
#chatbot-chatgpt-buttons-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 12px;
}

/* Base Button Style */
#chatbot-chatgpt-submit,
#chatbot-chatgpt-upload-file,
#chatbot-chatgpt-upload-mp3,
#chatbot-chatgpt-erase-btn,
#chatbot-chatgpt-text-to-speech-btn,
#chatbot-chatgpt-download-transcript-btn,
#chatbot-chatgpt-speech-recognition-btn {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--chat-radius-full);
    padding: 10px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: var(--chat-transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

/* Hover Effects */
#chatbot-chatgpt-submit:hover,
#chatbot-chatgpt-upload-file:hover,
#chatbot-chatgpt-upload-mp3:hover,
#chatbot-chatgpt-erase-btn:hover,
#chatbot-chatgpt-text-to-speech-btn:hover,
#chatbot-chatgpt-download-transcript-btn:hover,
#chatbot-chatgpt-speech-recognition-btn:hover {
    background: var(--chat-accent-color);
    border-color: var(--chat-accent-color);
    transform: scale(1.05);
    box-shadow: var(--chat-shadow-md);
}

#chatbot-chatgpt-submit:hover img,
#chatbot-chatgpt-upload-file:hover img,
#chatbot-chatgpt-upload-mp3:hover img,
#chatbot-chatgpt-erase-btn:hover img,
#chatbot-chatgpt-text-to-speech-btn:hover img,
#chatbot-chatgpt-download-transcript-btn:hover img,
#chatbot-chatgpt-speech-recognition-btn:hover img {
    filter: brightness(0) invert(1);
}

/* Submit Button Special Style */
#chatbot-chatgpt-submit {
    background: var(--chat-accent-color);
    border-color: var(--chat-accent-color);
}

#chatbot-chatgpt-submit:hover {
    background: var(--chat-accent-hover);
    border-color: var(--chat-accent-hover);
}

#chatbot-chatgpt-submit img {
    filter: brightness(0) invert(1);
}

/* Button Icons */
#chatbot-chatgpt-buttons-container img {
    width: 20px;
    height: 20px;
    transition: var(--chat-transition-fast);
}

/* ===============================================
   Open/Close Button
   =============================================== */
#chatgpt-open-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--chat-primary-gradient);
    border: none;
    cursor: pointer;
    padding: 0;
    width: 64px;
    height: 64px;
    border-radius: var(--chat-radius-full);
    box-shadow: var(--chat-shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition-medium);
    z-index: 9998;
}

#chatgpt-open-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--chat-shadow-glow);
}

#chatgpt-open-btn:active {
    transform: scale(0.95);
}

.chatbot-open-icon {
    filter: brightness(0) invert(1);
}

/* Collapse Button */
.chatbot-collapse-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--chat-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition-fast);
}

.chatbot-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===============================================
   Typing Indicator
   =============================================== */
.chatbot-typing-indicator {
    display: inline-flex;
    align-items: center;
    background: var(--chat-bot-bubble);
    padding: 12px 18px;
    border-radius: 20px 20px 20px 4px;
    box-shadow: var(--chat-shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.chatbot-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--chat-text-light);
    border-radius: 50%;
    margin-right: 4px;
    animation: typing 1.4s infinite;
}

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

.chatbot-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
    margin-right: 0;
}

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

/* ===============================================
   Custom Buttons
   =============================================== */
#chatbot-chatgpt-custom-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: var(--chat-bg-secondary);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.chatbot-chatgpt-custom-button-class {
    background: var(--chat-primary-gradient);
    color: var(--chat-text-white);
    padding: 8px 16px;
    border-radius: var(--chat-radius-full);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--chat-transition-fast);
    text-decoration: none;
}

.chatbot-chatgpt-custom-button-class:hover {
    transform: translateY(-2px);
    box-shadow: var(--chat-shadow-md);
}

.chatbot-chatgpt-custom-button-class a {
    color: var(--chat-text-white) !important;
    text-decoration: none !important;
}

/* ===============================================
   Attribution
   =============================================== */
.chatbot-attribution {
    text-align: center;
    padding: 8px;
    font-size: 11px;
    color: var(--chat-text-light);
    background: var(--chat-bg-secondary);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.chatbot-attribution-link {
    color: var(--chat-accent-color);
    text-decoration: none;
    font-size: 11px;
    transition: var(--chat-transition-fast);
}

.chatbot-attribution-link:hover {
    text-decoration: underline;
    color: var(--chat-accent-hover);
}

/* ===============================================
   Responsive Design
   =============================================== */
@media only screen and (max-width: 600px) {
    #chatbot-chatgpt.chatbot-wide,
    #chatbot-chatgpt.chatbot-narrow {
        width: calc(100vw - 40px) !important;
        height: calc(100vh - 100px) !important;
        bottom: 20px;
        right: 20px;
    }
    
    #chatbot-chatgpt-conversation {
        max-height: calc(100vh - 280px);
    }
    
    .chat-message {
        max-width: 90%;
    }
    
    .chatbot-embedded-style {
        margin: 10px;
        height: calc(100vh - 40px) !important;
    }
}

/* ===============================================
   Loading Animation
   =============================================== */
.chatbot-loading {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.chatbot-loading-dot {
    width: 6px;
    height: 6px;
    background: var(--chat-accent-color);
    border-radius: 50%;
    animation: loadingDot 1.4s infinite;
}

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

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

@keyframes loadingDot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===============================================
   Smooth Transitions for State Changes
   =============================================== */
.chatbot-collapsed {
    width: 64px !important;
    height: 64px !important;
    border-radius: var(--chat-radius-full);
    overflow: hidden;
}

.chatbot-expanded {
    animation: expandChat 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes expandChat {
    from {
        width: 64px;
        height: 64px;
        border-radius: var(--chat-radius-full);
    }
    to {
        width: 100%;
        height: 100%;
        border-radius: var(--chat-radius-xl);
    }
}

/* ===============================================
   Accessibility Improvements
   =============================================== */
*:focus-visible {
    outline: 2px solid var(--chat-accent-color);
    outline-offset: 2px;
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    .chatbot-user-text {
        border: 2px solid var(--chat-text-white);
    }
    
    .chatbot-bot-text {
        border: 2px solid var(--chat-text-primary);
    }
}

/* ===============================================
   Print Styles
   =============================================== */
@media print {
    #chatgpt-open-btn,
    #chatbot-chatgpt-buttons-container,
    .chatbot-attribution {
        display: none !important;
    }
    
    #chatbot-chatgpt-conversation {
        max-height: none !important;
        overflow: visible !important;
    }
}

.chatbot-open-icon {
    filter: none !important;
}