/**
 * AI Chat Widget Styles
 * Modern, responsive chat widget for Gemini AI integration
 */

/* CSS Variables for theming */
:root {
    --chat-primary: #ecc526;
    --chat-primary-hover: #d4b022;
    --chat-bg: #0a0a0a;
    --chat-surface: #1a1a2e;
    --chat-surface-light: #252542;
    --chat-text: #ffffff;
    --chat-text-muted: #a0a0a0;
    --chat-user-bubble: #ecc526;
    --chat-user-text: #0a0a0a;
    --chat-bot-bubble: #252542;
    --chat-bot-text: #ffffff;
    --chat-border: rgba(236, 197, 38, 0.2);
    --chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    --chat-radius: 16px;
    --chat-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Chat Widget Container */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Poppins', sans-serif;
}

/* Chat Toggle Button */
.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-hover) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--chat-shadow), 0 0 20px rgba(236, 197, 38, 0.3);
    transition: var(--chat-transition);
    position: relative;
    overflow: hidden;
}

.chat-toggle-btn::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    border-radius: 50%;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--chat-shadow), 0 0 30px rgba(236, 197, 38, 0.5);
}

.chat-toggle-btn:active {
    transform: scale(0.95);
}

.chat-toggle-btn svg {
    width: 28px;
    height: 28px;
    fill: var(--chat-bg);
    transition: var(--chat-transition);
}

.chat-toggle-btn.active .chat-icon {
    display: none;
}

.chat-toggle-btn .close-icon {
    display: none;
}

.chat-toggle-btn.active .close-icon {
    display: block;
}

/* Notification Badge */
.chat-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ff4757;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: var(--chat-bg);
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: var(--chat-transition);
    border: 1px solid var(--chat-border);
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--chat-surface) 0%, var(--chat-surface-light) 100%);
    border-bottom: 1px solid var(--chat-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-avatar svg {
    width: 24px;
    height: 24px;
    fill: var(--chat-bg);
}

.chat-header-info {
    flex: 1;
}

.chat-header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--chat-text);
    margin: 0 0 2px 0;
}

.chat-header-status {
    font-size: 12px;
    color: var(--chat-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ed573;
    animation: pulse-status 2s infinite;
}

@keyframes pulse-status {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-minimize-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition);
}

.chat-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-minimize-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--chat-text);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--chat-bg);
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--chat-surface-light);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--chat-primary);
}

/* Message Bubbles */
.chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: message-appear 0.3s ease-out;
}

@keyframes message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.bot {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-message.bot .message-avatar {
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-hover) 100%);
}

.chat-message.user .message-avatar {
    background: var(--chat-surface-light);
}

.message-avatar svg {
    width: 16px;
    height: 16px;
}

.chat-message.bot .message-avatar svg {
    fill: var(--chat-bg);
}

.chat-message.user .message-avatar svg {
    fill: var(--chat-text);
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, var(--chat-user-bubble) 0%, var(--chat-primary-hover) 100%);
    color: var(--chat-user-text);
    border-bottom-right-radius: 4px;
}

.chat-message.bot .message-bubble {
    background: var(--chat-bot-bubble);
    color: var(--chat-bot-text);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--chat-text-muted);
    padding: 0 4px;
}

.chat-message.user .message-time {
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 0;
}

.typing-indicator .message-avatar {
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-hover) 100%);
}

.typing-indicator .message-avatar svg {
    fill: var(--chat-bg);
}

.typing-dots {
    background: var(--chat-bot-bubble);
    padding: 16px 20px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chat-text-muted);
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Chat Input */
.chat-input-container {
    padding: 16px;
    background: var(--chat-surface);
    border-top: 1px solid var(--chat-border);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    border-radius: 24px;
    padding: 12px 20px;
    font-size: 14px;
    color: var(--chat-text);
    outline: none;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    transition: var(--chat-transition);
}

.chat-input::placeholder {
    color: var(--chat-text-muted);
}

.chat-input:focus {
    border-color: var(--chat-primary);
    box-shadow: 0 0 0 3px rgba(236, 197, 38, 0.1);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-hover) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition);
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(236, 197, 38, 0.4);
}

.chat-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--chat-bg);
    transform: rotate(-45deg);
    margin-left: 2px;
}

/* Welcome Message */
.chat-welcome {
    text-align: center;
    padding: 20px;
}

.chat-welcome-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-hover) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-welcome-icon svg {
    width: 30px;
    height: 30px;
    fill: var(--chat-bg);
}

.chat-welcome h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--chat-text);
    margin: 0 0 8px 0;
}

.chat-welcome p {
    font-size: 14px;
    color: var(--chat-text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Quick Actions */
.chat-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}

.quick-action-btn {
    padding: 8px 16px;
    background: var(--chat-surface-light);
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    color: var(--chat-text);
    font-size: 13px;
    cursor: pointer;
    transition: var(--chat-transition);
    font-family: inherit;
}

.quick-action-btn:hover {
    background: var(--chat-primary);
    color: var(--chat-bg);
    border-color: var(--chat-primary);
}

/* Error Message */
.chat-error {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: #ff4757;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    text-align: center;
}

/* Responsive */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chat-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 100px);
        bottom: 75px;
        right: -7px;
    }
    
    .chat-toggle-btn {
        width: 55px;
        height: 55px;
    }
    
    .chat-header {
        padding: 14px 16px;
    }
    
    .chat-messages {
        padding: 16px;
    }
    
    .chat-input-container {
        padding: 12px;
    }
}

/* Dark Mode Support (already dark by default) */
@media (prefers-color-scheme: light) {
    /* Keep dark theme for chat widget even in light mode for consistency */
}
