body {
    background-color: #0f172a;
    color: #e2e8f0;
}

.card {
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
}

.badge-success {
    background-color: #064e3b;
    color: #6ee7b7;
    border: 1px solid #059669;
}

.badge-warning {
    background-color: #451a03;
    color: #fdba74;
    border: 1px solid #d97706;
}

.badge-error {
    background-color: #450a0a;
    color: #fca5a5;
    border: 1px solid #dc2626;
}

.animate-blink {
    animation: blink 1s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.model-flash {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}

.model-pro-high {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
}

.model-pro-image {
    background: linear-gradient(135deg, #be185d 0%, #ec4899 100%);
}

.pulse-ring {
    animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    80%,
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.scrollbar-thin::-webkit-scrollbar {
    width: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: #1e293b;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

/* Chat Modal Styles */
.chat-modal {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 420px;
    height: 600px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

.chat-modal.open {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
    transition: all 0.3s ease;
    z-index: 999;
}

.chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 35px rgba(59, 130, 246, 0.5);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    /* Handle newlines correctly */
    word-wrap: break-word;
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: white;
}

.message.assistant {
    align-self: flex-start;
    background: #334155;
    color: #e2e8f0;
}

.message.error {
    background: #450a0a;
    color: #fca5a5;
    border: 1px solid #dc2626;
}

.message img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 8px;
}

.message audio {
    width: 100%;
    margin-top: 8px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #64748b;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Smooth Text Reveal Animation */
@keyframes smoothReveal {
    0% {
        opacity: 0;
        transform: translateY(3px);
        /* Reduced movement for less jumpiness */
        filter: blur(2px);
        /* Subtler blur */
    }

    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

.fade-in-text {
    /* Faster duration: 0.6s for smoother feel with queue */
    animation: smoothReveal 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    display: inline;
    /* Use inline to flow better with text */
    white-space: pre-wrap;
    /* Preserve spaces in chunks */
}

.chat-input-area {
    border-top: 1px solid #334155;
    padding: 12px;
    background: #1e293b;
}

.chat-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.chat-controls select {
    flex: 1;
    background: #0f172a;
    border: 1px solid #334155;
    color: #e2e8f0;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
}

.chat-input-row {
    display: flex;
    gap: 8px;
}

.chat-input-row textarea {
    flex: 1;
    background: #0f172a;
    border: 1px solid #334155;
    color: #e2e8f0;
    padding: 10px 12px;
    border-radius: 12px;
    resize: none;
    font-size: 14px;
    max-height: 100px;
}

.chat-input-row textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.chat-input-row button {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.chat-input-row button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.attachment-btn {
    background: #334155 !important;
    padding: 10px !important;
}

.api-key-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 10;
}

.api-key-overlay.hidden {
    display: none;
}

.api-key-input {
    width: 100%;
    background: #0f172a;
    border: 1px solid #334155;
    color: #e2e8f0;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    margin-top: 16px;
}

.api-key-btn {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border: none;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    margin-top: 12px;
    cursor: pointer;
    font-weight: 600;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .chat-modal {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        border: none;
    }

    .chat-modal.open {
        animation: slideUpMobile 0.3s ease-out;
    }

    .chat-fab {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
    }

    .message {
        max-width: 90%;
    }
}

@keyframes slideUpMobile {
    from {
        opacity: 0;
        transform: translateY(100%);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}