:root {
    --bg-color: #0a0a0f;
    --bg-secondary: #12121a;
    --container-bg: #1a1a24;
    --text-primary: #e8e8f0;
    --text-secondary: #a8a8b8;
    --text-tertiary: #6a6a7a;
    --accent-color: #6366f1;
    --accent-hover: #7c3aed;
    --user-bubble: #2d3748;
    --ai-bubble: #1e1e2e;
    --input-bg: #24242e;
    --border-color: #2a2a3a;
    --success-color: #10b981;
    --error-color: #ef4444;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --shadow-color: rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Navigation Bar */
.navbar {
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Crimson Pro', serif;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.logo:hover {
    color: var(--accent-color);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.emotion-badge {
    padding: 0.5rem 1.2rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(124, 58, 237, 0.2));
    border: 1px solid var(--accent-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: lowercase;
    font-style: italic;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(124, 58, 237, 0.5);
    }
}

.nav-link-small {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-link-small:hover {
    color: var(--text-primary);
    background-color: rgba(99, 102, 241, 0.1);
}

/* Main Wrapper */
#main-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    overflow: hidden;
}

#chat-container {
    background-color: var(--container-bg);
    border-radius: 20px;
    box-shadow: 0 20px 60px var(--shadow-color);
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1000px;
    height: calc(100vh - 150px);
    overflow: hidden;
    border: 1px solid var(--border-color);
    animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Chat Header */
#chat-header {
    padding: 2rem 2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(124, 58, 237, 0.05));
}

.chat-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.chat-subtitle {
    font-size: 0.95rem;
    color: var(--text-tertiary);
    margin: 0;
    font-style: italic;
}

/* Chat Box */
#chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) transparent;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 50px,
        rgba(255, 255, 255, 0.01) 50px,
        rgba(255, 255, 255, 0.01) 100px
    );
}

#chat-box::-webkit-scrollbar {
    width: 8px;
}

#chat-box::-webkit-scrollbar-track {
    background: transparent;
}

#chat-box::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 10px;
    transition: background-color 0.3s;
}

#chat-box::-webkit-scrollbar-thumb:hover {
    background-color: var(--accent-hover);
}

/* Messages */
.message {
    max-width: 75%;
    padding: 1rem 1.5rem;
    border-radius: 20px;
    line-height: 1.6;
    font-size: 1rem;
    word-wrap: break-word;
    position: relative;
    animation: slideIn 0.4s ease-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

.user-message {
    align-self: flex-end;
    background: var(--gradient-1);
    color: white;
    border-bottom-right-radius: 5px;
    margin-left: auto;
}

.user-message strong {
    color: rgba(255, 255, 255, 0.9);
}

.ai-message {
    align-self: flex-start;
    background-color: var(--ai-bubble);
    color: var(--text-primary);
    border-bottom-left-radius: 5px;
    border: 1px solid var(--border-color);
    font-family: 'Crimson Pro', serif;
    font-size: 1.05rem;
}

.ai-message strong {
    color: var(--text-secondary);
}

.system-message {
    align-self: center;
    text-align: center;
    color: var(--text-tertiary);
    font-style: italic;
    font-size: 0.9rem;
    margin: 1rem 0;
    max-width: 90%;
    padding: 0.8rem 1.5rem;
    background-color: rgba(99, 102, 241, 0.05);
    border-radius: 15px;
    border: 1px dashed var(--border-color);
}

strong {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.5rem;
    opacity: 0.8;
    font-weight: 600;
}

/* Input Area */
#input-area {
    padding: 1.5rem 2rem;
    background-color: var(--container-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

/* Voice Button */
#voice-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

#voice-btn:hover {
    background-color: var(--accent-hover);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

#voice-btn:active {
    transform: scale(0.95);
}

#voice-btn.listening {
    background-color: var(--error-color);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }
}

#voice-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#voice-btn:disabled:hover {
    transform: none;
}

/* Input Field */
#user-input {
    flex: 1;
    background-color: var(--input-bg);
    border: 2px solid var(--border-color);
    border-radius: 25px;
    padding: 0.9rem 1.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

#user-input::placeholder {
    color: var(--text-tertiary);
    font-style: italic;
}

#user-input:focus {
    border-color: var(--accent-color);
    background-color: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Send Button */
#send-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

#send-btn:hover {
    background-color: var(--accent-hover);
    transform: scale(1.1) rotate(45deg);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

#send-btn:active {
    transform: scale(0.95) rotate(45deg);
}

#send-btn svg {
    transform: rotate(-45deg);
    transition: transform 0.3s ease;
}

/* Toast Container */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    background-color: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 30px var(--shadow-color);
    animation: slideInRight 0.3s ease-out;
    max-width: 300px;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-color: var(--success-color);
    background-color: rgba(16, 185, 129, 0.1);
}

.toast.error {
    border-color: var(--error-color);
    background-color: rgba(239, 68, 68, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }

    .nav-content {
        flex-wrap: wrap;
    }

    .emotion-badge {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }

    #main-wrapper {
        padding: 1rem;
    }

    #chat-container {
        height: calc(100vh - 120px);
        border-radius: 15px;
    }

    #chat-header {
        padding: 1.5rem;
    }

    .chat-title {
        font-size: 1.5rem;
    }

    .chat-subtitle {
        font-size: 0.85rem;
    }

    #chat-box {
        padding: 1.5rem;
        gap: 1rem;
    }

    .message {
        max-width: 85%;
        padding: 0.9rem 1.2rem;
        font-size: 0.95rem;
    }

    #input-area {
        padding: 1rem;
        gap: 0.8rem;
    }

    #voice-btn,
    #send-btn {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }

    #user-input {
        padding: 0.8rem 1.2rem;
        font-size: 0.95rem;
    }

    #toast-container {
        right: 1rem;
        bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .nav-right {
        gap: 0.8rem;
    }

    .emotion-badge {
        display: none;
    }

    #chat-container {
        height: calc(100vh - 100px);
    }

    .chat-title {
        font-size: 1.3rem;
    }

    .message {
        max-width: 90%;
        font-size: 0.9rem;
    }

    #voice-btn,
    #send-btn {
        width: 42px;
        height: 42px;
    }
}

/* Loading Animation */
.typing-indicator {
    display: flex;
    gap: 0.4rem;
    padding: 1rem 1.5rem;
    background-color: var(--ai-bubble);
    border-radius: 20px;
    border-bottom-left-radius: 5px;
    width: fit-content;
    align-self: flex-start;
    border: 1px solid var(--border-color);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: var(--text-tertiary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* Scrollbar styling for Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) transparent;
}
