/**
 * CinemaBot Pro Chatbot Styles
 * 
 * Specific styles for the chatbot interface
 */

/* === Chatbot Container === */
.cinemabotpro-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: var(--cbp-bg);
    border: 1px solid var(--cbp-border);
    border-radius: var(--cbp-radius-lg);
    box-shadow: var(--cbp-shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cinemabotpro-chatbot.active {
    transform: translateY(0);
    opacity: 1;
}

.cinemabotpro-chatbot.minimized {
    height: 60px;
    transform: translateY(calc(100% - 60px));
}

/* === Chatbot Toggle Button === */
.cinemabotpro-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--cbp-primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--cbp-shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--cbp-transition);
    z-index: 9999;
}

.cinemabotpro-toggle:hover {
    background: var(--cbp-primary-dark);
    transform: scale(1.05);
}

.cinemabotpro-toggle.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* === Header === */
.cinemabotpro-header {
    padding: 1rem;
    background: var(--cbp-primary);
    color: white;
    border-radius: var(--cbp-radius-lg) var(--cbp-radius-lg) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.cinemabotpro-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.125rem;
}

.cinemabotpro-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: var(--cbp-transition);
}

.cinemabotpro-avatar.rotating {
    animation: cbp-avatarRotate 0.5s ease-in-out;
}

@keyframes cbp-avatarRotate {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(0.8) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

.cinemabotpro-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cinemabotpro-control-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--cbp-radius-sm);
    transition: var(--cbp-transition);
    opacity: 0.8;
}

.cinemabotpro-control-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

/* === Status Bar === */
.cinemabotpro-status {
    padding: 0.5rem 1rem;
    background: var(--cbp-bg-light);
    border-bottom: 1px solid var(--cbp-border);
    font-size: 0.75rem;
    color: var(--cbp-text-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cinemabotpro-typing-indicator {
    display: none;
    align-items: center;
    gap: 0.5rem;
}

.cinemabotpro-typing-indicator.active {
    display: flex;
}

.cinemabotpro-typing-dots {
    display: flex;
    gap: 2px;
}

.cinemabotpro-typing-dot {
    width: 4px;
    height: 4px;
    background: var(--cbp-primary);
    border-radius: 50%;
    animation: cbp-typingDot 1.4s ease-in-out infinite both;
}

.cinemabotpro-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.cinemabotpro-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes cbp-typingDot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* === Messages Area === */
.cinemabotpro-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--cbp-bg);
}

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

.cinemabotpro-messages::-webkit-scrollbar-track {
    background: var(--cbp-bg-light);
}

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

.cinemabotpro-messages::-webkit-scrollbar-thumb:hover {
    background: var(--cbp-secondary);
}

/* === Message Bubbles === */
.cinemabotpro-message {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: 85%;
    animation: cbp-messageSlideIn 0.3s ease-out;
}

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

.cinemabotpro-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

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

.cinemabotpro-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.cinemabotpro-message-content {
    background: var(--cbp-bg-light);
    padding: 0.75rem 1rem;
    border-radius: var(--cbp-radius);
    font-size: 0.875rem;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}

.cinemabotpro-message.user .cinemabotpro-message-content {
    background: var(--cbp-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.cinemabotpro-message.bot .cinemabotpro-message-content {
    border-bottom-left-radius: 4px;
}

.cinemabotpro-message-time {
    font-size: 0.625rem;
    color: var(--cbp-text-light);
    margin-top: 0.25rem;
    text-align: right;
}

.cinemabotpro-message.bot .cinemabotpro-message-time {
    text-align: left;
}

/* === Message Actions === */
.cinemabotpro-message-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
    opacity: 0;
    transition: var(--cbp-transition);
}

.cinemabotpro-message:hover .cinemabotpro-message-actions {
    opacity: 1;
}

.cinemabotpro-message-action {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--cbp-radius-sm);
    color: var(--cbp-text-light);
    font-size: 0.75rem;
    transition: var(--cbp-transition);
}

.cinemabotpro-message-action:hover {
    background: var(--cbp-bg-light);
    color: var(--cbp-text);
}

/* === Quick Replies === */
.cinemabotpro-quick-replies {
    padding: 0 1rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cinemabotpro-quick-reply {
    background: var(--cbp-bg-light);
    border: 1px solid var(--cbp-border);
    border-radius: var(--cbp-radius-lg);
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--cbp-transition);
    white-space: nowrap;
}

.cinemabotpro-quick-reply:hover {
    background: var(--cbp-primary);
    color: white;
    border-color: var(--cbp-primary);
}

/* === Input Area === */
.cinemabotpro-input-area {
    padding: 1rem;
    border-top: 1px solid var(--cbp-border);
    background: var(--cbp-bg);
    border-radius: 0 0 var(--cbp-radius-lg) var(--cbp-radius-lg);
}

