/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Font definitions */
@font-face {
    font-family: 'Petrona';
    src: url('../fonts/Petrona/Petrona-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Petrona';
    src: url('../fonts/Petrona/Petrona-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Fira Mono';
    src: url('../fonts/Fira_Mono/FiraMono-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Fira Mono';
    src: url('../fonts/Fira_Mono/FiraMono-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Fira Mono';
    src: url('../fonts/Fira_Mono/FiraMono-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    color: #333;
    height: 100vh;
    overflow: hidden;
    margin: 0;
}

#app {
    height: 100vh;
}

.app-container {
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "header right-panel"
        "left-panel right-panel";
}

.app-container.sidebar-hidden {
    grid-template-columns: 1fr;
    grid-template-areas:
        "header"
        "right-panel";
}

.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    padding: 0.5rem;
    gap: 0.5rem;
    z-index: 1000;
    pointer-events: none; /* allow clicks through empty space */
}

.notification-item {
    pointer-events: auto;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 600px;
    opacity: 1;
}

.notification-item.fading {
    animation: fadeOut 10s linear forwards;
}

.notification-item.no-transition {
    animation: none;
}

.notification-item.hidden {
    display: none;
}

.notification-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.notification-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.notification-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.notification-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0; /* allows text to shrink */
}

.notification-content span {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.notification-dismiss {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.7;
    padding: 0.25rem;
    flex-shrink: 0;
}

.notification-dismiss:hover {
    opacity: 1;
}

.notification-action-button {
    margin-left: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255,255,255,0.3);
    border: 1px solid currentColor;
    border-radius: 4px;
    color: inherit;
    cursor: pointer;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.notification-list {
    display: contents;
}

/* Header */
.header {
    background: linear-gradient(135deg, #202123 0%, #2d2d2d 100%);
    color: white;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    grid-area: header;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    overflow: hidden;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    flex: 1;
    max-width: 100%;
    width: 100%;
    font-family: 'Petrona', Georgia, 'Times New Roman', Times, serif;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sidebar-toggle {
    display: block;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    width: 3rem;
    height: 3rem;
    border-radius: 4px;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Main content layout */
.main-content {
    display: contents;
}

/* Left panel (sidebar + settings) */
.left-panel {
    width: 300px;
    background: #ffffff;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    grid-area: left-panel;
    min-width: 300px;
    max-width: 60vw;
}

.left-panel.hidden {
    display: none;
}

/* Right panel (chat messages + input) */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    grid-area: right-panel;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
}

.sidebar-header {
    padding: 0.75rem;
    flex-shrink: 0;
    border-bottom: 1px solid #e9ecef;
}

.chat-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.5rem 1rem;
}

.chat-list > h3 {
    padding-bottom: 1rem;
    font-family: 'Petrona', Georgia, 'Times New Roman', Times, serif;
}

.sidebar-footer {
    padding: 0.75rem;
    flex-shrink: 0;
    border-top: 1px solid #e9ecef;
}

.sidebar-footer button {
    width: 100%;
    padding: 0.5rem;
}

.sidebar-header h3 {
    margin-bottom: 1rem;
    color: #555;
    font-family: 'Petrona', Georgia, 'Times New Roman', Times, serif;
}

.sidebar-header button {
    width: 100%;
    padding: 0.5rem;
}

.chat-item {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.chat-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.chat-item.active {
    border-color: #10a37f;
    background: #e8f7f2;
    box-shadow: 0 4px 8px rgba(16, 163, 127, 0.2);
}

.chat-item-content {
    padding: 0.5rem;
}

.chat-name {
    font-weight: 500;
    font-size: 0.9rem;
    font-family: 'Petrona', Georgia, 'Times New Roman', Times, serif;
}

.chat-name-edit {
    font-weight: 500;
    font-family: inherit;
    font-size: inherit;
    border: 1px solid #10a37f;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    background: white;
    width: calc(100% - 1rem);
    box-sizing: border-box;
}

.chat-meta {
    font-size: 0.8rem;
    color: #777;
}

.chat-actions {
    display: flex;
    border-top: 1px solid #eee;
    background: #f9f9f9;
}

.chat-actions button {
    flex: 1;
    padding: 0.25rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: #666;
}

.chat-actions button:hover {
    background: #eee;
    color: #333;
}

.chat-settings-panel {
    padding: 1em;
}

/* Settings panel */
.settings-panel {
    padding: 1rem;
    border-top: 1px solid #ddd;
    background: #f9f9f9;
    overflow-y: auto;
    max-height: 50vh;
    flex-shrink: 0;
}

.chat-settings-panel {
    padding: 1rem;
    border-top: 1px solid #ddd;
    background: #f9f9f9;
    overflow-y: auto;
    max-height: 50vh;
    flex-shrink: 0;
}

.settings-panel h2 {
    margin-bottom: 1rem;
    color: #555;
    font-family: 'Petrona', Georgia, 'Times New Roman', Times, serif;
}

.settings-panel h3 {
    margin-bottom: 1rem;
    color: #555;
    font-family: 'Petrona', Georgia, 'Times New Roman', Times, serif;
}

.setting {
    margin-bottom: 1rem;
}

.setting label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #555;
}

.setting input[type="text"],
.setting input[type="password"],
.setting textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
}

.api-key-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.api-key-container input {
    flex: 1;
}
.api-key-toggle {
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f5f5f5;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s;
}
.api-key-toggle:hover {
    background: #e5e5e5;
}

.setting input[type="range"] {
    width: 100%;
    margin-top: 0.5rem;
}

.setting span {
    display: inline-block;
    margin-left: 0.5rem;
    font-weight: 500;
    color: #10a37f;
}

/* Messages area */
.messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.5rem;
    background: #ffffff;
    height: 100%;
}

.no-chat,
.no-messages {
    color: #888;
    text-align: center;
    padding: 2rem;
    font-style: italic;
}

.message {
    margin-bottom: 1.5rem;
    max-width: 800px;
}

.message.user {
    margin-left: auto;
}

.message.assistant {
    margin-right: auto;
}

.message.thinking {
    opacity: 0.7;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: #666;
}

.message-role {
    font-weight: 600;
    text-transform: capitalize;
}

.message-time {
    color: #999;
}

.message-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.message-actions button {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f8f9fa;
    color: #555;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.message-actions button:hover {
    opacity: 1;
    background: #e9ecef;
}

.message.editing .message-content,
.edit-content,
.edit-thinking {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #10a37f;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
}

.edit-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.edit-actions button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
}

.edit-actions button:first-child {
    background: #10a37f;
    color: white;
}

.edit-actions button:last-child {
    background: #f0f0f0;
    color: #555;
}

.message-content {
    padding: 1rem;
    border-radius: 8px;
    line-height: 1.5;
    overflow-wrap: break-word;
    font-family: 'Petrona', Georgia, 'Times New Roman', Times, serif;
    font-weight: 400;
}

.message.user .message-content {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
}

.message.assistant .message-content {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
}

/* Markdown styling inside messages */
.message.user .message-content h1,
.message.user .message-content h2,
.message.user .message-content h3,
.message.assistant .message-content h1,
.message.assistant .message-content h2,
.message.assistant .message-content h3 {
    margin-top: 1em;
    margin-bottom: 0.5em;
}

.message.user .message-content p,
.message.assistant .message-content p {
    margin-bottom: 1em;
}

.message.user .message-content ul,
.message.user .message-content ol,
.message.assistant .message-content ul,
.message.assistant .message-content ol {
    padding-left: 1.5em;
    margin-bottom: 1em;
}

.message.user .message-content code,
.message.assistant .message-content code {
    background: #eee;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Fira Mono', 'Courier New', monospace;
    font-size: 0.9em;
}

.message.user .message-content pre,
.message.assistant .message-content pre {
    background: #f8f9fa;
    color: inherit;
    padding: 2.5rem 1em 1em 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1em;
    position: relative;
    border: 1px solid #e9ecef;
}

.message.user .message-content pre code,
.message.assistant .message-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    color: inherit;
}

