:root {
    --bg-color: #0F0F0F;
    --container-bg: rgba(18, 18, 18, 0.9);
    --accent-color: #A8E8E2;
    --accent-gradient: linear-gradient(135deg, #A8E8E2 0%, #76C7C0 100%);
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0A0;
    --message-user-bg: linear-gradient(135deg, #2C2C2C 0%, #1A1A1A 100%);
    --message-assistant-bg: rgba(168, 232, 226, 0.08);
    --border-radius: 24px;
    --btn-radius: 60px;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(168, 232, 226, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(168, 232, 226, 0.03) 0px, transparent 50%);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.chat-container {
    width: 100%;
    max-width: 600px;
    height: 100vh;
    background: var(--container-bg);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-soft);
}

header {
    padding: 14px 20px;
    background: #FFFFFF;
    color: #171717;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    position: relative;
    flex-shrink: 0;
}

.logo img {
    height: 28px;
}

.status-indicator {
    display: none;
}

.header-info {
    flex: 1;
    padding: 0 4px;
}

.header-info h1 {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.header-info p {
    font-size: 0.75rem;
    color: #666666;
    white-space: nowrap;
}

#voice-toggle svg.hidden,
#download-btn.hidden {
    display: none;
}

#lang-select {
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 4px 6px;
    font-size: 0.82rem;
    font-family: inherit;
    background: #fff;
    color: #171717;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

#lang-select:focus {
    border-color: var(--accent-color);
}

#stop-btn {
    background: none;
    border: none;
    color: #e53935;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#stop-btn:hover {
    background: rgba(229, 57, 53, 0.1);
    transform: scale(1.1);
}

#voice-toggle, #download-btn {
    background: none;
    border: none;
    color: #171717;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#voice-toggle:hover, #download-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

/* Muted state (default) — red crossed speaker */
#voice-toggle {
    color: #e53935;
    background: rgba(229, 57, 53, 0.08);
    border-radius: 50%;
}

/* Active state — teal speaker */
#voice-toggle.active {
    color: #2e7d32;
    background: rgba(46, 125, 50, 0.1);
}

#download-btn {
    color: #171717;
    margin-right: 8px;
}

main {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

main::-webkit-scrollbar {
    width: 6px;
}

main::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.message {
    max-width: 85%;
    padding: 16px 22px;
    border-radius: var(--border-radius);
    line-height: 1.6;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    align-self: flex-end;
    background-color: var(--message-user-bg);
    border-bottom-right-radius: 5px;
}

.message.assistant {
    align-self: flex-start;
    background-color: var(--message-assistant-bg);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(168, 232, 226, 0.15);
}

.message-content {
    font-size: 0.95rem;
}

.message-content p:has(> .emoji-num),
.message-content li {
    font-size: 1rem;
    line-height: 1.7;
}

/* Make emoji numbers bigger */
.message-content p {
    unicode-bidi: plaintext;
}

.message-content strong {
    font-size: 1rem;
}

.message-content h1, .message-content h2, .message-content h3 {
    margin: 15px 0 10px 0;
    color: var(--accent-color);
    font-size: 1.1rem;
}

.message-content p {
    margin-bottom: 10px;
}

.message-content ul, .message-content ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

.message-content li {
    margin-bottom: 5px;
}

.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.85rem;
}

.message-content th, .message-content td {
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}

.message-content th {
    background: rgba(255, 255, 255, 0.05);
}

.message-content a {
    color: var(--accent-color);
    text-decoration: underline;
}

footer {
    padding: 20px;
    background: #FFFFFF;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.input-wrapper {
    background: #FFFFFF;
    border-radius: var(--btn-radius);
    padding: 8px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.input-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 4px 20px rgba(168, 232, 226, 0.2);
    transform: translateY(-1px);
}

textarea {
    flex: 1;
    background: none;
    border: none;
    color: #171717;
    font-family: inherit;
    font-size: 0.95rem;
    padding: 10px 0;
    resize: none;
    outline: none;
    max-height: 150px;
}

#mic-btn {
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#mic-btn:hover {
    color: #76C7C0;
    background: rgba(168, 232, 226, 0.15);
}

#mic-btn.recording {
    color: #ef5350;
    background-color: rgba(239, 83, 80, 0.1);
    animation: pulse-mic 1.5s infinite;
}

@keyframes pulse-mic {
    0%   { transform: scale(1);   box-shadow: 0 0 0 0   rgba(239, 83, 80, 0.4); }
    70%  { transform: scale(1.2); box-shadow: 0 0 0 10px rgba(239, 83, 80, 0); }
    100% { transform: scale(1);   box-shadow: 0 0 0 0   rgba(239, 83, 80, 0); }
}

#send-btn {
    background: var(--accent-color);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
    color: var(--bg-color);
}

#send-btn:hover {
    transform: scale(1.05);
}

#typing-indicator {
    padding: 10px 20px;
    display: flex;
    gap: 5px;
}

#typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

#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.0); }
}

.hidden {
    display: none !important;
}
