/* e-billett.no Chatbot Styles */
* {
    box-sizing: border-box;
}

/* Hide chatbot on admin pages */
body:has([class*="admin"]) #chat-widget,
body:has([href*="/admin"]) #chat-widget {
    display: none !important;
}

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

/* Toggle Button - Ultra high specificity to override React's bundled CSS */
body #chat-widget #chat-toggle,
#chat-widget #chat-toggle#chat-toggle {
    min-width: 90px;
    height: 50px;
    padding: 0 20px;
    border-radius: 25px;
    background-color: #6B8E23 !important;
    background-image: none !important;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(107, 142, 35, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

body #chat-widget #chat-toggle:hover,
#chat-widget #chat-toggle#chat-toggle:hover {
    background-color: #5a7a1e !important;
    background-image: none !important;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(107, 142, 35, 0.4);
}

#chat-toggle svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

#chat-toggle span {
    white-space: nowrap;
}

/* Chat Window */
#chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

#chat-window.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

/* Mobile adjustments */
@media (max-width: 480px) {
    #chat-widget {
        bottom: 10px;
        right: 10px;
    }

    #chat-toggle {
        width: 50px;
        height: 50px;
    }

    #chat-toggle svg {
        width: 24px;
        height: 24px;
    }

    #chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        bottom: 70px;
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: opacity 0.2s;
}

#chat-close:hover {
    opacity: 0.7;
}

/* Messages Container */
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Scrollbar styling */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #f5f5f5;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #cccccc;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

/* Message Bubbles */
.message {
    display: flex;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease;
}

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

.message-content {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
}

.bot-message .message-content {
    background-color: white;
    color: #000000;
    border: 1px solid #e0e0e0;
    border-radius: 12px 12px 12px 4px;
}

.user-message {
    justify-content: flex-end;
}

.user-message .message-content {
    background-color: #667eea;
    color: white;
    border-radius: 12px 12px 4px 12px;
}

/* Event Results */
.event-result {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    transition: all 0.2s ease;
}

.event-result:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.event-result a {
    color: #000000;
    text-decoration: none;
    display: block;
}

.event-result a:hover {
    color: #667eea;
}

.event-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: #333;
}

.event-date {
    font-size: 12px;
    color: #666666;
    margin-bottom: 4px;
}

.event-price {
    font-size: 13px;
    color: #667eea;
    font-weight: 600;
}

.results-count {
    font-size: 12px;
    color: #666666;
    margin-bottom: 8px;
    font-style: italic;
}

/* Loading indicator */
.loading {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background-color: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Input Area */
.chat-input-container {
    display: flex;
    padding: 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    gap: 8px;
}

#chat-input {
    flex: 1;
    border: 1px solid #cccccc;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: #667eea;
}

#chat-send {
    min-width: 70px;
    height: 40px;
    padding: 0 16px;
    border-radius: 20px;
    background-color: #667eea;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#chat-send svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

#chat-send span {
    white-space: nowrap;
}

#chat-send:hover {
    background-color: #5568d3;
    transform: scale(1.05);
}

#chat-send:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: scale(1);
}

/* Error message */
.error-message {
    background-color: #fff5f5;
    border: 1px solid #fed7d7;
    color: #c53030;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 8px;
}
