/* AI Chatbot Styles - Full Screen Layout */
:root {
    --bg-primary: #0a0a12;
    --bg-secondary: #12121f;
    --bg-card: #1a1a2e;
    --bg-hover: #242442;
    --bg-user: #4f8cff;
    --bg-assistant: #1e1e32;
    --text-primary: #ffffff;
    --text-secondary: #8892b0;
    --accent-blue: #4f8cff;
    --accent-green: #00d26a;
    --accent-purple: #a855f7;
    --border-color: #2a2a45;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --radius: 16px;
    --radius-sm: 10px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Full Screen App Container */
.app-container {
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100vh;
    width: 100%;
}

/* Header - Full Width */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    font-weight: 500;
}

.back-button:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo i {
    font-size: 32px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.model-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.model-badge i {
    color: var(--accent-green);
    font-size: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
}

/* Chat Container - Full Width */
.chat-container {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

/* Messages Area */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    padding-bottom: 100px; /* Space for floating input */
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Welcome Message - Centered Full Width */
.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 40px;
    max-width: 900px;
    margin: auto;
    width: 100%;
}

.welcome-icon {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    border-radius: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
    font-size: 52px;
    color: white;
    box-shadow: 0 20px 60px rgba(79, 140, 255, 0.3);
}

.welcome-message h2 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -1px;
}

.welcome-message > p {
    color: var(--text-secondary);
    margin-bottom: 48px;
    font-size: 18px;
    line-height: 1.7;
    max-width: 600px;
}

.suggestions {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 800px;
}

.suggestion-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.suggestion-btn:hover {
    background: var(--bg-card);
    border-color: var(--accent-blue);
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(79, 140, 255, 0.2);
}

.suggestion-btn i {
    font-size: 28px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.15), rgba(168, 85, 247, 0.15));
    border-radius: 14px;
    color: var(--accent-blue);
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 16px;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    animation: fadeIn 0.3s ease;
}

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

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

.message-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.message.user .message-avatar {
    background: var(--accent-blue);
    color: white;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    color: white;
}

.message-content {
    flex: 1;
    padding: 18px 24px;
    border-radius: var(--radius);
    line-height: 1.7;
    font-size: 15px;
}

.message.user .message-content {
    background: var(--accent-blue);
    color: white;
    border-bottom-right-radius: 6px;
}

.message.assistant .message-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 6px;
}

.message-content pre {
    background: var(--bg-primary);
    padding: 18px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 14px 0;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    border: 1px solid var(--border-color);
}

.message-content code {
    background: var(--bg-primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
}

.message-content pre code {
    background: none;
    padding: 0;
}

/* Markdown Content Styles */
.markdown-content {
    line-height: 1.7;
}

.markdown-content.streaming {
    display: inline;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin: 1.2em 0 0.6em 0;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child {
    margin-top: 0;
}

.markdown-content h1 { font-size: 1.5em; }
.markdown-content h2 { font-size: 1.35em; }
.markdown-content h3 { font-size: 1.2em; }
.markdown-content h4 { font-size: 1.1em; }
.markdown-content h5 { font-size: 1em; }
.markdown-content h6 { font-size: 0.9em; color: var(--text-secondary); }

.markdown-content p {
    margin: 0.8em 0;
}

.markdown-content p:first-child {
    margin-top: 0;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

.markdown-content ul,
.markdown-content ol {
    margin: 0.8em 0;
    padding-left: 1.5em;
}

.markdown-content li {
    margin: 0.4em 0;
}

.markdown-content li > ul,
.markdown-content li > ol {
    margin: 0.3em 0;
}

.markdown-content blockquote {
    margin: 1em 0;
    padding: 0.8em 1em;
    border-left: 4px solid var(--accent-blue);
    background: rgba(79, 140, 255, 0.1);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}

.markdown-content blockquote p {
    margin: 0;
}

.markdown-content a {
    color: var(--accent-blue);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.markdown-content a:hover {
    border-bottom-color: var(--accent-blue);
}

.markdown-content hr {
    border: none;
    height: 1px;
    background: var(--border-color);
    margin: 1.5em 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.9em;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid var(--border-color);
    padding: 0.6em 0.8em;
    text-align: left;
}

.markdown-content th {
    background: var(--bg-card);
    font-weight: 600;
}

.markdown-content tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 0.8em 0;
}

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

.markdown-content em {
    font-style: italic;
}

.markdown-content del {
    text-decoration: line-through;
    opacity: 0.7;
}

/* Code block with language label */
.markdown-content pre {
    position: relative;
    background: var(--bg-primary);
    padding: 18px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 14px 0;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    border: 1px solid var(--border-color);
}

.markdown-content pre code {
    background: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

/* Inline code in markdown */
.markdown-content code {
    background: var(--bg-primary);
    padding: 0.2em 0.5em;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 10px 0;
}

.typing-indicator span {
    width: 10px;
    height: 10px;
    background: var(--accent-blue);
    border-radius: 50%;
    animation: typing 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 typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Streaming Text and Cursor */
.streaming-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.streaming-cursor {
    display: inline-block;
    width: 3px;
    height: 1.2em;
    background: var(--accent-blue);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursor-blink 0.6s infinite;
    border-radius: 1px;
}

@keyframes cursor-blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

/* Input Area - Floating Style */
.input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 24px 24px;
    background: transparent;
    z-index: 10;
}

.input-wrapper {
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 12px;
    transition: all 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.1);
}

#messageInput {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    line-height: 1.5;
    padding: 6px 4px;
}

#messageInput:focus {
    outline: none;
}

#messageInput::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(79, 140, 255, 0.4);
}

