/* Color Palette */
:root {
    --coi-blue: #184798;
    --coi-green: #87c540;
    --coi-green-vibrant: #9dd147;
    --coi-green-deep: #6ba832;
    --coi-light-gray: #e0e0e0;
    --coi-dark-gray: #333;
    --coi-text-color-dark: #1e293b;
    --coi-text-color-light: #f1f5f9;
    --coi-border-color: #e2e8f0;
    --coi-placeholder-color: #9ca3af;
    --coi-gradient-green-start: #87c540;
    --coi-gradient-green-end: #9dd147;
    --coi-gradient-green-vibrant-start: #9dd147;
    --coi-gradient-green-vibrant-end: #6ba832;
    --coi-gray-gradient-start: #f8fafc;
    --coi-gray-gradient-end: #e2e8f0;
}

/* Base styles for the chatbot button (now green, and stays visible) */
#coi-chatbot-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--coi-gradient-green-vibrant-start) 0%, var(--coi-gradient-green-vibrant-end) 100%);
    color: white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(135, 197, 64, 0.3);
    z-index: 10000;
    transition: all 0.3s ease;
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

#coi-chatbot-button:hover {
    background: linear-gradient(135deg, var(--coi-gradient-green-vibrant-end) 0%, var(--coi-gradient-green-vibrant-start) 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(135, 197, 64, 0.4);
}

#coi-chatbot-button svg {
    width: 30px;
    height: 30px;
}

/* Chatbot window styles - Default Size (Taller and Wider) */
#coi-chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 420px;
    height: 600px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    transform-origin: bottom right;
}

#coi-chatbot-window.is-visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

/* Fullscreen mode for the chatbot window (grows upwards and left) */
#coi-chatbot-window.is-fullscreen {
    width: 550px;
    height: 730px;
    bottom: 90px;
    right: 20px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.coi-chat-header {
    background: linear-gradient(135deg, var(--coi-blue) 0%, #1a4fa0 100%);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.coi-chat-header h3 {
    margin: 0;
    color: white;
    font-size: 1em;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
}

.coi-header-btn {
    background: linear-gradient(135deg, var(--coi-gradient-green-vibrant-start) 0%, var(--coi-gradient-green-vibrant-end) 100%);
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
}

.coi-header-btn:hover {
    background: linear-gradient(135deg, var(--coi-gradient-green-vibrant-end) 0%, var(--coi-gradient-green-vibrant-start) 100%);
    transform: translateY(-1px) scale(1.05);
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}

.coi-header-btn svg {
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

.coi-chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background: linear-gradient(135deg, var(--coi-gray-gradient-start) 0%, var(--coi-gray-gradient-end) 100%);
    display: flex;
    flex-direction: column;
}

/* Smooth scrolling for chat messages */
.coi-chat-messages {
    scroll-behavior: smooth;
}

/* Message Bubbles - Enhanced with gradients */
.coi-message {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

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

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

.coi-message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}

/* Enhanced user message bubbles with vibrant gradient */
.coi-user-message .coi-message-bubble {
    background: linear-gradient(135deg, var(--coi-gradient-green-vibrant-start) 0%, var(--coi-gradient-green-vibrant-end) 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(135, 197, 64, 0.3);
}

/* Enhanced bot message bubbles with subtle white-gray gradient */
.coi-bot-message .coi-message-bubble {
    background: linear-gradient(135deg, #ffffff 0%, var(--coi-gray-gradient-end) 100%);
    color: var(--coi-text-color-dark);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Markdown formatting styles */
.coi-message-bubble em {
    font-style: italic;
    font-weight: normal;
}

.coi-message-bubble strong {
    font-weight: bold;
    font-style: normal;
}

/* Input Container */
.coi-chat-input-container {
    padding: 16px 12px;
    border-top: 1px solid var(--coi-border-color);
    width: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

/* Wrapper for input + button */
.coi-chat-input-wrapper {
    display: flex;
    align-items: center;
    width: 95%;
    height: 48px;
    border: 2px solid var(--coi-border-color);
    border-radius: 24px;
    background: white;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.coi-chat-input-wrapper:focus-within {
    border-color: var(--coi-green);
    box-shadow: 0 2px 8px rgba(135, 197, 64, 0.2);
}

/* Text input field */
#coi-chat-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 18px 20px 0 25px;
    font-size: 14px;
    color: #374151;
    background: transparent;
    height: 100%;
    box-sizing: border-box;
}

#coi-chat-input::placeholder {
    color: var(--coi-placeholder-color);
}

/* Enhanced send button with vibrant gradient */
.coi-send-button {
    width: 48px;
    height: 48px;
    border: none;
    background: linear-gradient(135deg, var(--coi-gradient-green-vibrant-start) 0%, var(--coi-gradient-green-vibrant-end) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(135, 197, 64, 0.3);
}

.coi-send-button:hover:not(.disabled) {
    background: linear-gradient(135deg, var(--coi-gradient-green-vibrant-end) 0%, var(--coi-gradient-green-vibrant-start) 100%);
    transform: scale(1.05);
    box-shadow: 0 3px 8px rgba(135, 197, 64, 0.4);
}

.coi-send-button.disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

/* SVG icon in button */
.coi-send-button svg {
    width: 18px;
    height: 18px;
}

/* Loading dots */
.coi-loading {
    display: flex;
    justify-content: center;
    padding: 10px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.coi-loading-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 3px;
    background: linear-gradient(135deg, var(--coi-gradient-green-start) 0%, var(--coi-gradient-green-end) 100%);
    border-radius: 50%;
    animation: bounce 0.6s infinite alternate;
}

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

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

@keyframes bounce {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-5px);
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #coi-chatbot-button {
        bottom: 10px;
        right: 10px;
        width: 50px;
        height: 50px;
    }

    #coi-chatbot-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        transform: none;
        top: 0;
        left: 0;
    }

    #coi-chatbot-window.is-fullscreen {
        width: 100vw;
        height: 100vh;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        border-radius: 0;
        transform: none;
    }

    .coi-chat-header {
        padding: 12px;
    }

    .coi-chat-header h3 {
        font-size: 1em;
    }

    .coi-chat-input-container {
        padding: 10px;
    }

    .coi-chat-input-wrapper {
        height: 44px;
    }

    #coi-chat-input {
        padding: 10px 12px;
    }

    .coi-send-button {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }
}

