
:root {
    --bg-primary: #0e0f12;
    --bg-secondary: #16181d;
    --text-primary: #eaeaea;
    --text-secondary: #9aa4af;
    --accent: #00ffc8;
    --accent-hover: #00d7aa;
    --border: #262b33;
    --shadow: rgba(0, 0, 0, .45);
    --danger: #ff4d4f;
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: linear-gradient(180deg, #0c0d10, #0e1015 35%, #0b0c10 100%);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
}

.container {
    display: flex;
    height: 100%
}

/* Sidebar */
.sidebar {
    width: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    transition: width .25s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    z-index: 10;
}

.hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sidebar.open {
    width: 280px
}

.sidebar .top {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar .top button {
    width: 100%;
    padding: 10px 12px;
    background: var(--accent);
    color: #041013;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

.sidebar .top button:hover {
    background: var(--accent-hover)
}

.sidebar h3 {
    margin: 12px 16px 6px;
    color: var(--text-secondary);
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
}

#chatList {
    list-style: none;
    margin: 0;
    padding: 0 8px 16px;
    overflow: auto;
    flex: 1;
}

#chatList li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s ease, border-color .2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#chatList li:hover {
    background: #1e222b;
    border-color: #2f3641
}

#chatList li .chat-title {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#chatList li .delete-chat-btn {
    margin-left: 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 5px;
    transition: color 0.2s ease, background 0.2s ease;
}

#chatList li .delete-chat-btn:hover {
    color: var(--danger);
    background: rgba(255, 77, 79, 0.2);
}

.sidebar-actions {
    border-top: 1px solid var(--border);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    /* Stack settings and logout vertically */
    gap: 8px;
}

.sidebar-footer {
    /* Used for individual items within sidebar-actions */
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 0;
    /* Add some padding for click area */
}

.sidebar-footer:hover {
    background: #1c2027;
    border-radius: 8px;
}

/* Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0
}

.header {
    height: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 17, 22, .6);
    backdrop-filter: blur(6px);
}

.menu-btn {
    display: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #12151a;
}

.menu-btn:active {
    transform: scale(.98)
}

.brand {
    flex: 1;
    text-align: center;
    font-weight: 800;
    letter-spacing: .02em
}

.brand span {
    color: var(--accent)
}

.model-selector-float {
    position: fixed;
    bottom: 120px;
    right: 20px;
    z-index: 100;
}

.model-float-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.model-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.model-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.model-popup-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    max-width: min(500px, 90vw);
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.model-popup-content h3 {
    margin: 0 0 15px 0;
    color: var(--accent);
    text-align: center;
}

.current-model {
    text-align: center;
    color: var(--accent);
    margin-bottom: 24px;
    padding: 12px 16px;
    background: rgba(0, 255, 200, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 200, 0.2);
    font-weight: 600;
    font-size: 14px;
}

.model-section {
    margin-bottom: 28px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.section-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.section-header h4 {
    margin: 0 0 4px 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.section-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
    opacity: 0.8;
}

.model-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.model-option {
    background: #1a1f28;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    transition: all 0.2s ease;
    font-weight: 500;
}

.model-option:hover {
    background: #1e222b;
    border-color: var(--accent);
}

.model-option.current {
    background: #0f1419;
    border-color: #2a2f3a;
    color: #6b7280;
    opacity: 0.7;
}

.model-more-btn {
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    width: 100%;
    margin-top: 4px;
}

.model-more-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.user-actions button {
    background: var(--accent);
    color: #041013;
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    font-weight: 800;
    cursor: pointer;
}

.user-actions button:hover {
    background: var(--accent-hover)
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background-size: cover;
    /* Ensure image covers the area */
    background-position: center;
    /* Center the image */
    cursor: pointer;
}

.user-avatar.default {
    background-color: #fff;
    /* Default white avatar */
}

.user-avatar.incognito {
    background-image: url('https://upload.wikimedia.org/wikipedia/commons/e/ee/Incognito_icon.png');
    /* Incognito icon */
}

.ghost-btn {
    background: #151922;
    border: 1px solid var(--border);
    color: var(--text-primary)
}

.ghost-btn:hover {
    border-color: #394354
}

/* User Menu Popup (removed for logout, but kept for future use if needed) */
#userMenu {
    display: none;
    /* This element is now intentionally hidden */
}

