:root {
    /* Colors from Figma */
    --primary-cyan: #00D9E1;
    --dark-navy: #2C3E50;
    --dark-bg: #2D3250;
    --slate-gray: #5A6478;
    --light-bg: #FAFAFA;
    --text-dark: #333333;
    --text-light: #FFFFFF;
    --timestamp-gray: #999999;
    --border-gray: #E0E0E0;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--dark-bg);
    min-height: 100vh;
    padding: 0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--dark-bg);
}

header {
    background: var(--dark-bg);
    padding: var(--spacing-lg) var(--spacing-lg) 9px var(--spacing-lg);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.odin-logo {
    display: none;
}

.logo-container {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    flex-shrink: 0;
    overflow: hidden;
}

.logo {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.header-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

header h1 {
    font-size: 22px;
    color: var(--primary-cyan);
    margin: 0;
    font-weight: 600;
}

.subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    margin: -5px 0 0 0;
}

.settings-btn {
    background: transparent;
    border: none;
    padding: var(--spacing-sm);
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.2s;
    min-width: auto;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (hover: hover) {
.settings-btn:hover {
    color: var(--text-light);
    transform: none;
}
}

.settings-btn svg {
    width: 24px;
    height: 24px;
}

.chat-container {
    background: var(--dark-bg);
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.welcome-message {
    background: var(--slate-gray);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    border-left: 4px solid var(--primary-cyan);
    margin-bottom: var(--spacing-md);
}

.welcome-message h3 {
    color: var(--text-light);
    margin-bottom: var(--spacing-sm);
    font-size: 1.125rem;
}

.welcome-message p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

.example-questions {
    margin-top: var(--spacing-md);
    font-size: 0.95rem;
}

.example-questions ul {
    margin-left: var(--spacing-lg);
    margin-top: var(--spacing-sm);
    color: rgba(255, 255, 255, 0.7);
}

.example-questions li {
    margin: var(--spacing-xs) 0;
    cursor: pointer;
    transition: color 0.2s;
    color: rgba(255, 255, 255, 0.7);
}

@media (hover: hover) {
.example-questions li:hover {
    color: var(--primary-cyan);
}
}

.message {
    margin-bottom: var(--spacing-sm);
    animation: slideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.message.question {
    align-items: flex-end;
}

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

.question {
    background: #F5F5F5;
    color: var(--text-dark);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    align-self: flex-end;
    max-width: 90%;
    text-align: left !important;
    font-size: 1rem;
    line-height: 1.5;
    direction: ltr;
    display: block;
    width: auto;
}

.answer {
    background: var(--slate-gray);
    color: var(--text-light);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    align-self: flex-start;
    max-width: 90%;
    font-size: 1rem;
    line-height: 1.6;
}

.answer-text {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 0;
}

.answer-text p {
    margin-bottom: var(--spacing-md);
}

.answer-text p:last-child {
    margin-bottom: 0;
}

.answer-text ul {
    margin: var(--spacing-md) 0;
    padding-left: var(--spacing-lg);
}

.answer-text ol {
    margin: var(--spacing-md) 0;
    padding-left: var(--spacing-lg);
}

.answer-text li {
    margin: var(--spacing-sm) 0;
}

.answer-text strong {
    font-weight: 600;
    color: var(--primary-cyan);
}

.answer-text a {
    color: var(--primary-cyan);
    text-decoration: underline;
}

.answer-text code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
}

.citations {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.citations-header {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

@media (hover: hover) {
.citations-header:hover {
    color: var(--primary-cyan);
}
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 0.7rem;
}

.citations.expanded .toggle-icon {
    transform: rotate(90deg);
}

.citations-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.citations.expanded .citations-content {
    max-height: 2000px;
    transition: max-height 0.5s ease-in;
}

.citation {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
}

.citation-text {
    line-height: 1.5;
    max-height: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.citation-source {
    margin-top: var(--spacing-sm);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

.error {
    background: #fee;
    color: #c33;
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    border-left: 3px solid #c33;
    align-self: flex-start;
    max-width: 70%;
}

.input-container {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--dark-bg);
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    position: relative;
}

.input-border-wrapper {
    flex: 1;
    background: linear-gradient(90deg, #0097FF 0%, #00FFFF 50%, #C7E8FF 100%);
    border-radius: 25px;
    padding: 2px;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
    position: relative;
}

#questionInput {
    width: 100%;
    padding: var(--spacing-md) 50px var(--spacing-md) var(--spacing-lg);
    border: none;
    background: var(--dark-navy);
    color: var(--text-light);
    border-radius: 23px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

.submit-btn-inside {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 2px solid transparent;
    border-radius: 50%;
    padding: 0;
    width: 36px;
    height: 36px;
    min-width: auto;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.submit-btn-inside img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@media (hover: hover) {
.submit-btn-inside:hover:not(:disabled) {
    background: transparent;
    transform: translateY(-50%) scale(1.1);
    border-color: var(--primary-cyan);
    box-shadow: 0 0 8px rgba(0, 217, 225, 0.5);
}
}

/* Remove focus outline on mobile/touch - only show for keyboard navigation */
.submit-btn-inside:focus {
    outline: none;
}

.submit-btn-inside:focus:not(:focus-visible) {
    border-color: transparent;
    box-shadow: none;
    transform: translateY(-50%) scale(1);
}

.submit-btn-inside:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.submit-btn-inside .loading {
    position: absolute;
    color: var(--text-light);
}

#questionInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#questionInput:focus {
    box-shadow: 0 0 0 3px rgba(0, 217, 225, 0.2);
}

button {
    background: var(--primary-cyan);
    color: white;
    border: none;
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: auto;
}

@media (hover: hover) {
button:hover:not(:disabled) {
    background: #00b8be;
    transform: translateY(-1px);
}
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.loading {
    animation: blink 1.4s infinite;
}

@keyframes blink {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    padding: var(--spacing-md);
    font-size: 0.875rem;
    background: var(--dark-bg);
    flex-shrink: 0;
}

footer p {
    margin: 0;
}

footer .version {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 4px;
    opacity: 0.7;
}

/* Scrollbar styling */
.messages::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: var(--border-gray);
    border-radius: 3px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: var(--timestamp-gray);
}

/* Voice Interface Styles */
.voice-btn, .speaker-btn, .conversation-btn {
    background: #4F5264;
    border: 2px solid transparent;
    color: #8A8B97;
    padding: 6px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    flex-shrink: 0;
}

/* Voice buttons container for positioning language picker */
.voice-buttons-container {
    position: relative;
    display: flex;
    gap: 8px;
}

/* Language picker popup */
.lang-picker {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    background: #3A3D4E;
    border: 1px solid var(--primary-cyan);
    border-radius: 6px;
    padding: 2px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.lang-option {
    background: transparent;
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: background 0.2s;
    text-align: left;
}

.lang-option:hover {
    background: #4F5264;
}

.lang-option:active {
    background: var(--primary-cyan);
}

.voice-btn svg, .speaker-btn svg, .conversation-btn svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.conversation-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    pointer-events: none;
}

@media (hover: hover) {
.voice-btn:hover:not(:disabled), .speaker-btn:hover:not(:disabled), .conversation-btn:hover:not(:disabled) {
    background: #4F5264;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 8px rgba(0, 217, 225, 0.5);
    transform: scale(1.1);
}
}

/* Remove focus outline on mobile/touch - only show for keyboard navigation */
.voice-btn:focus, .speaker-btn:focus, .conversation-btn:focus {
    outline: none;
}

.voice-btn:focus:not(:focus-visible), .speaker-btn:focus:not(:focus-visible), .conversation-btn:focus:not(:focus-visible) {
    border-color: transparent;
    box-shadow: none;
    transform: scale(1);
}

.voice-btn.recording {
    background: var(--primary-cyan);
    border-color: var(--primary-cyan);
    color: white;
    animation: pulse 1.5s infinite;
}

/* Mic stream is active (getUserMedia running) but SpeechRecognition may not be listening */
.voice-btn.capturing {
    background: var(--primary-cyan);
    border-color: var(--primary-cyan);
    color: white;
}

.voice-btn.waiting {
    background: var(--primary-cyan);
    border-color: var(--primary-cyan);
    color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.speaker-btn.active {
    background: #4F5264;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 8px rgba(0, 217, 225, 0.5);
    color: white;
}

.conversation-btn.active {
    background: #4F5264;
    border-color: #10ac84;
    box-shadow: 0 0 8px rgba(16, 172, 132, 0.5);
    color: white;
    animation: conversationPulse 2s infinite;
}

@keyframes conversationPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 172, 132, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(16, 172, 132, 0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 217, 225, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(0, 217, 225, 0);
    }
}

.voice-indicator {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #ff4757;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-indicator.capturing {
    background: #10ac84;
}

.voice-indicator.listening {
    background: #ff4757;
}

.voice-indicator .pulse {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    animation: innerPulse 1s infinite;
}

@keyframes innerPulse {
    0%, 100% {
        transform: scale(0.8);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.5;
    }
}

.input-wrapper {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.voice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f0f0f0;
    border-color: #ccc;
    color: #999;
}

/* Loading indicator */
.message.loading-only {
    background: transparent;
    border: none;
    padding: 0;
    max-width: 70%;
    align-self: flex-start;
}

.loading-indicator {
    display: inline-flex;
    gap: 6px;
    padding: 10px 0;
}

.loading-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary-cyan);
    border-radius: 50%;
    animation: loadingDots 1.4s infinite ease-in-out both;
}

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

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

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .container {
        height: 100vh;
        max-width: 100%;
    }
    
    header {
        padding: var(--spacing-md);
    }
    
    header h1 {
        font-size: 1.25rem;
    }
    
    .subtitle {
        font-size: 0.75rem;
    }
    
    .logo-container {
        width: 45px;
        height: 45px;
    }
    
    .settings-btn {
        width: 32px;
        height: 32px;
    }
    
    .settings-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .messages {
        padding: var(--spacing-md);
    }
    
    .question,
    .answer {
        max-width: 95%;
        padding: var(--spacing-md);
        font-size: 0.9375rem;
    }
    
    .input-container {
        padding: var(--spacing-md);
    }
    
    #questionInput {
        font-size: 1rem;
        padding: 12px var(--spacing-md);
    }
    
    button {
        padding: 12px var(--spacing-lg);
        font-size: 0.9375rem;
    }
    
    .voice-btn, .speaker-btn, .conversation-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
    
    footer {
        padding: var(--spacing-md);
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .question,
    .answer {
        max-width: 97%;
    }
    
    .input-wrapper {
        gap: var(--spacing-sm);
    }
    
    button {
        padding: 12px var(--spacing-md);
        min-width: 60px;
    }
}
