/* CSS Variables for theming */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #58a6ff;
    --accent-hover: #79b8ff;
    --border: #30363d;
    --success: #3fb950;
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --radius-sm: 8px;
}

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

.hidden {
    display: none !important;
}

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

/* Header */
header {
    text-align: center;
    padding: 3rem 2rem 2rem;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.1rem;
    position: relative;
}

/* Config Loader */
.config-loader {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    position: relative;
}

.config-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.config-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.config-status {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
}

.config-status.success {
    color: #4ade80;
}

.config-status.error {
    color: #f87171;
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.tab {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab.active {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Sub-tabs for nested navigation */
.sub-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    width: fit-content;
}

.sub-tab {
    padding: 0.5rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.sub-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sub-tab.active {
    background: var(--accent);
    color: white;
}

.subtab-content {
    display: none;
}

.subtab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Account Grid */
.account-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .account-grid {
        grid-template-columns: 1fr;
    }
}

.account-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.account-card.wide {
    grid-column: 1 / -1;
}

.account-card h3 {
    padding: 1rem 1.5rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
    font-weight: 600;
}

.card-content {
    padding: 1.5rem;
}

.card-content .mini-drop-zone {
    margin: 0;
}

/* Statistics display */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-item {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Subreddit list */
.subreddit-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.subreddit-tag {
    display: inline-block;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: transform 0.2s ease;
}

.subreddit-tag:hover {
    transform: scale(1.05);
}

/* Filter Select */
.filter-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 160px;
}

.filter-select:hover {
    border-color: var(--accent);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

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

/* Date Range Slider */
.date-range-container {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.date-range-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.date-range-labels span:first-child,
.date-range-labels span:last-child {
    color: var(--accent);
    font-weight: 500;
    min-width: 100px;
}

.date-range-labels span:first-child {
    text-align: left;
}

.date-range-labels span:last-child {
    text-align: right;
}

.date-range-title {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.date-range-slider {
    position: relative;
    height: 24px;
}

.slider-track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.slider-range {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    border-radius: 3px;
}

.range-slider {
    position: absolute;
    width: 100%;
    height: 6px;
    top: 50%;
    transform: translateY(-50%);
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    z-index: 2;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
    transition: transform 0.15s ease;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
}

.range-slider::-moz-range-track {
    background: transparent;
}

/* Preferences table */
.preferences-table {
    width: 100%;
    border-collapse: collapse;
}

.preferences-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.preferences-table td:first-child {
    color: var(--text-muted);
    width: 40%;
}

.preferences-table td:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

.preferences-table tr:last-child td {
    border-bottom: none;
}

/* Vote indicators */
.vote-up {
    color: #ff4500;
    font-weight: 600;
}

.vote-up::before {
    content: '▲ ';
}

.vote-down {
    color: #7193ff;
    font-weight: 600;
}

.vote-down::before {
    content: '▼ ';
}

/* Links in tables */
.table-link {
    color: var(--accent);
    text-decoration: none;
    word-break: break-all;
}

.table-link:hover {
    text-decoration: underline;
}

/* Actions column */
.actions-col {
    width: 70px;
    text-align: center;
}

/* Delete button */
.delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    opacity: 1;
}

.delete-btn:active {
    transform: scale(0.95);
}

/* Server status indicator */
.server-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-left: 1rem;
}

.server-status.online {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.server-status.offline {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Main content */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

#search {
    flex: 1;
    min-width: 280px;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

#search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.15);
}

#search::placeholder {
    color: var(--text-muted);
}

.stats {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Tab content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Table */
.table-container {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--bg-tertiary);
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

th:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

td {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    vertical-align: top;
}

tr {
    transition: background 0.2s ease;
    cursor: pointer;
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Column widths */
th:nth-child(1),
td:nth-child(1) {
    width: 140px;
}

th:nth-child(2),
td:nth-child(2) {
    width: 180px;
}

th:nth-child(3),
td:nth-child(3) {
    width: auto;
}

.subreddit {
    display: inline-block;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.title {
    font-weight: 500;
    color: var(--text-primary);
}

.preview {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* File picker */
.file-picker {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 2rem;
}

.drop-zone {
    background: var(--bg-secondary);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 4rem 3rem;
    text-align: center;
    max-width: 500px;
    width: 100%;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.drop-zone.drag-over {
    transform: scale(1.02);
}

.drop-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.drop-zone h2 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.drop-zone p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.select-btn {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.file-status {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.file-status .loaded {
    color: var(--success);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.pagination button:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.pagination button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.close:hover {
    color: var(--text-primary);
}

/* In-tab uploader */
.tab-uploader {
    padding: 3rem;
    display: flex;
    justify-content: center;
}

.mini-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 400px;
    width: 100%;
}

.mini-drop-zone:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.mini-drop-zone h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.mini-drop-zone p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

#modal-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-right: 2rem;
    line-height: 1.4;
}

.modal-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.modal-body {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

.reddit-link {
    display: inline-block;
    background: linear-gradient(135deg, #ff4500 0%, #ff6b35 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.reddit-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 69, 0, 0.4);
}

/* Loading state */
.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 1rem;
    vertical-align: middle;
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state::before {
    content: '🔍';
    display: block;
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.75rem;
    }

    .tabs {
        gap: 0.25rem;
    }

    .tab {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    main {
        padding: 1rem;
    }

    th,
    td {
        padding: 0.75rem;
    }

    th:nth-child(1),
    td:nth-child(1) {
        width: 100px;
    }

    th:nth-child(2),
    td:nth-child(2) {
        width: 120px;
    }

    .modal-content {
        padding: 1.5rem;
    }
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

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

/* Settings Page */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.settings-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
}

.settings-card.wide {
    grid-column: 1 / -1;
}

.settings-card h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.settings-item label {
    color: var(--text-secondary);
    min-width: 80px;
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.settings-input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 110px;
    /* Space for status */
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.settings-input:focus {
    outline: none;
    border-color: var(--accent);
}

.settings-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.settings-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.3);
}

.settings-help {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0.5rem 0 0;
}

.settings-help a {
    color: var(--accent);
}

.settings-help code {
    background: var(--bg-tertiary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
}

/* API Key Status */
.api-status {
    position: absolute;
    right: 12px;
    font-size: 0.9rem;
    pointer-events: none;
    text-align: right;
}

.settings-item .filter-select {
    flex: 1;
    width: 100%;
}

.api-status.loading {
    color: var(--text-muted);
}

.api-status.valid {
    color: #22c55e;
}

.api-status.error {
    color: #ef4444;
}

/* AI Features */
.ai-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.ai-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.ai-btn span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ai-btn:not(:disabled):hover {
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.1);
}

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

.ai-output {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    white-space: pre-wrap;
    font-size: 0.95rem;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
}

.ai-output.loading {
    text-align: center;
    color: var(--text-muted);
}

.ai-output.loading::after {
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid var(--accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
    vertical-align: middle;
}

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