/* Message input */
.message-input {
    padding: 1rem;
    border-top: 1px solid #ddd;
    background: #ffffff;
    flex-shrink: 0;
}

.message-input textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
    max-height: 200px;
}

.input-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.input-actions button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.input-actions button:first-child {
    background: #10a37f;
    color: white;
    flex: 1;
}

.input-actions button:first-child:hover {
    background: #0d8c6d;
}

.input-actions button:first-child:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.input-actions button:last-child {
    background: #f0f0f0;
    color: #555;
}

.input-actions button:last-child:hover {
    background: #e0e0e0;
}

/* Thinking option checkbox */
.thinking-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}
.thinking-option input[type="checkbox"] {
    margin: 0;
}
.thinking-option label {
    font-size: 0.9rem;
    color: #555;
    cursor: pointer;
}

/* Buttons */
button {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #10a37f 0%, #0d8c6d 100%);
    color: white;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(16, 163, 127, 0.3);
}
button:hover {
    background: linear-gradient(135deg, #0d8c6d 0%, #0b755a 100%);
    box-shadow: 0 4px 8px rgba(16, 163, 127, 0.4);
    transform: translateY(-1px);
}
button:active {
    transform: translateY(0);
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(0,0,0,0.3);
    border-radius: 50%;
    border-top-color: #10a37f;
    animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.message-content .spinner {
    margin-right: 0.5rem;
    vertical-align: middle;
}

.copy-latex-btn {
    margin-left: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f8f9fa;
    color: #333;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.copy-latex-btn:hover {
    opacity: 1;
    background: #e9ecef;
}

/* Positioning for display math copy buttons */
.katex-display {
    position: relative;
}
.katex-display .copy-latex-btn {
    position: absolute;
    right: 0;
    top: 0;
    margin: 0;
    opacity: 0.6;
}
.katex-display .copy-latex-btn:hover {
    opacity: 1;
}

/* Code block copy button */
.message.user .message-content pre .copy-code-btn,
.message.assistant .message-content pre .copy-code-btn {
    position: absolute;
    right: 0.5rem;
    top: 0.5rem;
    margin: 0;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f8f9fa;
    color: #333;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.message.user .message-content pre .copy-code-btn:hover,
.message.assistant .message-content pre .copy-code-btn:hover {
    opacity: 1;
    background: #e9ecef;
}

/* SVG toggle button */
.message.user .message-content pre .svg-toggle-btn,
.message.assistant .message-content pre .svg-toggle-btn {
    position: absolute;
    right: 2.5rem;
    top: 0.5rem;
    margin: 0;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f8f9fa;
    color: #333;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.message.user .message-content pre .svg-toggle-btn:hover,
.message.assistant .message-content pre .svg-toggle-btn:hover {
    opacity: 1;
    background: #e9ecef;
}

/* SVG image wrapper */
.svg-image-wrapper {
    display: block;
    text-align: center;
    padding: 1em;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }

    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        grid-template-areas:
            "header"
            "right-panel";
    }

    .app-container.sidebar-hidden {
        /* Keep same as above (already inherited) */
    }

    .app-container:not(.sidebar-hidden) {
        grid-template-rows: auto auto 1fr;
        grid-template-areas:
            "header"
            "left-panel"
            "right-panel";
    }

    .left-panel {
        width: 100%;
        min-width: unset;
        max-width: unset;
        border-right: none;
        border-bottom: 1px solid #ddd;
        transition: border-bottom 0.3s ease;
    }

    .left-panel.hidden {
        display: none;
    }

    .right-panel {
        min-height: 0;
    }

    .notification-item {
        max-width: 90vw;
    }
}

/* Desktop resize functionality */
@media (min-width: 769px) {
    .app-container {
        grid-template-columns: auto 1fr;
    }

    .app-container.sidebar-hidden {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "right-panel";
    }

    .left-panel {
        resize: horizontal;
        overflow: auto;
        border-right: 2px solid #ddd;
        transition: border-color 0.2s;
    }

    .left-panel:hover {
        border-right-color: #999;
    }

    .left-panel:active {
        border-right-color: #10a37f;
    }
}

/* Thinking block styling */
.thinking-block {
    margin-bottom: 1rem;
    border-left: 4px solid #10a37f;
    background-color: #f8f9fa;
    border-radius: 0 8px 8px 0;
    padding: 1rem;
    font-style: italic;
    color: #555;
}
.thinking-label {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #10a37f;
    margin-bottom: 0.5rem;
    font-family: 'Petrona', Georgia, 'Times New Roman', Times, serif;
}
.thinking-content {
    line-height: 1.5;
    padding-left: .5em;
    font-family: 'Petrona', Georgia, 'Times New Roman', Times, serif;
}
.message-contents {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* KaTeX math rendering */
.katex {
    font-size: 1.1em !important;
}

.katex-display {
    overflow: auto hidden;
    padding: 0.5em 0;
}

/* Import/Export buttons */
.import-export-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.import-export-buttons button {
    width: 100%;
}
.import-export-buttons input[type="file"] {
    display: none;
}
.import-export-buttons label[for="importFile"] {
    display: block;
    width: 100%;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #10a37f 0%, #0d8c6d 100%);
    color: white;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(16, 163, 127, 0.3);
    text-align: center;
}
.import-export-buttons label[for="importFile"]:hover {
    background: linear-gradient(135deg, #0d8c6d 0%, #0b755a 100%);
    box-shadow: 0 4px 8px rgba(16, 163, 127, 0.4);
    transform: translateY(-1px);
}

@media (max-height: 900px) {
    .message-input {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.5rem 1rem;
    }

    .message-input textarea {
        flex: 1 1 60%;
        min-height: auto;
        height: 2.5rem;
        max-height: 2.5rem;
        padding: 0.5rem 0.75rem;
        margin-top: 0;
        resize: none;
        overflow: hidden;
        transition: max-height 0.2s ease, flex-basis 0.2s ease;
    }

    .message-input textarea:focus {
        height: auto;
        min-height: 80px;
        max-height: 200px;
        resize: vertical;
        overflow: auto;
        flex-basis: 100%;
    }

    .input-actions {
        margin-top: 0;
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .message-input textarea:focus + .input-actions {
        width: 100%;
        margin-top: 0.75rem;
    }

    .input-actions button {
        flex-shrink: 1;
        white-space: nowrap;
    }

    .input-actions button:first-child {
        flex: 1;
    }

    .thinking-option {
        margin-left: 0;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        min-width: 4em;
        flex-shrink: 0;
    }

    .thinking-option label {
        font-size: 0;
        white-space: nowrap;
        max-width: 5em;
        min-width: 3em;
        width: 3em;
        line-height: 1.2;
        flex-shrink: 0;
    }

    .thinking-option input[type="checkbox"] {
        vertical-align: middle;
    }

    .thinking-option label::after {
        content: "T...";
        font-size: 0.9rem;
        color: #555;
        display: inline-block;
        max-width: 100%;
        white-space: nowrap;
        vertical-align: middle;
    }

    .message-input textarea:focus + .input-actions .thinking-option label {
        max-width: none;
        width: auto;
        min-width: 8em;
    }

    .message-input textarea:focus + .input-actions .thinking-option {
        min-width: 8em;
        flex-shrink: 1;
    }

    .message-input textarea:focus + .input-actions .thinking-option label::after {
        content: "Request thinking";
        font-size: 0.85rem;
    }

    .message-input textarea:focus + .input-actions button:first-child {
        flex: 1 1 0%;
        min-width: 0;
    }

    @media (max-width: 768px) {
        .message-input {
            gap: 0.5rem;
            padding: 0.5rem;
        }
        .message-input textarea {
            flex: 1 1 40%;
        }
        .input-actions {
            gap: 0.25rem;
        }
        .input-actions button {
            padding: 0.5rem 0.75rem;
        }
        .thinking-option {
            font-size: 0.85rem;
            min-width: 3em;
            flex-shrink: 0;
        }
        .thinking-option label {
            max-width: 4em;
            min-width: 2.5em;
            width: 2.5em;
            flex-shrink: 0;
        }
        .thinking-option label::after {
            font-size: 0.85rem;
            vertical-align: middle;
        }

        .message-input textarea:focus + .input-actions .thinking-option label {
            max-width: none;
            width: auto;
            min-width: 8em;
        }

        .message-input textarea:focus + .input-actions .thinking-option {
            min-width: 8em;
            flex-shrink: 1;
        }

        .message-input textarea:focus + .input-actions .thinking-option label::after {
            content: "Request thinking";
            font-size: 0.85rem;
        }

        .message-input textarea:focus + .input-actions button:first-child {
            flex: 1 1 0%;
            min-width: 0;
        }
    }
}

/* Alternative controls */
.message-actions .separator {
    margin: 0 0.25em;
    color: #888;
}
.message-actions .alternative-index {
    margin: 0 0.25em;
    font-size: 0.9em;
    color: #666;
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modal-fade-in 0.3s ease;
    font-family: 'Petrona', Georgia, 'Times New Roman', Times, serif;
    font-weight: 400;
}

@media (min-width: 1024px) {
    .modal-content {
        max-width: 900px;
    }
}

.modal-content h2 {
    margin-bottom: 1rem;
    color: #333;
    font-family: 'Petrona', Georgia, 'Times New Roman', Times, serif;
    font-weight: bold;
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: #555;
    font-family: 'Petrona', Georgia, 'Times New Roman', Times, serif;
    font-weight: bold;
}

.modal-content p {
    margin-bottom: 1rem;
    line-height: 1.5;
    color: #555;
}

.modal-content button {
    margin-top: 1rem;
    width: 100%;
}

@keyframes modal-fade-in {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

