/**
 * Handz.on Chatbot v2 - Base Styles
 * Strukturelle Styles - Farben werden durch custom-css.php überschrieben
 */

/* === RESET & BASICS === */
.handz-prompt-widget *,
.handz-chat-page * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* === PROMPT WIDGET === */
.handz-prompt-widget {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.handz-prompt-container {
    max-width: 800px;
    width: 100%;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.handz-prompt-header {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.handz-prompt-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
}

.handz-prompt-avatar img {
    display: block;
}

.handz-prompt-text {
    font-size: 24px;
    font-weight: 300;
    margin: 0;
    font-style: italic;
}

.handz-prompt-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.handz-prompt-input {
    flex: 1;
    padding: 15px 20px;
    border: none;
    font-size: 16px;
    outline: none;
    border-radius: 0;
}

.handz-prompt-input::placeholder {
    opacity: 0.6;
}

.handz-prompt-submit {
    width: 50px;
    height: 50px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.handz-prompt-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.handz-prompt-submit svg {
    width: 24px;
    height: 24px;
}

/* === CHAT PAGE === */
.handz-chat-page {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: flex-end;
    padding: 0;
    overflow: hidden;
}

.handz-chat-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

.handz-chat-bg-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.handz-chat-bg-image {
    background-size: cover;
    background-position: center;
}

.handz-chat-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.handz-chat-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.handz-chat-header-avatar {
    flex-shrink: 0;
}

.handz-chat-header-info h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: inherit;
}

.handz-chat-status {
    font-size: 12px;
    opacity: 0.7;
}

.handz-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.handz-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.handz-chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.handz-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.handz-chat-message {
    display: flex;
    gap: 12px;
    animation: messageSlide 0.3s ease;
}

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

.handz-chat-message.user {
    flex-direction: row-reverse;
}

.handz-message-avatar {
    flex-shrink: 0;
}

.handz-message-bubble {
    padding: 12px 16px;
    max-width: 70%;
    line-height: 1.5;
}

.handz-message-bubble p {
    margin: 0 0 8px 0;
}

.handz-message-bubble p:last-child {
    margin-bottom: 0;
}

/* Quick Replies */
.handz-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.handz-quick-reply-btn {
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

/* Typing Indicator */
.handz-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.handz-typing-dot {
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    animation: typing 1.4s infinite;
    opacity: 0.6;
}

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

.handz-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Chat Input */
.handz-chat-input-area {
    padding: 20px;
    flex-shrink: 0;
}

.handz-chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.handz-chat-input {
    flex: 1;
    padding: 15px 20px;
    border: none;
    font-size: 16px;
    outline: none;
    font-family: inherit;
}

.handz-chat-input::placeholder {
    opacity: 0.6;
}

.handz-chat-submit {
    width: 50px;
    height: 50px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.handz-chat-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.handz-chat-submit svg {
    width: 24px;
    height: 24px;
}

/* Error Message */
.handz-error-message {
    background: #ef4444;
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 14px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .handz-prompt-container {
        padding: 30px 20px;
    }
    
    .handz-prompt-text {
        font-size: 20px;
    }
    
    .handz-chat-container {
        max-height: 90vh;
        margin: 10px;
        padding: 15px;
    }
    
    .handz-chat-messages {
        padding: 15px;
    }
    
    .handz-message-bubble {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .handz-prompt-container {
        padding: 20px;
    }
    
    .handz-prompt-text {
        font-size: 18px;
    }
    
    .handz-prompt-input,
    .handz-chat-input {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .handz-prompt-submit,
    .handz-chat-submit {
        width: 44px;
        height: 44px;
    }
}

/* === ACCESSIBILITY === */
button:focus-visible,
input:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* === LOADING STATE === */
.handz-loading {
    opacity: 0.6;
    pointer-events: none;
}

.handz-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}