/* Chat */
#chat {
    flex: 1;
    overflow: auto;
    padding: 18px 18px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.message {
    max-width: min(82%, 720px);
    padding: 12px 14px;
    border-radius: 16px;
    box-shadow: 0 2px 6px var(--shadow);
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.user {
    align-self: flex-end;
    background: var(--accent);
    color: #041013;
}

.message.ai {
    align-self: flex-start;
    background: #151922;
    border: 1px solid var(--border);
}

.incognito-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9em;
    padding: 10px;
    background: #2a303d;
    border-radius: 8px;
    margin: 10px auto;
    max-width: 90%;
}


.input-area {
    border-top: 1px solid var(--border);
    padding: 10px;
    background: #0e1015;
}

.input-main {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.input-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.image-btn, .generate-btn {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #151922;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.image-btn:hover, .generate-btn:hover {
    border-color: var(--accent);
    background: #1e222b;
}

.image-preview {
    display: none;
    margin-bottom: 8px;
}

.preview-container {
    position: relative;
    display: inline-block;
    max-width: 200px;
}

.preview-container img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-image {
    margin-bottom: 8px;
}

.message-image img {
    max-width: 300px;
    max-height: 200px;
    border-radius: 8px;
    border: 1px solid var(--border);
}



textarea {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #12151a;
    color: var(--text-primary);
    padding: 12px 14px;
    font-size: 15px;
    resize: none;
    min-height: 22px;
    max-height: 160px;
    overflow: auto;
}

.send-btn {
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    background: var(--accent);
    color: #041013;
    font-weight: 900;
    cursor: pointer;
}

.send-btn:hover {
    background: var(--accent-hover)
}

/* Overlay for sidebar on mobile */
#overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    display: none;
    z-index: 6;
}

/* Auth Popup */
#authPopup,
#messagePopup {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .6);
    z-index: 20;
}

.popup-content {
    width: 320px;
    background: #12151a;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .6);
    padding: 18px 16px 16px;
    position: relative;
    animation: pop .15s ease;
}

@keyframes pop {
    from {
        transform: scale(.98);
        opacity: .7
    }

    to {
        transform: scale(1);
        opacity: 1
    }
}

.popup-title {
    margin: 8px 0 12px;
    text-align: center;
    font-weight: 800;
    color: var(--accent)
}

.close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 6px;
    cursor: pointer;
}

.auth-row {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.auth-input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #0f131a;
    color: var(--text-primary)
}

.action-btn {
    width: 100%;
    padding: 11px 12px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #041013;
    font-weight: 900;
    cursor: pointer;
    margin-top: 6px;
}

#googleBtn {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    background: #fff;
    color: #111;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

#googleBtn img {
    width: 18px;
    height: 18px
}

/* Payment page */
.payment-box {
    background-color: #1e293b;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    max-width: 500px;
    width: 100%;
    border: 1px solid #334155;
}

.payment-box h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #60a5fa;
    margin-bottom: 2rem;
    text-align: center;
}

.option {
    background-color: #334155;
    padding: 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
}

.option:hover {
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(96, 165, 250, 0.3);
}

.option-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.option-header input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    background-color: #4b5563;
    margin: 0;
    font: inherit;
    color: currentColor;
    width: 1.15em;
    height: 1.15em;
    border: 0.15em solid currentColor;
    border-radius: 50%;
    transform: translateY(-0.075em);
    display: grid;
    place-content: center;
}

.option-header input[type="radio"]::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    border-radius: 50%;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em #60a5fa;
}

.option-header input[type="radio"]:checked::before {
    transform: scale(1);
}

.option-header .head {
    font-size: 1.25rem;
    font-weight: 600;
    color: #93c5fd;
}

.option-content {
    margin-top: 1.25rem;
    padding-left: 2.25rem;
}

.option-content.hidden {
    display: none;
}

.option-content label {
    color: #d1d5db;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    display: block;
}

.option-content input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
    background-color: #1e293b;
    color: #f8fafc;
    border: 1px solid #4b5563;
}

.option-content input:focus {
    outline: none;
    border-color: #60a5fa;
}

.option-content button {
    width: 100%;
    background-color: #2563eb;
    color: #ffffff;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.3s;
}

.option-content button:hover {
    background-color: #1d4ed8;
}

.qr-box {
    margin-top: 1.5rem;
    text-align: center;
}

.qr-box p {
    color: #d1d5db;
    margin-bottom: 0.75rem;
}

