/* ============================================
   CloudDani AI Chatbot - Netflix Theme
   ============================================ */

/* ============================================
   Floating Chat Button
   ============================================ */
.chat-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #b00610 100%);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(229, 9, 20, 0.5);
    z-index: 9998;
    transition: all var(--transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(229, 9, 20, 0.7);
}

.chat-button:active {
    transform: scale(0.95);
}

.chat-button.active {
    background: linear-gradient(135deg, #808080 0%, #555555 100%);
}

/* Notification badge */
.chat-button-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #00ff00;
    color: #000;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Chat Window
   ============================================ */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 2rem;
    width: 400px;
    height: 600px;
    max-height: 80vh;
    background-color: rgba(20, 20, 20, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(229, 9, 20, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.chat-window.active {
    display: flex;
}

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

/* ============================================
   Chat Header
   ============================================ */
.chat-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #b00610 100%);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chat-header-text h3 {
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
}

.chat-status {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #00ff00;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.chat-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color var(--transition-speed);
}

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

/* ============================================
   Chat Messages Area
   ============================================ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: rgba(0, 0, 0, 0.3);
}

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

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

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

/* ============================================
   Message Bubbles
   ============================================ */
.message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

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

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

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

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

.message.bot .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--primary-color) 0%, #b00610 100%);
}

.message-content {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 0.9rem;
}

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

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

.message-time {
    font-size: 0.7rem;
    color: var(--netflix-gray);
    margin-top: 0.3rem;
    display: block;
}

/* ============================================
   Typing Indicator
   ============================================ */
.typing-indicator {
    display: none;
    gap: 0.75rem;
    max-width: 85%;
    align-self: flex-start;
}

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

.typing-content {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 0.4rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--netflix-gray);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

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

.quick-replies.active {
    display: flex;
}

.quick-reply-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-speed);
    white-space: nowrap;
}

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

/* ============================================
   Chat Input Area
   ============================================ */
.chat-input-area {
    padding: 1rem 1.5rem;
    background-color: rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.chat-input {
    flex: 1;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 0.75rem 1.25rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all var(--transition-speed);
}

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

.chat-input::placeholder {
    color: var(--netflix-gray);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.chat-send-btn:hover {
    background-color: #f40612;
    transform: scale(1.1);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

.chat-send-btn:disabled {
    background-color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Welcome Screen
   ============================================ */
.chat-welcome {
    text-align: center;
    padding: 2rem 1.5rem;
}

.chat-welcome-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.chat-welcome h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.chat-welcome p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 768px) {
    .chat-window {
        width: calc(100vw - 2rem);
        right: 1rem;
        bottom: 90px;
        height: 500px;
    }
    
    .chat-button {
        bottom: 1.5rem;
        right: 1.5rem;
    }
}

@media (max-width: 480px) {
    .chat-window {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }
    
    .chat-button {
        width: 55px;
        height: 55px;
        bottom: 1rem;
        right: 1rem;
    }
}

/* ============================================
   Link Styling in Messages
   ============================================ */
.message-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.message-content a:hover {
    color: #f40612;
}

/* Code blocks in messages */
.message-content code {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

/* Lists in messages */
.message-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-content ul li {
    margin: 0.3rem 0;
}
