:root {
    --chat-position: right;
    --chat-accent-color: #0073aa;
    --chat-accent-color-hover: #005a87;
}

.wp-ai-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.wp-ai-chat-container[data-position="left"] {
    right: auto;
    left: 20px;
}

.wp-ai-chat-icon {
    width: 60px;
    height: 60px;
    background-color: var(--chat-accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, background-color 0.2s ease;
    border: none;
    padding: 0;
}

.wp-ai-chat-icon:hover {
    transform: scale(1.05);
    background-color: var(--chat-accent-color-hover);
}

.wp-ai-chat-icon svg {
    width: 30px;
    height: 30px;
    color: white;
}

.wp-ai-chat-icon.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.wp-ai-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999999;
}

.wp-ai-chat-container[data-position="left"] .wp-ai-chat-window {
    right: auto;
    left: 20px;
}

.wp-ai-chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.wp-ai-chat-window.expanded {
    width: 480px;
    height: 700px;
}

.wp-ai-chat-header {
    background-color: var(--chat-accent-color);
    color: white;
    padding: 15px;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wp-ai-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.wp-ai-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wp-ai-chat-header-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.wp-ai-chat-header-btn:hover {
    opacity: 1;
}

.wp-ai-chat-header-btn svg {
    width: 18px;
    height: 18px;
}

#wp-ai-chat-expand .icon-contract {
    display: none;
}

.wp-ai-chat-conversation {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wp-ai-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 90%;
}

.wp-ai-chat-user {
    align-self: flex-end;
}

.wp-ai-chat-assistant {
    align-self: flex-start;
}

.wp-ai-chat-message-bubble {
    padding: 10px 15px;
    border-radius: 18px;
    line-height: 1.45;
    font-size: 14px;
    word-wrap: break-word;
    position: relative;
    max-width: 100%;
}

.wp-ai-chat-user .wp-ai-chat-message-bubble {
    background-color: var(--chat-accent-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.wp-ai-chat-assistant .wp-ai-chat-message-bubble {
    background-color: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

.wp-ai-chat-message-content p {
    margin: 0 0 5px 0;
}

.wp-ai-chat-message-content p:last-child {
    margin-bottom: 0;
}

.wp-ai-chat-message-meta {
    font-size: 11px;
    color: #888;
    margin-top: 5px;
    padding: 0 8px;
}

.wp-ai-chat-user .wp-ai-chat-message-meta {
    text-align: right;
}

.wp-ai-chat-assistant .wp-ai-chat-message-meta {
    text-align: left;
}

.wp-ai-chat-copy-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 3px;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
    color: #777;
    line-height: 1;
}

.wp-ai-chat-assistant .wp-ai-chat-message-bubble:hover .wp-ai-chat-copy-btn {
    opacity: 0.7;
}

.wp-ai-chat-copy-btn:hover {
    opacity: 1;
    color: var(--chat-accent-color);
}

.wp-ai-chat-copy-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}

.wp-ai-chat-message.typing-indicator .wp-ai-chat-message-bubble {
    padding: 12px 15px;
}

.wp-ai-chat-message.typing-indicator .wp-ai-chat-message-content p {
    display: flex;
    align-items: center;
    margin: 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: #888;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing-bounce 1.3s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.26s;
}

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

@keyframes typing-bounce {
    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Loading history indicator */
.wp-ai-chat-message.loading-history .wp-ai-chat-message-bubble {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    opacity: 0.8;
}

.wp-ai-chat-message.loading-history .wp-ai-chat-message-content p {
    display: flex;
    align-items: center;
    margin: 0;
    font-style: italic;
    color: #6c757d;
}

.wp-ai-chat-message.loading-history .typing-dot {
    margin-right: 8px;
}

/* History indicator */
.wp-ai-chat-history-indicator {
    padding: 5px 0;
    margin-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.wp-ai-chat-history-indicator span {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 4px 12px;
    display: inline-block;
    font-size: 11px !important;
    color: #6c757d !important;
    text-align: center;
    margin: 0 auto;
    display: block;
    width: fit-content;
}

.wp-ai-chat-message-related-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.wp-ai-chat-related-link-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background-color: #e9e9e9;
    color: #555;
    border-radius: 2px 8px 8px;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.wp-ai-chat-related-link-item:hover {
    background-color: var(--chat-accent-color);
    color: white;
    transform: translateY(-1px);
}

.wp-ai-chat-input-container {
    padding: 10px 15px 15px 15px;
    border-top: 1px solid #eaeaea;
    flex-shrink: 0;
}

.wp-ai-chat-input-wrapper {
    display: flex;
    align-items: center;
    background-color: #f5f5f5;
    border-radius: 24px;
    padding: 5px 10px;
}

.wp-ai-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px;
    font-size: 14px;
    outline: none;
    color: #333;
    resize: none;
}

.wp-ai-chat-char-counter {
    font-size: 11px;
    color: #888;
    text-align: right;
    margin-top: 4px;
    padding-right: 10px;
}

.wp-ai-chat-voice,
.wp-ai-chat-send {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--chat-accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.wp-ai-chat-voice:hover,
.wp-ai-chat-send:not(:disabled):hover {
    color: var(--chat-accent-color-hover);
    transform: scale(1.1);
}

.wp-ai-chat-send:disabled {
    color: #b0b0b0;
    cursor: not-allowed;
}

.wp-ai-chat-voice.recording {
    color: #d63638;
    animation: pulse 1.5s infinite;
}

.wp-ai-char-counter {
    padding: 5px 10px;
    text-align: right;
    font-size: 10px;
    color: #797979;
}

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

@media (max-width: 480px) {
    .wp-ai-chat-window {
        width: calc(100vw - 20px);
        height: clamp(300px, 70vh, 500px);
        bottom: 70px;
        right: 10px;
    }
    .wp-ai-chat-container {
        bottom: 10px;
        right: 10px;
    }
    .wp-ai-chat-container[data-position="left"] {
        right: auto;
        left: 10px;
    }
    .wp-ai-chat-container[data-position="left"] .wp-ai-chat-window {
        right: auto;
        left: 10px;
    }
    .wp-ai-chat-icon {
        width: 50px;
        height: 50px;
    }
    .wp-ai-chat-window.expanded {
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
        bottom: 10px;
        right: 10px;
    }
    .wp-ai-chat-container[data-position="left"] .wp-ai-chat-window.expanded {
        right: auto;
        left: 10px;
    }
    .wp-ai-chat-copy-btn {
        right: 5px;
        top: 5px;
    }
    .wp-ai-chat-message-related-links {
        padding: 0 5px;
    }
    .wp-ai-chat-char-counter {
        padding-right: 5px;
    }
} 