/**
 * Benutzerverbesserungsplugin - Chat Widget Styles
 */

/* Variables */
:root {
    --bvp-primary: #166534;
    --bvp-primary-dark: #14532d;
    --bvp-primary-light: #dcfce7;
    --bvp-white: #ffffff;
    --bvp-gray-100: #f3f4f6;
    --bvp-gray-200: #e5e7eb;
    --bvp-gray-400: #9ca3af;
    --bvp-gray-600: #4b5563;
    --bvp-gray-800: #1f2937;
    --bvp-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --bvp-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --bvp-radius: 16px;
    --bvp-radius-sm: 8px;
}

/* Reset für Widget */
.bvp-chat-widget * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Chat Widget Container */
.bvp-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
}

/* Toggle Button */
.bvp-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bvp-primary) 0%, var(--bvp-primary-dark) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--bvp-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.bvp-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 45px rgba(0, 0, 0, 0.2);
}

.bvp-chat-toggle svg {
    width: 28px;
    height: 28px;
    color: var(--bvp-white);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.bvp-chat-toggle .bvp-icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg);
}

.bvp-chat-widget.open .bvp-chat-toggle .bvp-icon-chat {
    opacity: 0;
    transform: rotate(90deg);
}

.bvp-chat-widget.open .bvp-chat-toggle .bvp-icon-close {
    opacity: 1;
    transform: rotate(0);
}

/* Badge - Online Indicator */
.bvp-chat-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: bvp-online-pulse 2s ease-in-out infinite;
}

@keyframes bvp-online-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
}

.bvp-chat-widget.open .bvp-chat-badge,
.bvp-chat-widget.started .bvp-chat-badge {
    display: none;
}

@keyframes bvp-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Chat Window */
.bvp-chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: var(--bvp-white);
    border-radius: var(--bvp-radius);
    box-shadow: var(--bvp-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.bvp-chat-widget.open .bvp-chat-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.bvp-chat-header {
    background: linear-gradient(135deg, var(--bvp-primary) 0%, var(--bvp-primary-dark) 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.bvp-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bvp-chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.bvp-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bvp-chat-title {
    color: var(--bvp-white);
    font-size: 16px;
    font-weight: 600;
}

.bvp-chat-status {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bvp-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: bvp-blink 2s infinite;
}

@keyframes bvp-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.bvp-chat-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.bvp-chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.bvp-chat-close svg {
    width: 18px;
    height: 18px;
    color: var(--bvp-white);
}

/* Messages Area */
.bvp-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bvp-gray-100);
}

/* Message Bubbles */
.bvp-message {
    max-width: 85%;
    animation: bvp-fadeIn 0.3s ease;
}

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

.bvp-message-bot {
    align-self: flex-start;
}

.bvp-message-user {
    align-self: flex-end;
}

.bvp-message-bubble {
    padding: 12px 16px;
    border-radius: var(--bvp-radius-sm);
    line-height: 1.5;
    font-size: 14px;
}

.bvp-message-bot .bvp-message-bubble {
    background: var(--bvp-white);
    color: var(--bvp-gray-800);
    border-bottom-left-radius: 4px;
    box-shadow: var(--bvp-shadow-sm);
}

.bvp-message-user .bvp-message-bubble {
    background: var(--bvp-primary);
    color: var(--bvp-white);
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.bvp-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bvp-white);
    border-radius: var(--bvp-radius-sm);
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: var(--bvp-shadow-sm);
}

.bvp-typing span {
    width: 8px;
    height: 8px;
    background: var(--bvp-gray-400);
    border-radius: 50%;
    animation: bvp-typing 1.4s infinite;
}

.bvp-typing span:nth-child(2) { animation-delay: 0.2s; }
.bvp-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bvp-typing {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-4px); opacity: 1; }
}

/* Input Area */
.bvp-chat-input-area {
    padding: 12px 20px 16px;
    background: var(--bvp-white);
    border-top: 1px solid var(--bvp-gray-200);
    flex-shrink: 0;
}

.bvp-input-row {
    display: flex;
    gap: 10px;
}

.bvp-form-link {
    display: block;
    text-align: center;
    margin-top: 8px;
    font-size: 11px;
    color: var(--bvp-gray-400);
    text-decoration: none;
    transition: color 0.2s ease;
    opacity: 0.7;
}

.bvp-form-link:hover {
    color: var(--bvp-gray-600);
    opacity: 1;
}

.bvp-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--bvp-gray-200);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bvp-chat-input:focus {
    border-color: var(--bvp-primary);
    box-shadow: 0 0 0 3px var(--bvp-primary-light);
}

.bvp-chat-input::placeholder {
    color: var(--bvp-gray-400);
}

.bvp-chat-send {
    width: 44px;
    height: 44px;
    background: var(--bvp-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.bvp-chat-send:hover {
    background: var(--bvp-primary-dark);
    transform: scale(1.05);
}

.bvp-chat-send:disabled {
    background: var(--bvp-gray-400);
    cursor: not-allowed;
    transform: none;
}

.bvp-chat-send svg {
    width: 20px;
    height: 20px;
    color: var(--bvp-white);
}

/* Direct Form */
.bvp-direct-form {
    padding: 16px;
    background: var(--bvp-gray-100);
    flex: 1;
    overflow-y: auto;
}

.bvp-form-group {
    margin-bottom: 10px;
}

.bvp-form-group label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--bvp-gray-600);
    margin-bottom: 4px;
}

.bvp-form-group input,
.bvp-form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--bvp-gray-200);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    resize: none;
    background: var(--bvp-white);
}

.bvp-form-group input:focus,
.bvp-form-group textarea:focus {
    border-color: var(--bvp-primary);
    box-shadow: 0 0 0 2px var(--bvp-primary-light);
}

.bvp-form-group input::placeholder,
.bvp-form-group textarea::placeholder {
    color: var(--bvp-gray-400);
    font-size: 12px;
}

.bvp-form-submit {
    width: 100%;
    padding: 10px 16px;
    background: var(--bvp-primary);
    color: var(--bvp-white);
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-top: 4px;
}

.bvp-form-submit:hover {
    background: var(--bvp-primary-dark);
}

.bvp-form-submit:disabled {
    background: var(--bvp-gray-400);
    cursor: not-allowed;
}

.bvp-direct-form .bvp-form-link {
    margin-top: 12px;
    font-size: 10px;
}

/* Success State */
.bvp-success-icon {
    width: 60px;
    height: 60px;
    background: var(--bvp-primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.bvp-success-icon svg {
    width: 32px;
    height: 32px;
    color: var(--bvp-primary);
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .bvp-chat-widget {
        bottom: 15px;
        right: 15px;
    }

    .bvp-chat-toggle {
        width: 56px;
        height: 56px;
    }

    .bvp-chat-window {
        bottom: 70px;
        width: calc(100vw - 30px);
        height: calc(100vh - 100px);
        max-height: 500px;
        right: -7px;
    }

    .bvp-chat-header {
        padding: 14px 16px;
    }

    .bvp-chat-messages {
        padding: 16px;
    }

    .bvp-chat-input-area {
        padding: 12px 16px;
    }
}

/* Attention Animation beim Laden */
.bvp-chat-toggle.attention {
    animation: bvp-attention 1s ease 2s;
}

@keyframes bvp-attention {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.15); }
    50% { transform: scale(1); }
    75% { transform: scale(1.1); }
}
