/* ===================================
   Rygen AI Chat Widget - News Assistant
   =================================== */

.rygen-chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e63946 0%, #c62828 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(230, 57, 70, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9998;
    border: none;
}

.rygen-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(230, 57, 70, 0.5);
}

.rygen-chat-toggle.active {
    transform: rotate(90deg);
}

.rygen-chat-toggle .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #ffd700;
    color: #1a1a2e;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Window */
.rygen-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    max-height: 560px;
    background: var(--bg-white, #ffffff);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border: 1px solid var(--border, #e2e8f0);
}

.rygen-chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.rygen-chat-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.rygen-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #e63946, #ff6b6b);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
}

.rygen-header-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.rygen-header-info span {
    font-size: 11px;
    opacity: 0.75;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rygen-header-info .online-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
}

.rygen-close {
    margin-left: auto;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.rygen-close:hover {
    background: rgba(255,255,255,0.2);
}

/* Chat Messages */
.rygen-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 300px;
    max-height: 360px;
    background: var(--bg, #f8fafc);
}

.rygen-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.rygen-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Message Bubbles */
.rygen-message {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rygen-message.bot {
    align-self: flex-start;
}

.rygen-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.rygen-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.rygen-message.bot .rygen-msg-avatar {
    background: linear-gradient(135deg, #e63946, #ff6b6b);
    color: #fff;
}

.rygen-message.user .rygen-msg-avatar {
    background: #1a1a2e;
    color: #fff;
}

.rygen-msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.rygen-message.bot .rygen-msg-bubble {
    background: var(--bg-white, #ffffff);
    color: var(--text, #1a1a2e);
    border: 1px solid var(--border, #e2e8f0);
    border-bottom-left-radius: 4px;
}

.rygen-message.user .rygen-msg-bubble {
    background: #1a1a2e;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.rygen-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.rygen-typing span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.rygen-typing span:nth-child(2) { animation-delay: 0.2s; }
.rygen-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Suggestions */
.rygen-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px;
    border-top: 1px solid var(--border, #e2e8f0);
    background: var(--bg-white, #ffffff);
}

.rygen-suggestion-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #e63946;
    background: rgba(230, 57, 70, 0.08);
    border: 1px solid rgba(230, 57, 70, 0.2);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.rygen-suggestion-btn:hover {
    background: #e63946;
    color: #fff;
    border-color: #e63946;
}

/* Chat Input */
.rygen-chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border, #e2e8f0);
    background: var(--bg-white, #ffffff);
}

.rygen-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: 'Inter', sans-serif;
    background: var(--bg, #f8fafc);
    color: var(--text, #1a1a2e);
}

.rygen-input:focus {
    border-color: #e63946;
}

.rygen-input::placeholder {
    color: #94a3b8;
}

.rygen-send {
    width: 40px;
    height: 40px;
    background: #e63946;
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.rygen-send:hover {
    background: #c62828;
    transform: scale(1.05);
}

.rygen-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .rygen-chat-window {
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 100vh;
        border-radius: 16px 16px 0 0;
    }

    .rygen-chat-toggle {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
        font-size: 20px;
    }
}