.send-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.input-hint {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 14px;
}

/* Voice Button in Input */
.voice-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.voice-btn:hover {
    background: var(--bg-card);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.voice-btn.listening {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
    animation: voice-pulse-bg 1.5s infinite;
}

.voice-btn .voice-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.3);
    opacity: 0;
    transform: scale(1);
    pointer-events: none;
}

.voice-btn.listening .voice-pulse {
    animation: voice-pulse 1.5s infinite;
}

@keyframes voice-pulse {
    0% {
        opacity: 0.6;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.8);
    }
}

@keyframes voice-pulse-bg {
    0%, 100% {
        background: rgba(239, 68, 68, 0.15);
    }
    50% {
        background: rgba(239, 68, 68, 0.25);
    }
}

.voice-btn.not-supported {
    display: none;
}

/* Voice Settings Button */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-blue);
}

/* Voice Settings Modal */
.voice-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.voice-settings-modal.open {
    opacity: 1;
    visibility: visible;
}

.voice-settings-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
}

.voice-settings-modal.open .voice-settings-content {
    transform: translateY(0) scale(1);
}

.voice-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.voice-settings-header h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.voice-settings-header h3 i {
    color: var(--accent-blue);
}

.close-voice-settings {
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-voice-settings:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.voice-settings-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.voice-setting-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.voice-setting-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.voice-setting-label i {
    width: 20px;
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    transition: all 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 2px;
    top: 2px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.toggle-switch input:checked + .toggle-slider::before {
    background: white;
    transform: translateX(22px);
}

/* Speed Control */
.speed-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.speed-control input[type="range"] {
    width: 120px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-card);
    border-radius: 3px;
    outline: none;
}

.speed-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-blue);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.speed-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.speed-value {
    min-width: 36px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-blue);
}

/* Voice Select */
.voice-select {
    flex: 1;
    max-width: 180px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.voice-select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.voice-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Voice Info */
.voice-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: rgba(79, 140, 255, 0.1);
    border: 1px solid rgba(79, 140, 255, 0.2);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.voice-info i {
    color: var(--accent-blue);
    margin-top: 2px;
}

/* Voice Status Indicator */
.voice-status {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    visibility: hidden;
    z-index: 100;
    transition: all 0.3s ease;
}

.voice-status.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.voice-status-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid #ef4444;
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.3);
}

.voice-waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
}

.voice-waveform span {
    width: 4px;
    height: 8px;
    background: #ef4444;
    border-radius: 2px;
    animation: waveform 0.8s infinite ease-in-out;
}

.voice-waveform span:nth-child(1) { animation-delay: 0s; }
.voice-waveform span:nth-child(2) { animation-delay: 0.1s; }
.voice-waveform span:nth-child(3) { animation-delay: 0.2s; }
.voice-waveform span:nth-child(4) { animation-delay: 0.3s; }
.voice-waveform span:nth-child(5) { animation-delay: 0.4s; }

