/* WebSeo GmbH Chatbot - Frontend Styles */

/* Container */
.webseo-chatbot-container {
    max-width: 850px;
    margin: 20px auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Header */
.webseo-chatbot-header {
    background: var(--webseo-primary-color, #2271b1);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.webseo-chatbot-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.webseo-chatbot-logo {
    width: 40px;
    height: 40px;
    margin-right: 15px;
    border-radius: 50%;
}

.webseo-chatbot-topic {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 5px;
}

.webseo-chatbot-topic-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.webseo-chatbot-header-info {
    flex: 1;
}

.webseo-chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    font-size: 20px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.webseo-chatbot-close:hover {
    opacity: 1;
}

/* Form */
.webseo-chatbot-form {
    animation: fadeIn 0.3s ease-in;
}

.webseo-chatbot-form-body {
    padding: 30px;
}

.webseo-chatbot-intro {
    font-size: 16px;
    color: #555;
    margin-bottom: 30px;
    line-height: 1.6;
}

.webseo-form-group {
    margin-bottom: 20px;
}

.webseo-form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 14px;
}

.webseo-form-group input,
.webseo-form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.webseo-form-group input:focus,
.webseo-form-group textarea:focus {
    outline: none;
    border-color: var(--webseo-primary-color, #2271b1);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.webseo-form-group .required {
    color: #dc3545;
}

.webseo-form-group .optional {
    color: #999;
    font-size: 12px;
    font-weight: normal;
}

.webseo-form-actions {
    margin-top: 30px;
}

.webseo-form-notice {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

.webseo-form-notice small {
    color: #999;
    font-size: 12px;
}

/* Buttons */
.webseo-btn {
    display: inline-block;
    padding: 12px 30px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.webseo-btn-primary {
    background: var(--webseo-primary-color, #2271b1);
    color: white;
    width: 100%;
}

.webseo-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.webseo-btn-primary:active {
    transform: translateY(0);
}

.webseo-btn-send {
    background: var(--webseo-primary-color, #2271b1);
    color: white;
    width: 100%;
    padding: 12px 20px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
}

.webseo-btn-send:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.webseo-btn-send:active {
    transform: translateY(0);
}

.webseo-btn-send .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Chat Area */
.webseo-chatbot-chat {
    display: flex;
    flex-direction: column;
    height: 600px;
}

.webseo-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
}

.webseo-message {
    margin-bottom: 15px;
    animation: slideIn 0.3s ease-out;
}

.webseo-message-content {
    display: inline-block;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 70%;
    word-wrap: break-word;
    line-height: 1.5;
}

.webseo-message-user {
    text-align: right;
}

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

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

.webseo-message-bot .webseo-message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.webseo-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

/* Typing Indicator */
.webseo-chatbot-typing {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
}

.webseo-typing-indicator {
    display: inline-flex;
    align-items: center;
    margin-right: 10px;
}

.webseo-typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

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

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

.webseo-typing-text {
    color: #666;
    font-size: 14px;
    font-style: italic;
}

/* Input Area - NEU: Button unterhalb */
.webseo-chatbot-input-area {
    background: white;
    border-top: 1px solid #eee;
    padding: 15px;
}

.webseo-input-wrapper {
    margin-bottom: 10px;
}

.webseo-input-wrapper textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    resize: none;
    font-size: 14px;
    line-height: 1.4;
    min-height: 80px;
    max-height: 120px;
}

.webseo-input-wrapper textarea:focus {
    outline: none;
    border-color: var(--webseo-primary-color, #2271b1);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.webseo-input-info {
    display: flex;
    justify-content: flex-end;
    margin-top: 5px;
}

.webseo-char-count {
    font-size: 11px;
    color: #999;
}

.webseo-button-group {
    display: flex;
    gap: 10px;
}

/* Bubble Styles */
.webseo-chatbot-bubble {
    position: fixed;
    z-index: 999999;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.webseo-chatbot-bubble:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.webseo-bubble-bottom-right {
    bottom: 20px;
    right: 20px;
}

.webseo-bubble-bottom-left {
    bottom: 20px;
    left: 20px;
}

.webseo-bubble-top-right {
    top: 20px;
    right: 20px;
}

.webseo-bubble-top-left {
    top: 20px;
    left: 20px;
}

.webseo-bubble-button,
.webseo-bubble-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.webseo-bubble-icon {
    margin-right: 8px;
    display: flex;
    align-items: center;
}

.webseo-bubble-close {
    display: none;
    margin-left: 8px;
}

.webseo-chatbot-bubble.active .webseo-bubble-icon {
    display: none;
}

.webseo-chatbot-bubble.active .webseo-bubble-close {
    display: flex;
    align-items: center;
}

.webseo-chatbot-bubble.active {
    border-radius: 50%;
    width: 56px;
    height: 56px;
}

.webseo-chatbot-bubble.active .webseo-bubble-text {
    display: none;
}

/* Bubble Container */
.webseo-chatbot-bubble-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    width: 400px;
    max-width: 90vw;
    max-height: 600px;
    overflow: hidden;
}

.webseo-chatbot-bubble-wrapper {
    position: relative;
    height: 100%;
}

.webseo-bubble-close-chat {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.webseo-bubble-close-chat:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Error Messages */
.webseo-chatbot-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin: 20px 0;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes typing {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.3);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .webseo-chatbot-container {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .webseo-chatbot-bubble-container {
        width: calc(100vw - 40px);
        max-height: calc(100vh - 100px);
    }
    
    .webseo-message-content {
        max-width: 85%;
    }
    
    .webseo-input-wrapper textarea {
        min-height: 60px;
    }
}

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

.webseo-chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.webseo-chatbot-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.webseo-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Loading State */
.webseo-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.webseo-loading::after {
    content: '.';
    animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}