.qr-box img {
    width: 9rem;
    height: 9rem;
    background-color: #ffffff;
    padding: 0.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin: 0 auto;
    border: 1px solid #9ca3af;
}

/* Plans page */
.plans-container {
    max-width: 1000px;
    padding: 40px 20px;
    width: 100%;
}

.plans-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #38bdf8;
}

.plans {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.plan {
    flex: 1 1 300px;
    background: #1e293b;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.plan h2 {
    margin: 0 0 10px;
    color: #facc15;
    font-size: 22px;
}

.price {
    font-size: 26px;
    font-weight: bold;
    margin: 10px 0 15px;
}

.features {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    text-align: left;
    font-size: 15px;
}

.features li {
    margin: 8px 0;
    padding-left: 20px;
    position: relative;
}

.features li::before {
    content: "✔";
    position: absolute;
    left: 0;
    color: #38bdf8;
    font-weight: bold;
}

.plan button {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    background: #38bdf8;
    color: #0f172a;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: auto;
}

.plan button:hover {
    background: #0ea5e9;
}

/* Code Container Styling */
.code-container {
    margin: 12px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #1e1e1e;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #2d2d30;
    border-bottom: 1px solid #3e3e42;
    font-size: 12px;
}

.language-label {
    color: #cccccc;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.copy-btn {
    background: #0e639c;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #1177bb;
}

.message-text {
    margin: 8px 0;
    line-height: 1.6;
}

/* Enhanced AI Response Styling */
.ai-response {
    font-family: 'Inter', system-ui, sans-serif;
}

.ai-response h1, .ai-response h2, .ai-response h3, .ai-response h4 {
    color: var(--accent);
    margin: 16px 0 8px 0;
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 255, 200, 0.2);
    padding-bottom: 4px;
}

.ai-response h1 { font-size: 1.4em; }
.ai-response h2 { font-size: 1.2em; }
.ai-response h3 { font-size: 1.1em; }
.ai-response h4 { font-size: 1em; }

.ai-response ul, .ai-response ol {
    margin: 12px 0;
    padding-left: 20px;
}

.ai-response li {
    margin: 6px 0;
    line-height: 1.5;
}

.ai-response ul li::marker {
    color: var(--accent);
}

.ai-response ol li::marker {
    color: var(--accent);
    font-weight: 600;
}

