/* Smart Support Chatbot Styles */

#smart-support-chatbot {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900; /* Unter Warenkorb (1500) und Bootstrap Modals (1050+) */
    font-family: 'Roboto', Arial, sans-serif;
}

/* Chat Button */
#chat-toggle-btn {
    min-width: 200px;
    height: 60px;
    border-radius: 30px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 2px solid #8B0000;
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 25px;
    transition: all 0.3s ease;
    position: relative;
}

#chat-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(139, 0, 0, 0.6);
}

#chat-toggle-btn svg {
    width: 28px;
    height: 28px;
    fill: #8B0000;
    flex-shrink: 0;
}

#chat-status-text {
    color: #999;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.3s ease;
}

#chat-toggle-btn.online #chat-status-text {
    color: #28a745;
}

#chat-toggle-btn.online::before {
    content: '';
    position: absolute;
    left: 15px;
    width: 10px;
    height: 10px;
    background: #28a745;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Chat Window */
#chat-window {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    width: 380px;
    max-width: calc(100vw - 40px);
    z-index: 950; /* Über normalem Content, aber unter Bootstrap Modals (1050) und Warenkorb (1500) */
    height: 550px;
    max-height: calc(100vh - 120px);
    background: linear-gradient(to bottom, #1a1a1a 0%, #0d0d0d 100%);
    border: 2px solid #8B0000;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(139, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

#chat-window.active {
    display: flex;
}

/* Chat Header */
#chat-header {
    background: linear-gradient(135deg, #8B0000 0%, #6b0000 100%);
    color: #f5f5f5;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #2d2d2d;
}

#chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}

#chat-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dc3545;
    border: 2px solid #f5f5f5;
}

#chat-status-indicator.online {
    background: #28a745;
    animation: pulse 2s infinite;
}

#chat-close-btn {
    background: none;
    border: none;
    color: #f5f5f5;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#chat-close-btn:hover {
    transform: rotate(90deg);
    color: #ffcccc;
}

/* Chat Messages Container */
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #0d0d0d;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#chat-messages::-webkit-scrollbar {
    width: 8px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 10px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #8B0000;
    border-radius: 10px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a00000;
}

/* Video Container for YouTube Embeds */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    width: 400px;
    max-width: 100%;
    background: #000;
    margin: 10px 0;
    border-radius: 8px;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* Chat messages containing videos should be wider */
.chat-message:has(.video-container) {
    max-width: 90% !important;
    min-width: 400px;
    padding: 5px;
}

/* Message Bubble */
.chat-message {
    max-width: 75%;
    padding: 10px 15px;
    border-radius: 12px;
    word-wrap: break-word;
    animation: slideIn 0.3s ease;
    position: relative;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #8B0000 0%, #6b0000 100%);
    color: #f5f5f5;
    border-bottom-right-radius: 3px;
}

.chat-message.admin,
.chat-message.bot {
    align-self: flex-start;
    background: #2d2d2d;
    color: #f5f5f5;
    border: 1px solid #555;
    border-bottom-left-radius: 3px;
}

.chat-message.bot {
    background: #1a3a5c;
    border-color: #2d5a8c;
}

.message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 5px;
    display: block;
}

/* Chat Input */
#chat-input-container {
    background: #1a1a1a;
    padding: 15px;
    border-top: 2px solid #2d2d2d;
    display: flex;
    gap: 10px;
}

#chat-input {
    flex: 1;
    background: #2d2d2d;
    border: 1px solid #555;
    color: #f5f5f5;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

#chat-input:focus {
    border-color: #8B0000;
    box-shadow: 0 0 10px rgba(139, 0, 0, 0.3);
}

#chat-input::placeholder {
    color: #999;
}

#chat-send-btn {
    background: linear-gradient(135deg, #8B0000 0%, #6b0000 100%);
    border: none;
    color: #f5f5f5;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-size: 18px;
}

#chat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.5);
}

#chat-send-btn:active {
    transform: scale(0.95);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%);
    }

    #smart-support-chatbot {
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
    }

    #chat-toggle-btn {
        min-width: 180px;
        height: 55px;
        padding: 0 20px;
    }

    #chat-status-text {
        font-size: 14px;
    }
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 15px;
    background: #2d2d2d;
    border-radius: 12px;
    width: fit-content;
    align-self: flex-start;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #8B0000;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Chat Notification Styles */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: notificationPulse 1s infinite;
    z-index: 920; /* Sichtbar auf Chat-Button, aber unter Warenkorb */
}

@keyframes notificationPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.chat-notification-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(145deg, #1a1a1a, #2d2d2d);
    border: 2px solid #8B0000;
    border-radius: 12px;
    padding: 0;
    max-width: 350px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 20px rgba(139, 0, 0, 0.3);
    z-index: 980; /* Über normalem Content, aber unter Modals und Warenkorb */
    transform: translateX(400px);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    opacity: 0;
    backdrop-filter: blur(10px);
}

.chat-notification-popup.show {
    transform: translateX(0);
    opacity: 1;
}

.chat-notification-content {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    position: relative;
    cursor: pointer;
}

.chat-notification-icon {
    font-size: 24px;
    margin-right: 12px;
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.6));
}

.chat-notification-text {
    flex: 1;
    color: #F5F5F5;
}

.chat-notification-text strong {
    display: block;
    color: #D4AF37;
    margin-bottom: 4px;
    font-size: 14px;
}

.chat-notification-text p {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    opacity: 0.9;
}

.chat-notification-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.chat-notification-close:hover {
    color: #fff;
}

/* Chat toggle positioning for badge */
#chat-toggle-btn {
    position: relative;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-notification-popup {
        top: 10px; /* Oben statt unten */
        right: 10px;
        left: 10px;
        bottom: auto; /* Entfernt bottom Positionierung */
        max-width: none;
        transform: translateY(-100px); /* Von oben reinschieben */
        z-index: 9999; /* Sehr hoch für mobile damit es über allem ist */
    }
    
    .chat-notification-popup.show {
        transform: translateY(0);
    }
}
