/**
 * GenWave AI Chatbot Styles
 */

/* Reset & Base */
.genwave-chatbot,
.genwave-chatbot * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Container */
.genwave-chatbot {
    position: fixed;
    z-index: 999999;
    font-size: 14px;
    line-height: 1.5;
}

.genwave-chatbot--bottom-right {
    bottom: 20px;
    right: 20px;
}

.genwave-chatbot--bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Toggle Button */
.genwave-chatbot__toggle {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.genwave-chatbot__toggle--rounded {
    border-radius: 50%;
}

.genwave-chatbot__toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
}

.genwave-chatbot__toggle:active {
    transform: scale(0.95);
}

.genwave-chatbot__toggle-icon {
    width: 28px;
    height: 28px;
    transition: all 0.3s ease;
}

.genwave-chatbot__toggle-icon--close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg);
}

.genwave-chatbot.is-open .genwave-chatbot__toggle-icon--chat {
    opacity: 0;
    transform: rotate(90deg);
}

.genwave-chatbot.is-open .genwave-chatbot__toggle-icon--close {
    opacity: 1;
    transform: rotate(0);
}

/* Chat Window */
.genwave-chatbot__window {
    position: absolute;
    bottom: 80px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: genwave-slideUp 0.3s ease;
}

.genwave-chatbot--bottom-right .genwave-chatbot__window {
    right: 0;
}

.genwave-chatbot--bottom-left .genwave-chatbot__window {
    left: 0;
}

.genwave-chatbot.is-open .genwave-chatbot__window {
    display: flex;
}

@keyframes genwave-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.genwave-chatbot__header {
    display: flex;
    align-items: center;
    padding: 16px;
    color: #fff;
    gap: 12px;
}

.genwave-chatbot__avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.genwave-chatbot__avatar svg {
    width: 24px;
    height: 24px;
}

.genwave-chatbot__header-info {
    flex: 1;
}

.genwave-chatbot__header-title {
    font-size: 16px;
    font-weight: 600;
}

.genwave-chatbot__header-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

.genwave-chatbot__close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s;
}

.genwave-chatbot__close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.genwave-chatbot__close svg {
    width: 18px;
    height: 18px;
}

/* Messages */
.genwave-chatbot__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

.genwave-chatbot__message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    animation: genwave-fadeIn 0.3s ease;
    word-wrap: break-word;
}

@keyframes genwave-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.genwave-chatbot__message--bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-bottom-left-radius: 4px;
}

.genwave-chatbot__message--user {
    align-self: flex-end;
    background: var(--genwave-primary, #1890ff);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.genwave-chatbot__message--error {
    background: #fff1f0;
    border: 1px solid #ffa39e;
    color: #cf1322;
}

/* Typing Indicator */
.genwave-chatbot__typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    margin: 0 16px 8px;
    width: fit-content;
    border: 1px solid #e8e8e8;
}

.genwave-chatbot__typing span {
    width: 8px;
    height: 8px;
    background: #bbb;
    border-radius: 50%;
    animation: genwave-typing 1.4s infinite;
}

.genwave-chatbot__typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.genwave-chatbot__typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes genwave-typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* Input Area */
.genwave-chatbot__input-area {
    display: flex;
    align-items: flex-end;
    padding: 12px 16px;
    gap: 8px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
}

.genwave-chatbot__input {
    flex: 1;
    resize: none;
    border: 1px solid #d9d9d9;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    max-height: 100px;
    min-height: 40px;
    font-family: inherit;
}

.genwave-chatbot__input:focus {
    border-color: var(--genwave-primary, #1890ff);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

.genwave-chatbot__send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

.genwave-chatbot__send:hover {
    transform: scale(1.05);
}

.genwave-chatbot__send:active {
    transform: scale(0.95);
}

.genwave-chatbot__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.genwave-chatbot__send svg {
    width: 20px;
    height: 20px;
}

/* Powered By */
.genwave-chatbot__powered {
    text-align: center;
    padding: 8px;
    font-size: 11px;
    color: #999;
    background: #fff;
}

/* Dark Theme */
.genwave-chatbot--dark .genwave-chatbot__window {
    background: #1f1f1f;
}

.genwave-chatbot--dark .genwave-chatbot__messages {
    background: #141414;
}

.genwave-chatbot--dark .genwave-chatbot__message--bot {
    background: #2f2f2f;
    border-color: #3f3f3f;
    color: #fff;
}

.genwave-chatbot--dark .genwave-chatbot__input-area {
    background: #1f1f1f;
    border-color: #3f3f3f;
}

.genwave-chatbot--dark .genwave-chatbot__input {
    background: #2f2f2f;
    border-color: #3f3f3f;
    color: #fff;
}

.genwave-chatbot--dark .genwave-chatbot__input::placeholder {
    color: #888;
}

.genwave-chatbot--dark .genwave-chatbot__powered {
    background: #1f1f1f;
    color: #666;
}

.genwave-chatbot--dark .genwave-chatbot__typing {
    background: #2f2f2f;
    border-color: #3f3f3f;
}

/* Auto Theme (system preference) */
@media (prefers-color-scheme: dark) {
    .genwave-chatbot--auto .genwave-chatbot__window {
        background: #1f1f1f;
    }

    .genwave-chatbot--auto .genwave-chatbot__messages {
        background: #141414;
    }

    .genwave-chatbot--auto .genwave-chatbot__message--bot {
        background: #2f2f2f;
        border-color: #3f3f3f;
        color: #fff;
    }

    .genwave-chatbot--auto .genwave-chatbot__input-area {
        background: #1f1f1f;
        border-color: #3f3f3f;
    }

    .genwave-chatbot--auto .genwave-chatbot__input {
        background: #2f2f2f;
        border-color: #3f3f3f;
        color: #fff;
    }

    .genwave-chatbot--auto .genwave-chatbot__powered {
        background: #1f1f1f;
        color: #666;
    }

    .genwave-chatbot--auto .genwave-chatbot__typing {
        background: #2f2f2f;
        border-color: #3f3f3f;
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .genwave-chatbot__window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0;
        max-width: none;
        max-height: none;
    }

    .genwave-chatbot__toggle {
        width: 50px;
        height: 50px;
    }

    .genwave-chatbot--bottom-right,
    .genwave-chatbot--bottom-left {
        bottom: 15px;
    }

    .genwave-chatbot--bottom-right {
        right: 15px;
    }

    .genwave-chatbot--bottom-left {
        left: 15px;
    }
}

/* Scrollbar Styles */
.genwave-chatbot__messages::-webkit-scrollbar {
    width: 6px;
}

.genwave-chatbot__messages::-webkit-scrollbar-track {
    background: transparent;
}

.genwave-chatbot__messages::-webkit-scrollbar-thumb {
    background: #d9d9d9;
    border-radius: 3px;
}

.genwave-chatbot__messages::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* Email Form (if required) */
.genwave-chatbot__email-form {
    padding: 20px;
    background: #f8f9fa;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
}

.genwave-chatbot__email-form h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.genwave-chatbot__email-form p {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
}

.genwave-chatbot__email-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.genwave-chatbot__email-input:focus {
    border-color: var(--genwave-primary, #1890ff);
}

.genwave-chatbot__email-submit {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: opacity 0.2s;
}

.genwave-chatbot__email-submit:hover {
    opacity: 0.9;
}

/* Quick Replies (future feature) */
.genwave-chatbot__quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 12px;
}

.genwave-chatbot__quick-reply {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.genwave-chatbot__quick-reply:hover {
    background: #f5f5f5;
    border-color: var(--genwave-primary, #1890ff);
}