@keyframes waveform {
    0%, 100% {
        height: 8px;
    }
    50% {
        height: 24px;
    }
}

.voice-status-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.voice-cancel-btn {
    width: 32px;
    height: 32px;
    background: rgba(239, 68, 68, 0.2);
    border: none;
    border-radius: 50%;
    color: #ef4444;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-cancel-btn:hover {
    background: #ef4444;
    color: white;
}

/* Speak Button on Messages */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-actions,
.message-actions.speaking {
    opacity: 1;
}

.speak-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.speak-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-blue);
}

.speak-btn.speaking {
    background: rgba(79, 140, 255, 0.2);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.speak-btn.speaking i {
    animation: pulse-icon 1s infinite;
}

@keyframes pulse-icon {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Hint for mobile/desktop */
.hint-mobile {
    display: none;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Tablet */
@media (max-width: 1024px) {
    .header {
        padding: 14px 24px;
    }

    .messages-area {
        padding: 24px;
        padding-bottom: 90px; /* Space for floating input on tablet */
    }

    .input-area {
        padding: 14px 20px 20px;
    }

    .welcome-message {
        padding: 40px 24px;
    }

    .welcome-message h2 {
        font-size: 32px;
    }

    .suggestions {
        flex-direction: column;
        max-width: 500px;
    }

    .suggestion-btn {
        flex-direction: row;
        text-align: left;
        padding: 20px 24px;
    }

    .suggestion-btn i {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
}

/* Mobile - ChatGPT-like UI */
@media (max-width: 600px) {
    /* === PREVENT ALL HORIZONTAL OVERFLOW === */
    *, *::before, *::after {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Lock body scroll - only messages area should scroll */
    html, body {
        height: 100%;
        width: 100%;
        overflow: hidden;
        position: fixed;
        overscroll-behavior: none;
    }

    /* App container - full viewport */
    .app-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100vh;
        height: 100dvh;
        width: 100vw;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    /* === HEADER - Fixed at top === */
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        padding: 0 12px;
        z-index: 100;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .header-left {
        gap: 12px;
    }

    .logo {
        gap: 10px;
    }

    .logo h1 {
        font-size: 18px;
    }

    .logo i {
        font-size: 22px;
    }

    .back-button {
        padding: 8px 10px;
        font-size: 14px;
    }

    .back-button span {
        display: none;
    }

    .model-badge {
        display: none;
    }

    .header-right {
        gap: 8px;
    }

    .btn-icon {
        width: 36px;
        height: 36px;
        padding: 0;
    }

    .btn.btn-secondary {
        padding: 8px 12px;
        font-size: 13px;
    }

    .btn.btn-secondary span:not(.fa, .fas, .far) {
        display: none;
    }

    /* === CHAT CONTAINER === */
    .chat-container {
        position: fixed;
        top: 56px; /* Below header */
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        background: var(--bg-primary);
    }

    /* === MESSAGES AREA - Only this scrolls === */
    .messages-area {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 16px 12px;
        padding-bottom: 8px;
        gap: 20px;
        display: flex;
        flex-direction: column;
    }

    /* === MESSAGE BUBBLES - ChatGPT Style === */
    .message {
        display: flex;
        gap: 10px;
        max-width: 100%;
        width: 100%;
        margin: 0;
    }

    /* Hide avatars on mobile for cleaner look */
    .message-avatar {
        display: none;
    }

    /* Message content - full width */
    .message-content {
        flex: 1;
        max-width: 100%;
        min-width: 0; /* Critical for flex overflow */
        padding: 12px 14px;
        font-size: 15px;
        line-height: 1.6;
        border-radius: 16px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
    }

    /* User messages - right aligned bubble */
    .message.user {
        justify-content: flex-end;
    }

    .message.user .message-content {
        max-width: 85%;
        background: var(--accent-blue);
        color: white;
        border-bottom-right-radius: 4px;
    }

    /* Assistant messages - full width, subtle background */
    .message.assistant .message-content {
        background: var(--bg-secondary);
        border: none;
        border-bottom-left-radius: 4px;
    }

    /* === CODE BLOCKS - Horizontal scroll within === */
    .message-content pre,
    .markdown-content pre {
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 12px;
        margin: 10px 0;
        font-size: 13px;
        border-radius: 8px;
        background: var(--bg-primary);
        border: 1px solid var(--border-color);
    }

    .message-content pre code,
    .markdown-content pre code {
        white-space: pre;
        word-break: normal;
        overflow-wrap: normal;
    }

    /* Inline code */
    .message-content code,
    .markdown-content code {
        font-size: 13px;
        padding: 2px 6px;
        word-break: break-all;
    }

    /* === MARKDOWN CONTENT === */
    .markdown-content {
        max-width: 100%;
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .markdown-content p {
        margin: 0.6em 0;
    }

    .markdown-content ul,
    .markdown-content ol {
        padding-left: 1.2em;
        margin: 0.6em 0;
    }

    .markdown-content li {
        margin: 0.3em 0;
    }

    .markdown-content table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 13px;
    }

    .markdown-content h1 { font-size: 1.3em; }
    .markdown-content h2 { font-size: 1.2em; }
    .markdown-content h3 { font-size: 1.1em; }

    /* === WELCOME SCREEN === */
    .welcome-message {
        padding: 24px 16px;
        margin: auto;
    }

    .welcome-icon {
        width: 64px;
        height: 64px;
        font-size: 28px;
        border-radius: 16px;
        margin-bottom: 16px;
    }

    .welcome-message h2 {
        font-size: 22px;
        margin-bottom: 8px;
    }

    .welcome-message > p {
        font-size: 14px;
        margin-bottom: 24px;
        color: var(--text-secondary);
    }

    .suggestions {
        gap: 10px;
        width: 100%;
    }

    .suggestion-btn {
        padding: 12px 14px;
        gap: 10px;
        font-size: 13px;
        border-radius: 12px;
    }

    .suggestion-btn i {
        width: 36px;
        height: 36px;
        font-size: 16px;
        border-radius: 8px;
    }

    /* === INPUT AREA - Fixed at bottom === */
    .input-area {
        flex-shrink: 0;
        position: relative;
        padding: 10px 12px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        background: var(--bg-primary);
        border-top: 1px solid var(--border-color);
    }

    .input-wrapper {
        padding: 6px 8px;
        gap: 8px;
        border-radius: 24px;
        max-width: 100%;
    }

    .voice-btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
        flex-shrink: 0;
    }

    #messageInput {
        font-size: 16px;
        min-height: 24px;
        max-height: 100px;
        padding: 4px 8px;
    }

    .send-btn {
        width: 34px;
        height: 34px;
        font-size: 14px;
        flex-shrink: 0;
    }

    .input-hint {
        display: none;
    }

    /* === VOICE SETTINGS MODAL === */
    .voice-settings-modal {
        padding: 10px;
    }

    .voice-settings-content {
        width: 100%;
        max-width: none;
        max-height: 80vh;
        margin: 0;
        border-radius: 16px;
    }

    .voice-settings-header {
        padding: 14px 16px;
    }

    .voice-settings-header h3 {
        font-size: 16px;
    }

    .voice-settings-body {
        padding: 16px;
        gap: 16px;
        overflow-y: auto;
    }

    .voice-setting-group {
        flex-wrap: wrap;
    }

    .voice-select {
        max-width: none;
        width: 100%;
        margin-top: 8px;
    }

    .speed-control {
        width: 100%;
        margin-top: 8px;
    }

    .speed-control input[type="range"] {
        flex: 1;
    }

    /* === VOICE STATUS === */
    .voice-status {
        bottom: 80px;
        left: 12px;
        right: 12px;
        transform: translateX(0) translateY(20px);
    }

    .voice-status.active {
        transform: translateX(0) translateY(0);
    }

    .voice-status-content {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
    }

    /* === TYPING INDICATOR === */
    .typing-indicator {
        padding: 8px 0;
    }

    .typing-indicator span {
        width: 8px;
        height: 8px;
    }

    /* === MISC === */
    .message-actions {
        opacity: 1;
        margin-top: 8px;
    }

    .speak-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Hide scrollbar but keep functionality */
    .messages-area::-webkit-scrollbar {
        width: 0;
        height: 0;
    }
}