.cinemabotpro-input-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.cinemabotpro-input-wrapper {
    flex: 1;
    position: relative;
}

.cinemabotpro-input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1rem;
    border: 1px solid var(--cbp-border);
    border-radius: var(--cbp-radius-lg);
    background: var(--cbp-bg);
    color: var(--cbp-text);
    font-size: 0.875rem;
    resize: none;
    max-height: 100px;
    min-height: 44px;
    line-height: 1.4;
    transition: var(--cbp-transition);
}

.cinemabotpro-input:focus {
    outline: none;
    border-color: var(--cbp-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.cinemabotpro-input-actions {
    position: absolute;
    right: 0.5rem;
    bottom: 0.5rem;
    display: flex;
    gap: 0.25rem;
}

.cinemabotpro-input-action {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--cbp-radius-sm);
    color: var(--cbp-text-light);
    transition: var(--cbp-transition);
}

.cinemabotpro-input-action:hover {
    color: var(--cbp-primary);
}

.cinemabotpro-send-btn {
    background: var(--cbp-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--cbp-transition);
    flex-shrink: 0;
}

.cinemabotpro-send-btn:hover:not(:disabled) {
    background: var(--cbp-primary-dark);
}

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

/* === Language Selector === */
.cinemabotpro-language-selector {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--cbp-bg);
    border: 1px solid var(--cbp-border);
    border-radius: var(--cbp-radius);
    box-shadow: var(--cbp-shadow-lg);
    padding: 0.5rem;
    display: none;
    z-index: 10000;
}

.cinemabotpro-language-selector.active {
    display: block;
    animation: cbp-fadeIn 0.2s ease-out;
}

.cinemabotpro-language-option {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    border-radius: var(--cbp-radius-sm);
    transition: var(--cbp-transition);
    white-space: nowrap;
}

.cinemabotpro-language-option:hover {
    background: var(--cbp-bg-light);
}

.cinemabotpro-language-option.active {
    background: var(--cbp-primary);
    color: white;
}

/* === Search Results === */
.cinemabotpro-search-results {
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid var(--cbp-border);
    background: var(--cbp-bg);
}

.cinemabotpro-search-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--cbp-border-light);
    cursor: pointer;
    transition: var(--cbp-transition);
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.cinemabotpro-search-item:hover {
    background: var(--cbp-bg-light);
}

.cinemabotpro-search-item:last-child {
    border-bottom: none;
}

.cinemabotpro-search-poster {
    width: 40px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--cbp-radius-sm);
    flex-shrink: 0;
}

.cinemabotpro-search-info {
    flex: 1;
    min-width: 0;
}

.cinemabotpro-search-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cinemabotpro-search-meta {
    font-size: 0.75rem;
    color: var(--cbp-text-light);
}

/* === Responsive Design === */
@media (max-width: 768px) {
    .cinemabotpro-chatbot {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        border-radius: 0;
        transform: translateY(100%);
    }
    
    .cinemabotpro-chatbot.active {
        transform: translateY(0);
    }
    
    .cinemabotpro-chatbot.minimized {
        height: 60px;
        transform: translateY(calc(100% - 60px));
    }
    
    .cinemabotpro-toggle {
        bottom: 10px;
        right: 10px;
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .cinemabotpro-header {
        border-radius: 0;
    }
    
    .cinemabotpro-input-area {
        border-radius: 0;
    }
}

/* === Theme Variations === */
.cinemabotpro-chatbot.theme-dark {
    --cbp-bg: #1f2937;
    --cbp-bg-light: #374151;
    --cbp-text: #f9fafb;
    --cbp-text-light: #d1d5db;
    --cbp-border: #4b5563;
    --cbp-border-light: #374151;
}

.cinemabotpro-chatbot.theme-cinema {
    --cbp-primary: #dc2626;
    --cbp-primary-dark: #b91c1c;
    --cbp-accent: #fbbf24;
}

.cinemabotpro-chatbot.theme-neon {
    --cbp-primary: #8b5cf6;
    --cbp-primary-dark: #7c3aed;
    --cbp-accent: #06d6a0;
    --cbp-bg: #0f0f23;
    --cbp-bg-light: #1a1a3e;
    --cbp-text: #e2e8f0;
    --cbp-border: #2d3748;
}

/* === Accessibility === */
@media (prefers-reduced-motion: reduce) {
    .cinemabotpro-chatbot,
    .cinemabotpro-toggle,
    .cinemabotpro-message,
    .cinemabotpro-avatar {
        animation: none;
        transition: none;
    }
}

.cinemabotpro-chatbot:focus-within {
    outline: 2px solid var(--cbp-primary);
    outline-offset: 2px;
}

/* === High Contrast Mode === */
@media (prefers-contrast: high) {
    .cinemabotpro-chatbot {
        border: 2px solid var(--cbp-text);
    }
    
    .cinemabotpro-message-content {
        border: 1px solid var(--cbp-text);
    }
}