/* Enhanced header button styles - keeping them smaller */
.coi-header-btn {
    background: linear-gradient(135deg, var(--coi-gradient-green-vibrant-start) 0%, var(--coi-gradient-green-vibrant-end) 100%);
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
}

.coi-header-btn:hover {
    background: linear-gradient(135deg, var(--coi-gradient-green-vibrant-end) 0%, var(--coi-gradient-green-vibrant-start) 100%);
    transform: translateY(-1px) scale(1.05);
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}

.coi-header-btn svg {
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

/* Updated Chatbot Header */
.coi-chat-header {
    background: linear-gradient(135deg, #1a4896 0%, #3b82f6 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    height: 56px; /* default height */
    transition: height 0.2s ease;
}

.coi-chat-header h3 {
    margin: 0;
    font-size: 1.05em;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Grouped Header Buttons */
.coi-header-controls {
    display: flex;
    gap: 6px;
}

/* Square buttons */
.coi-header-btn {
    background: linear-gradient(135deg, var(--coi-gradient-green-vibrant-start) 0%, var(--coi-gradient-green-vibrant-end) 100%);
    border: none;
    color: white;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    transition: all 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.coi-header-btn:hover {
    background: linear-gradient(135deg, var(--coi-gradient-green-vibrant-end) 0%, var(--coi-gradient-green-vibrant-start) 100%);
    transform: translateY(-1px) scale(1.05);
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}

.coi-header-btn svg {
    width: 16px;
    height: 16px;
}

/* Zoom handling — shrink header height when zooming in */
@media screen and (max-height: 750px) {
    .coi-chat-header {
        height: 48px;
        padding: 8px 12px;
    }
}

@media screen and (max-height: 650px) {
    .coi-chat-header {
        height: 42px;
        padding: 6px 10px;
    }
}

