/* Atlas Heart Chatbot - Dark Red Emotional Theme */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&family=Crimson+Pro:wght@400;600&display=swap');

:root {
    --primary-deep: #8b0000;
    --primary-mid: #b91c1c;
    --accent-warm: #dc2626;
    --accent-gold: #f59e0b;
    --neutral-light: #fef2f2;
    --neutral-mid: #fecaca;
    --neutral-dark: #450a0a;
    --text-primary: #1a1a1a;
    --text-secondary: #991b1b;
    --shadow-soft: 0 8px 32px rgba(139, 0, 0, 0.15);
    --shadow-sharp: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#atlas-chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Crimson Pro', serif;
}

.atlas-chat-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-deep) 0%, var(--primary-mid) 100%);
    border: 3px solid var(--accent-gold);
    box-shadow: var(--shadow-soft), 0 0 0 0 rgba(185, 28, 28, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: pulse 3s ease-in-out infinite;
}

.atlas-chat-button:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: var(--shadow-soft), 0 0 0 8px rgba(185, 28, 28, 0.2);
}

.atlas-chat-button svg {
    width: 32px;
    height: 32px;
    fill: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@keyframes pulse {
    0%, 100% {
        box-shadow: var(--shadow-soft), 0 0 0 0 rgba(185, 28, 28, 0.4);
    }
    50% {
        box-shadow: var(--shadow-soft), 0 0 0 12px rgba(185, 28, 28, 0);
    }
}

.atlas-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 420px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-soft), 0 0 1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--neutral-mid);
}

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

.atlas-chat-header {
    background: linear-gradient(135deg, var(--primary-deep) 0%, var(--primary-mid) 100%);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--accent-gold);
    position: relative;
}

.atlas-chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--accent-warm) 50%, 
        transparent 100%);
    opacity: 0.5;
}

.atlas-chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.atlas-chat-icon {
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.atlas-chat-icon svg {
    width: 20px;
    height: 20px;
    fill: var(--primary-deep);
}

.atlas-chat-title-text {
    color: white;
}

.atlas-chat-title-text h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.atlas-chat-title-text p {
    margin: 2px 0 0 0;
    font-size: 12px;
    opacity: 0.85;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.5px;
}

.atlas-chat-close {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 20px;
    font-weight: 300;
}

.atlas-chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.atlas-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: linear-gradient(to bottom, 
        rgba(248, 249, 250, 0.5) 0%, 
        rgba(255, 255, 255, 1) 100%);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.atlas-chat-messages::-webkit-scrollbar-track {
    background: var(--neutral-light);
}

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

.atlas-message {
    display: flex;
    gap: 12px;
    animation: messageSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.atlas-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 14px;
    box-shadow: var(--shadow-sharp);
}

.atlas-message.assistant .atlas-message-avatar {
    background: linear-gradient(135deg, var(--primary-deep), var(--primary-mid));
    color: white;
    border: 2px solid var(--accent-gold);
}

.atlas-message.user .atlas-message-avatar {
    background: linear-gradient(135deg, var(--accent-warm), #ef4444);
    color: white;
}

.atlas-message-content {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 15px;
    position: relative;
}

.atlas-message.assistant .atlas-message-content {
    background: white;
    border: 1px solid var(--neutral-mid);
    border-left: 3px solid var(--primary-mid);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.atlas-message.user .atlas-message-content {
    background: linear-gradient(135deg, var(--primary-deep), var(--primary-mid));
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(45, 122, 143, 0.25);
}

.atlas-message-sources {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.atlas-source-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--neutral-light);
    border: 1px solid var(--neutral-mid);
    border-radius: 12px;
    font-size: 11px;
    font-family: 'IBM Plex Mono', monospace;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.atlas-source-tag.pdf {
    background: rgba(212, 165, 116, 0.15);
    border-color: var(--accent-gold);
    color: #8b6f47;
}

.atlas-source-tag.web {
    background: rgba(185, 28, 28, 0.15);
    border-color: var(--primary-mid);
    color: var(--primary-deep);
}

.atlas-chat-input-wrapper {
    padding: 20px 24px;
    background: white;
    border-top: 1px solid var(--neutral-mid);
    position: relative;
}

.atlas-language-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    justify-content: center;
}

.atlas-lang-btn {
    padding: 6px 12px;
    border: 2px solid var(--neutral-mid);
    background: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-family: 'IBM Plex Mono', monospace;
}

.atlas-lang-btn:hover {
    border-color: var(--primary-mid);
    background: var(--neutral-light);
}

.atlas-lang-btn.active {
    background: linear-gradient(135deg, var(--primary-deep), var(--primary-mid));
    border-color: var(--primary-mid);
    color: white;
}

.atlas-chat-input-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--primary-mid) 50%, 
        transparent 100%);
    opacity: 0.3;
}

.atlas-chat-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.atlas-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--neutral-mid);
    border-radius: 12px;
    font-family: 'Crimson Pro', serif;
    font-size: 15px;
    resize: none;
    max-height: 120px;
    transition: all 0.2s;
    background: var(--neutral-light);
}

.atlas-chat-input:focus {
    outline: none;
    border-color: var(--primary-mid);
    background: white;
    box-shadow: 0 0 0 3px rgba(45, 122, 143, 0.1);
}

.atlas-chat-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-deep), var(--primary-mid));
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(185, 28, 28, 0.3);
}

.atlas-chat-send:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(185, 28, 28, 0.4);
}

.atlas-chat-send:active:not(:disabled) {
    transform: translateY(0);
}

.atlas-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.atlas-chat-send svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.atlas-chat-voice {
    width: 44px;
    height: 44px;
    background: white;
    border: 2px solid var(--neutral-mid);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.atlas-chat-voice:hover {
    border-color: var(--primary-mid);
    background: var(--neutral-light);
}

.atlas-chat-voice.listening {
    background: linear-gradient(135deg, var(--accent-warm), #ef4444);
    border-color: var(--accent-warm);
    animation: voicePulse 1.5s ease-in-out infinite;
}

.atlas-chat-voice svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.atlas-chat-voice.listening svg {
    fill: white;
}

@keyframes voicePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.atlas-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    background: white;
    border: 1px solid var(--neutral-mid);
    border-left: 3px solid var(--primary-mid);
    border-radius: 16px;
    width: fit-content;
}

.atlas-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--primary-mid);
    border-radius: 50%;
    animation: typing 1.4s ease-in-out infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

.atlas-welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.atlas-welcome-message h4 {
    font-size: 20px;
    color: var(--primary-deep);
    margin: 0 0 12px 0;
    font-weight: 600;
}

.atlas-welcome-message p {
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

/* Responsive */
@media (max-width: 480px) {
    .atlas-chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        right: 16px;
        bottom: 84px;
    }
    
    #atlas-chatbot-container {
        right: 16px;
        bottom: 16px;
    }
}