.ai-response blockquote {
    border-left: 3px solid var(--accent);
    margin: 12px 0;
    padding: 8px 16px;
    background: rgba(0, 255, 200, 0.05);
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

.ai-response strong {
    color: #ffffff;
    font-weight: 600;
}

.ai-response em {
    color: var(--accent);
    font-style: italic;
}

.ai-response p {
    margin: 10px 0;
    line-height: 1.6;
}

/* Inline code styling */
.ai-response code:not(pre code) {
    background: #2a2d3a;
    color: #ffd700;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    border: 1px solid #3a3d4a;
}

/* Special content type indicators */
.content-type-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.content-type-python {
    background: linear-gradient(135deg, #3776ab, #ffd43b);
    color: #000;
}

.content-type-javascript {
    background: linear-gradient(135deg, #f7df1e, #000);
    color: #000;
}

.content-type-explanation {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.content-type-solution {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    color: #000;
}

.content-type-error {
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
    color: #fff;
}

.content-type-tip {
    background: linear-gradient(135deg, #ffecd2, #fcb69f);
    color: #000;
}

/* Step-by-step styling */
.step-container {
    margin: 16px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--accent);
    color: #000;
    border-radius: 50%;
    font-weight: 700;
    font-size: 12px;
    margin-right: 8px;
}

/* Warning and info boxes */
.info-box {
    margin: 12px 0;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid;
}

.info-box.warning {
    background: rgba(255, 193, 7, 0.1);
    border-color: #ffc107;
    color: #fff3cd;
}

.info-box.error {
    background: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
    color: #f8d7da;
}

.info-box.success {
    background: rgba(40, 167, 69, 0.1);
    border-color: #28a745;
    color: #d4edda;
}

.info-box.info {
    background: rgba(23, 162, 184, 0.1);
    border-color: #17a2b8;
    color: #bee5eb;
}

/* Table styling */
.ai-response table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    overflow: hidden;
}

.ai-response th, .ai-response td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.ai-response th {
    background: rgba(0, 255, 200, 0.1);
    color: var(--accent);
    font-weight: 600;
}

.ai-response tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Links styling */
.ai-response a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dotted var(--accent);
    transition: all 0.2s ease;
}

.ai-response a:hover {
    color: var(--accent-hover);
    border-bottom-style: solid;
}

/* Math/Formula styling */
.formula {
    background: #1a1d29;
    border: 1px solid #2a2d3a;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 8px 0;
    font-family: 'Times New Roman', serif;
    text-align: center;
    color: #e6e6e6;
}

/* Keyboard shortcuts */
.kbd {
    display: inline-block;
    padding: 2px 6px;
    background: #2a2d3a;
    border: 1px solid #3a3d4a;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85em;
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* VSCode Dark Theme Syntax Highlighting */
pre {
    margin: 0;
    background: #1e1e1e !important;
    overflow-x: auto;
}

pre code {
    display: block;
    padding: 16px;
    background: #1e1e1e !important;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
    overflow-x: auto;
}

/* Base colors */
.hljs {
    color: #d4d4d4;
    background: #1e1e1e;
}

/* Comments */
.hljs-comment,
.hljs-quote {
    color: #6a9955;
    font-style: italic;
}

/* Keywords */
.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-section,
.hljs-link {
    color: #569cd6;
}

/* Strings */
.hljs-string,
.hljs-subst {
    color: #ce9178;
}

/* Numbers */
.hljs-number,
.hljs-regexp,
.hljs-addition {
    color: #b5cea8;
}

/* Functions */
.hljs-function .hljs-title,
.hljs-title.function_,
.hljs-built_in {
    color: #dcdcaa;
}

/* Variables and attributes */
.hljs-variable,
.hljs-template-variable,
.hljs-attr,
.hljs-attribute {
    color: #9cdcfe;
}

/* Types and classes */
.hljs-type,
.hljs-class .hljs-title,
.hljs-title.class_ {
    color: #4ec9b0;
}

/* Operators and punctuation */
.hljs-operator,
.hljs-punctuation {
    color: #d4d4d4;
}

/* Meta and preprocessor */
.hljs-meta,
.hljs-meta .hljs-keyword {
    color: #569cd6;
}

.hljs-meta .hljs-string {
    color: #ce9178;
}

/* Deletion */
.hljs-deletion {
    color: #f44747;
}

/* Language-specific colors */

/* JavaScript/TypeScript */
.language-javascript .hljs-title.function_,
.language-typescript .hljs-title.function_,
.language-js .hljs-title.function_,
.language-ts .hljs-title.function_ {
    color: #dcdcaa;
}

.language-javascript .hljs-variable.language_,
.language-typescript .hljs-variable.language_,
.language-js .hljs-variable.language_,
.language-ts .hljs-variable.language_ {
    color: #569cd6;
}

/* Python */
.language-python .hljs-built_in {
    color: #569cd6;
}

.language-python .hljs-decorator,
.language-python .hljs-meta {
    color: #dcdcaa;
}

/* Java */
.language-java .hljs-annotation {
    color: #dcdcaa;
}

.language-java .hljs-class .hljs-title {
    color: #4ec9b0;
}

/* C/C++ */
.language-c .hljs-meta .hljs-string,
.language-cpp .hljs-meta .hljs-string {
    color: #ce9178;
}

/* CSS */
.language-css .hljs-selector-class,
.language-css .hljs-selector-id {
    color: #d7ba7d;
}

.language-css .hljs-property {
    color: #9cdcfe;
}

.language-css .hljs-value,
.language-css .hljs-number {
    color: #ce9178;
}

/* HTML */
.language-html .hljs-tag {
    color: #808080;
}

.language-html .hljs-name {
    color: #569cd6;
}

.language-html .hljs-attr {
    color: #9cdcfe;
}

/* SQL */
.language-sql .hljs-keyword {
    color: #569cd6;
}

.language-sql .hljs-built_in {
    color: #4ec9b0;
}

/* JSON */
.language-json .hljs-attr {
    color: #9cdcfe;
}

.language-json .hljs-string {
    color: #ce9178;
}

/* Markdown */
.language-markdown .hljs-section {
    color: #569cd6;
    font-weight: bold;
}

.language-markdown .hljs-emphasis {
    color: #d4d4d4;
    font-style: italic;
}

.language-markdown .hljs-strong {
    color: #d4d4d4;
    font-weight: bold;
}

.language-markdown .hljs-code {
    color: #ce9178;
}

/* Bash/Shell */
.language-bash .hljs-built_in,
.language-shell .hljs-built_in {
    color: #dcdcaa;
}

.language-bash .hljs-variable,
.language-shell .hljs-variable {
    color: #9cdcfe;
}


/* Mobile Responsive Styles */
@media (max-width: 820px) {
    .menu-btn {
        display: inline-block;
    }

    .brand {
        font-size: 16px;
    }

    .model-selector-float {
        bottom: 100px;
        right: 15px;
    }
    
    .model-float-btn {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .model-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .sidebar.open {
        width: min(88vw, 300px);
    }

    .message {
        max-width: 92%;
    }

    .header {
        padding: 0 12px;
    }

    .user-actions {
        gap: 8px;
    }

    .user-actions button {
        padding: 6px 10px;
        font-size: 14px;
    }

    .code-header {
        padding: 6px 10px;
        font-size: 11px;
    }

    .copy-btn {
        padding: 3px 6px;
        font-size: 10px;
    }

    pre code {
        font-size: 13px;
        padding: 12px;
    }
}

@media (max-width: 768px) {
    .plans {
        flex-direction: column;
        align-items: center;
    }

    .container {
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile */
    }

    .header {
        height: 50px;
        padding: 0 10px;
    }

    .brand {
        font-size: 15px;
    }

    .model-selector-float {
        bottom: 90px;
        right: 10px;
    }
    
    .model-float-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .model-grid {
        grid-template-columns: 1fr;
    }
    
    .model-popup-content {
        max-width: 95vw;
        padding: 20px;
    }
    
    .model-section {
        padding: 12px;
        margin-bottom: 20px;
    }
    
    .section-header h4 {
        font-size: 15px;
    }

    #chat {
        padding: 12px;
        gap: 12px;
    }

    .message {
        max-width: 95%;
        padding: 10px 12px;
        font-size: 15px;
    }

    .input-area {
        padding: 8px;
        gap: 6px;
    }
    
    .input-controls {
        gap: 6px;
    }
    
    .image-btn, .generate-btn {
        padding: 6px 10px;
        font-size: 14px;
    }

    textarea {
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 10px;
    }

    .send-btn {
        padding: 10px 14px;
        border-radius: 10px;
        font-size: 14px;
    }

    .popup-content {
        width: 90%;
        max-width: 320px;
        margin: 0 20px;
    }

    .code-container {
        margin: 8px 0;
    }

    .language-label {
        font-size: 11px;
    }

    pre code {
        font-size: 12px;
        padding: 10px;
        line-height: 1.3;
    }
}

@media (max-width: 480px) {
    .header {
        height: 45px;
        padding: 0 8px;
    }

    .brand {
        font-size: 14px;
    }

    .model-selector-float {
        bottom: 80px;
        right: 8px;
    }
    
    .model-float-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .model-option {
        padding: 14px 16px;
        font-size: 14px;
    }
    
    .model-section {
        padding: 10px;
    }

    .menu-btn {
        font-size: 18px;
        padding: 6px 8px;
    }

    #chat {
        padding: 8px;
        gap: 10px;
    }

    .message {
        padding: 8px 10px;
        font-size: 14px;
        border-radius: 12px;
    }

    .input-area {
        padding: 6px;
    }
    
    .preview-container {
        max-width: 150px;
    }
    
    .preview-container img {
        max-height: 100px;
    }
    
    .message-image img {
        max-width: 250px;
        max-height: 150px;
    }

    textarea {
        padding: 8px 10px;
        min-height: 20px;
        max-height: 120px;
    }

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

    .sidebar.open {
        width: min(92vw, 280px);
    }

    .sidebar .top {
        padding: 12px;
    }

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

    #chatList li {
        padding: 8px 10px;
        margin: 4px 6px;
        font-size: 14px;
    }

    .code-header {
        padding: 4px 8px;
        font-size: 10px;
    }

    .copy-btn {
        padding: 2px 4px;
        font-size: 9px;
    }

    pre code {
        font-size: 11px;
        padding: 8px;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        height: 40px;
    }

    #chat {
        padding: 6px;
    }

    .input-area {
        padding: 4px;
    }

    textarea {
        max-height: 80px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .copy-btn,
    .send-btn,
    .menu-btn,
    .sidebar .top button {
        min-height: 44px; /* iOS recommended touch target */
    }

    #chatList li {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .user-actions button {
        min-height: 40px;
    }
}
