/* Restaurant GPT Chatbot Styles */

/* Ensure page scrolling works when chat is open */
body:has(.restaurant-chat-window[style*="display: block"]) {
    overflow: auto !important;
}

html:has(.restaurant-chat-window[style*="display: block"]) {
    overflow: auto !important;
}

/* Chat Button */
.restaurant-chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 16px 24px;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    font-size: 15px;
    max-width: 220px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.restaurant-chat-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 40px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.restaurant-chat-button.active {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.restaurant-chat-button .chat-icon {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.restaurant-chat-button .chat-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat Window */
.restaurant-chat-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 380px;
    height: 550px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 1001;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: chatSlideUp 0.3s ease-out;
    pointer-events: auto;
    /* Ensure the chat window doesn't block page scrolling */
    touch-action: auto;
}

@keyframes chatSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
    position: relative;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    border-radius: 20px 20px 0 0;
}

.chat-title {
    font-weight: 700;
    font-size: 17px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 2;
}

.chat-title i {
    font-size: 20px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.chat-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    scroll-behavior: auto;
    max-height: 100%;
    /* Faster scrolling settings */
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 185, 129, 0.3) transparent;
    /* Increase scroll speed */
    scroll-snap-type: none;
    overscroll-behavior: contain;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: rgba(229, 231, 235, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.4);
    border-radius: 3px;
    transition: background 0.2s ease;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.6);
}

.message {
    display: flex;
    max-width: 80%;
    animation: messageSlide 0.3s ease-out;
}

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

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

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

.message-content {
    padding: 16px 20px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
    max-width: 100%;
}

.user-message .message-content {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-bottom-right-radius: 8px;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
}

.bot-message .message-content {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    color: #1f2937;
    border: 1px solid rgba(229, 231, 235, 0.5);
    border-bottom-left-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Typing Indicator */
.typing .message-content {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 15px 16px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background-color: #a0aec0;
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingAnimation {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-container {
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(229, 231, 235, 0.3);
    display: flex;
    gap: 12px;
    align-items: center;
    border-radius: 0 0 20px 20px;
}

#chat-input {
    flex: 1;
    border: 2px solid rgba(229, 231, 235, 0.5);
    border-radius: 25px;
    padding: 14px 20px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

#chat-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

#chat-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

#chat-send {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 16px;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

#chat-send:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: scale(1.08) translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

#chat-send:active {
    transform: scale(1.02) translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .restaurant-chat-window {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
        height: 450px;
        bottom: 80px;
    }
    
    .restaurant-chat-button {
        bottom: 15px;
        right: 15px;
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .chat-messages {
        padding: 15px;
    }
    
    .chat-input-container {
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .restaurant-chat-window {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        height: 400px;
    }
    
    .restaurant-chat-button {
        bottom: 10px;
        right: 10px;
        padding: 10px 14px;
        font-size: 12px;
    }
    
    .chat-button .chat-label {
        display: none;
    }
    
    .restaurant-chat-button .chat-label {
        display: none;
    }
}

/* Quick Action Buttons */
.quick-action-btn {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #059669;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}

.quick-action-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.quick-action-btn:active {
    transform: translateY(0);
    background: rgba(16, 185, 129, 0.3);
}

/* Animation for chat button pulse */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.restaurant-chat-button.pulse {
    animation: pulse 2s infinite;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .restaurant-chat-window {
        background: #1a202c;
        border-color: #2d3748;
    }
    
    .chat-header {
        background: linear-gradient(135deg, #4c51bf 0%, #553c9a 100%);
    }
    
    .chat-messages {
        background: #2d3748;
    }
    
    .bot-message .message-content {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #2d3748;
    }
    
    .chat-input-container {
        background: #1a202c;
        border-color: #2d3748;
    }
    
    #chat-input {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    #chat-input::placeholder {
        color: #718096;
    }
    
    .typing .message-content {
        background: #4a5568;
        border-color: #2d3748;
    }
}
