/* ============================================
   AI Chatbot Styles for CookingRescue.com
   Brand Colors: Fire Orange (#FF8C00), Charcoal Black (#36454F)
   ============================================ */

:root {
    --chatbot-primary: #FF8C00;
    --chatbot-primary-dark: #E67E00;
    --chatbot-bg-dark: #36454F;
    --chatbot-bg-darker: #2A353D;
    --chatbot-cream: #FFF8DC;
    --chatbot-white: #FFFFFF;
    --chatbot-shadow: rgba(0, 0, 0, 0.3);
    --chatbot-glass-bg: rgba(54, 69, 79, 0.95);
    --chatbot-glass-border: rgba(255, 140, 0, 0.2);
}

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Floating Chat Button */
.chatbot-toggle-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px var(--chatbot-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.chatbot-toggle-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 12px 32px rgba(255, 140, 0, 0.4);
}

.chatbot-toggle-btn:active {
    transform: scale(0.95);
}

.chatbot-toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chatbot-toggle-btn:hover::before {
    opacity: 1;
}

.chatbot-icon {
    font-size: 32px;
    transition: transform 0.3s ease;
}

.chatbot-toggle-btn.active .chatbot-icon {
    transform: rotate(90deg);
}

/* Notification Badge */
.chatbot-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    background: #FF3B30;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    border: 3px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Chat Window */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    height: 600px;
    background: var(--chatbot-glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid var(--chatbot-glass-border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Chat Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-bg-darker) 0%, var(--chatbot-bg-dark) 100%);
    padding: 20px;
    border-bottom: 1px solid var(--chatbot-glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chatbot-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--chatbot-white);
}

.chatbot-header-text p {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: var(--chatbot-cream);
    opacity: 0.8;
}

.chatbot-status-indicator {
    width: 8px;
    height: 8px;
    background: #34C759;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    animation: pulse-status 2s infinite;
}

@keyframes pulse-status {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.chatbot-close-btn {
    background: none;
    border: none;
    color: var(--chatbot-cream);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.chatbot-close-btn:hover {
    opacity: 1;
    transform: rotate(90deg);
}

/* Chat Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--chatbot-primary);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--chatbot-primary-dark);
}

/* Message Bubbles */
.chatbot-message {
    display: flex;
    gap: 10px;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.chatbot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.chatbot-message.bot .chatbot-message-avatar {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
}

.chatbot-message.user .chatbot-message-avatar {
    background: var(--chatbot-bg-darker);
}

.chatbot-message-content {
    max-width: 75%;
}

.chatbot-message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message.bot .chatbot-message-bubble {
    background: rgba(255, 255, 255, 0.1);
    color: var(--chatbot-cream);
    border-bottom-left-radius: 4px;
}

.chatbot-message.user .chatbot-message-bubble {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-message-time {
    font-size: 11px;
    color: var(--chatbot-cream);
    opacity: 0.6;
    margin-top: 4px;
    padding: 0 4px;
}

.chatbot-message.user .chatbot-message-time {
    text-align: right;
}

/* Typing Indicator */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.chatbot-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--chatbot-primary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

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

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

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-8px);
    }
}

/* Quick Actions */
.chatbot-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chatbot-quick-action-btn {
    background: rgba(255, 140, 0, 0.15);
    border: 1px solid var(--chatbot-primary);
    color: var(--chatbot-primary);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chatbot-quick-action-btn:hover {
    background: var(--chatbot-primary);
    color: white;
    transform: translateY(-2px);
}

/* Input Area */
.chatbot-input-area {
    padding: 16px 20px;
    background: var(--chatbot-bg-darker);
    border-top: 1px solid var(--chatbot-glass-border);
}

.chatbot-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--chatbot-white);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    transition: all 0.2s ease;
}

.chatbot-input:focus {
    outline: none;
    border-color: var(--chatbot-primary);
    background: rgba(255, 255, 255, 0.15);
}

.chatbot-input::placeholder {
    color: var(--chatbot-cream);
    opacity: 0.5;
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.4);
}

.chatbot-send-btn:active:not(:disabled) {
    transform: translateY(0);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Welcome Message */
.chatbot-welcome {
    text-align: center;
    padding: 20px;
}

.chatbot-welcome-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.chatbot-welcome h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--chatbot-white);
}

.chatbot-welcome p {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--chatbot-cream);
    opacity: 0.8;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 16px;
        right: 16px;
    }

    .chatbot-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        bottom: 72px;
        right: -8px;
    }

    .chatbot-toggle-btn {
        width: 56px;
        height: 56px;
    }

    .chatbot-icon {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .chatbot-window {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
        position: fixed;
    }

    .chatbot-container {
        bottom: 20px;
        right: 20px;
    }
}

/* Accessibility */
.chatbot-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Error Message */
.chatbot-error {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: #FF6B6B;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    text-align: center;
    margin: 8px 0;
}