/* Tech Digest - 科技情报精选 样式 */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    box-shadow: var(--shadow);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: var(--bg-color);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

/* Main Content */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 140px);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.5rem;
    color: var(--text-color);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--secondary-color);
    color: white;
    text-decoration: none;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #475569;
}

.btn-primary {
    background-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-danger {
    background-color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

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

/* Alert */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-warning {
    background-color: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
}

/* Active Prompt Info */
.active-prompt-info {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.active-prompt-info .label {
    color: var(--text-muted);
}

.active-prompt-info .value {
    font-weight: 600;
    color: var(--primary-color);
}

.active-prompt-info .separator {
    margin: 0 0.5rem;
    color: var(--border-color);
}

/* Run Summary Banner */
.run-summary-banner {
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
    border: 1px solid #bfdbfe;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #374151;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.run-summary-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.run-summary-text {
    line-height: 1.6;
}

.run-status-failed {
    color: var(--danger-color);
    font-weight: 600;
}

/* News Stats */
.news-stats {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ==================== Unified Toolbar (Search + Date Filter) ==================== */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.375rem 0.5rem 0.375rem 0.625rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.toolbar-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 220px;
    min-width: 200px;
}

.toolbar-search-icon {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1;
    pointer-events: none;
    opacity: 0.75;
}

.toolbar .search-input {
    flex: 1;
    width: 100%;
    padding: 0.5rem 2.25rem 0.5rem 2rem;
    border: 1px solid transparent;
    border-radius: 0.4375rem;
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--text-color);
    background: var(--bg-color);
    transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
    outline: none;
    font-family: inherit;
}

.toolbar .search-input::placeholder {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.toolbar .search-input:focus {
    background: var(--card-bg);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.toolbar-divider {
    width: 1px;
    align-self: stretch;
    background: var(--border-color);
    margin: 0.25rem 0.125rem;
    flex: 0 0 auto;
}

.toolbar-date {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 1 auto;
    flex-wrap: wrap;
}

.toolbar-date-range {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    flex: 0 0 auto;
}

.date-filter-segmented {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.4375rem;
    gap: 0.125rem;
}

.btn-date-filter {
    padding: 0.3125rem 0.625rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 0.3125rem;
    cursor: pointer;
    transition: color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
    line-height: 1.2;
    white-space: nowrap;
    font-family: inherit;
}

.btn-date-filter:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.06);
}

.btn-date-filter:active {
    transform: scale(0.97);
}

.btn-date-filter.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25), 0 2px 6px rgba(37, 99, 235, 0.18);
    font-weight: 600;
}

.btn-date-filter.active:hover {
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.date-range-picker {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.date-input {
    padding: 0.3125rem 0.5rem;
    font-size: 0.8125rem;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    outline: none;
    font-family: inherit;
    color-scheme: light;
    border-radius: 0.375rem;
    width: 8rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.date-input:hover {
    border-color: var(--primary-color);
}

.date-input:focus {
    border-color: var(--primary-color);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.18s ease;
    filter: invert(0.4) sepia(1) saturate(5) hue-rotate(200deg);
}

.date-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.date-range-arrow {
    color: var(--text-muted);
    font-size: 0.8125rem;
    user-select: none;
    opacity: 0.7;
}

.btn-apply-date,
.btn-reset-date {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 1.875rem;
    height: 1.875rem;
    padding: 0;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
    line-height: 1;
    font-family: inherit;
}

.btn-apply-date {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: 1px solid transparent;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-apply-date:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
}

.btn-apply-date:active {
    transform: scale(0.94);
}

.btn-apply-icon {
    font-weight: 700;
    font-size: 0.875rem;
    line-height: 1;
}

.btn-reset-date {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-reset-date:hover {
    color: var(--danger-color, #dc2626);
    border-color: var(--danger-color, #dc2626);
    background: rgba(220, 38, 38, 0.04);
}

.btn-reset-date:active {
    transform: scale(0.94);
}

@media (max-width: 860px) {
    .toolbar {
        gap: 0.375rem;
    }
    .toolbar-divider {
        display: none;
    }
    .toolbar-date {
        width: 100%;
        flex-basis: 100%;
        padding-top: 0.375rem;
        border-top: 1px dashed var(--border-color);
    }
    .toolbar-date-range {
        width: 100%;
        flex-basis: 100%;
        margin-left: 0;
    }
    .date-input {
        width: auto;
        flex: 1 1 7rem;
        min-width: 7rem;
    }
}

/* News List */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.news-item {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.news-title {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.news-title a {
    color: var(--text-color);
    text-decoration: none;
}

.news-title a:hover {
    color: var(--primary-color);
}

.news-summary {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.news-reason {
    color: var(--primary-color);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary, #f5f5f5);
    border-left: 3px solid var(--primary-color);
    border-radius: 4px;
}

.detail-reason {
    margin-bottom: 1.5rem;
}

.reason-text {
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 500;
    padding: 1rem;
    background: var(--bg-secondary, #f5f5f5);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    transition: color 0.3s ease, font-style 0.3s ease, border-color 0.3s ease;
    white-space: pre-wrap;
    word-break: break-word;
}

.news-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.news-link {
    color: var(--primary-color);
    text-decoration: none;
}

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

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

.pagination .btn {
    min-width: 2.5rem;
    text-align: center;
}

.pagination .btn.active {
    background-color: var(--primary-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    background: var(--card-bg);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Detail Page */
.detail-page {
    max-width: 800px;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--primary-color);
    text-decoration: none;
}

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

.news-detail {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.detail-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.detail-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.detail-meta {
    display: flex;
    gap: 1rem;
    color: var(--text-muted);
    align-items: center;
}

.lang-badge {
    display: inline-block;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.4;
}

.detail-summary {
    background: #f0f9ff;
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1.5rem;
}

.detail-summary h3 {
    font-size: 0.875rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.detail-content {
    margin-bottom: 1.5rem;
}

.detail-content h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.content-text {
    white-space: pre-wrap;
    line-height: 1.8;
}

.detail-actions {
    text-align: center;
}

/* Reason / Summary section header with inline toolbar */
.reason-header {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-bottom: 0.75rem;
}

/* Top row: title + buttons */
.reason-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.reason-header h3 {
    font-size: 0.875rem;
    color: var(--primary-color);
    margin: 0;
    flex-shrink: 0;
    line-height: 1.5;
}

/* Button toolbar: horizontal row of buttons */
.reason-toolbar {
    display: flex;
    gap: 0.375rem;
    align-items: center;
    flex-shrink: 0;
}

/* Custom requirements row: full-width textarea */
.reason-custom-row {
    width: 100%;
}

.reason-custom-row .textarea-sm {
    width: 100%;
    min-height: 2.8rem;
}

/* Small ghost button */
.btn-sm {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    border-radius: 0.3rem;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border-color);
}

.btn-ghost:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.04);
}

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

.btn-icon {
    font-size: 0.75rem;
    flex-shrink: 0;
}

.btn-success {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: #fff !important;
}

/* Small text input */
.input-sm {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.3rem;
    font-family: inherit;
    width: 220px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-sm:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.input-sm::placeholder {
    color: #94a3b8;
}

/* Small textarea */
.textarea-sm {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: #f9fafb;
    color: #374151;
    width: 100%;
    resize: vertical;
    line-height: 1.5;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.textarea-sm:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.2);
    background: #fff;
}

.textarea-sm::placeholder {
    color: #94a3b8;
    font-style: italic;
    font-size: 0.75rem;
}

/* Streaming text state */
.reason-streaming {
    color: #94a3b8 !important;
    font-style: italic !important;
    border-left-color: #93c5fd !important;
}

.reason-error {
    color: #dc2626 !important;
    border-left-color: #fca5a5 !important;
}

/* Streaming indicator animation */
.streaming-indicator {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.5rem;
}

.streaming-dot {
    width: 5px;
    height: 5px;
    background: #93c5fd;
    border-radius: 50%;
    animation: streamingBounce 1.2s ease-in-out infinite;
}

.streaming-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.streaming-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes streamingBounce {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.3); }
}

.streaming-label {
    font-size: 0.7rem;
    color: #93c5fd;
    margin-left: 0.25rem;
}

/* Thinking section (collapsible) */
.thinking-section {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    background: #f8fafc;
    overflow: hidden;
}

.thinking-section summary {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.thinking-section summary::-webkit-details-marker {
    display: none;
}

.thinking-section summary::before {
    content: '▶ ';
    font-size: 0.6rem;
    display: inline-block;
    transition: transform 0.15s ease;
}

.thinking-section[open] summary::before {
    transform: rotate(90deg);
}

.thinking-content {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
    border-top: 1px solid #e2e8f0;
}

/* Summary parsed result inline */
.summary-parsed-result {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #374151;
}

.parsed-title {
    margin-bottom: 0.375rem;
}

.parsed-summary {
    color: #374151;
}

/* Table */
.table {
    width: 100%;
    background: var(--card-bg);
    border-collapse: collapse;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
}

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

.table .actions {
    display: flex;
    gap: 0.5rem;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge-secondary {
    background-color: #f1f5f9;
    color: #475569;
}

.required-star {
    color: #dc2626;
    font-weight: bold;
    margin-left: 0.15rem;
}

/* Form */
.form {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    max-width: 600px;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-select {
    display: block;
    width: 100%;
    padding: 0.5rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: var(--card-bg);
    color: var(--text-color);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-fieldset {
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.form-fieldset legend {
    font-weight: 600;
    padding: 0 0.5rem;
}

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

/* Inline Form */
.inline-form {
    display: inline;
}

/* Help Section */
.help-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.help-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.help-section h4 {
    font-size: 0.875rem;
    color: var(--primary-color);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.help-section p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.help-section code {
    background: #f1f5f9;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

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

.modal-content {
    background: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

/* Modal progress page overrides */
.progress-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

.progress-page.modal-content {
    width: 95%;
    max-width: 1100px;
    max-height: 90vh;
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    border-radius: 0.5rem;
}

.progress-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.prompt-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
}

/* Step Timeline for modal */
.step-timeline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    min-width: 80px;
    transition: all 0.3s;
    cursor: pointer;
}

.step-item.pending {
    opacity: 0.5;
}

.step-item.active {
    background: #eff6ff;
    border: 2px solid var(--primary-color);
}

.step-item.done {
    background: #f0fdf4;
}

.step-item.error {
    background: #fef2f2;
}

.step-item.selected {
    background: #fef3c7;
    border: 2px solid #f59e0b;
}

.step-icon {
    font-size: 1.25rem;
}

.step-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-color);
}

.step-status {
    font-size: 0.875rem;
    min-height: 1.25rem;
}

.step-connector {
    width: 30px;
    height: 2px;
    background: var(--border-color);
}

/* Progress Section for modal */
.progress-section {
    margin-bottom: 1.5rem;
}

.progress-bar-container.large {
    height: 14px;
    margin-bottom: 0.75rem;
}

.progress-bar-container.large .progress-bar {
    height: 100%;
}

.progress-message {
    font-size: 1rem;
    text-align: center;
    color: var(--text-color);
    min-height: 1.5rem;
}

/* Two Column Layout for modal */
.progress-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
}

.progress-details-panel,
.progress-output-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
}

.progress-details-panel h3,
.progress-output-panel h3 {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* Detail Panel */
.detail-panel-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
}

.detail-label {
    color: var(--text-muted);
}

.detail-value {
    font-weight: 500;
    color: var(--text-color);
}

/* Output Panel */
.output-panel-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.output-section {
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    overflow: hidden;
}

.output-header {
    background: var(--bg-color);
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
}

.output-content,
.output-stream {
    padding: 0.5rem;
    font-size: 0.75rem;
    max-height: 120px;
    overflow-y: auto;
    background: #fafafa;
}

.output-stream {
    font-family: "SF Mono", "Monaco", "Inconsolata", monospace;
    background: #1e293b;
    color: #e2e8f0;
    white-space: pre-wrap;
}

/* Step indicator */
.step-indicator {
    font-size: 0.6875rem;
    background: var(--primary-color);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    margin-left: 0.5rem;
}

/* Active output section */
.output-section.active .output-header {
    background: var(--primary-color);
    color: white;
}

.output-content.empty,
.output-stream.empty {
    color: #999;
    font-style: italic;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.progress-message {
    color: var(--text-color);
    font-size: 0.9375rem;
    margin-bottom: 1rem;
    min-height: 1.5rem;
}

/* Progress Details */
.progress-details {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
    transition: background-color 0.3s;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row.active {
    background: #eff6ff;
}

.detail-row.done {
    background: #f0fdf4;
}

.detail-row.error {
    background: #fef2f2;
}

.detail-row.skip {
    background: #fffbeb;
}

.detail-icon {
    font-size: 1rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.detail-text {
    font-size: 0.875rem;
    color: var(--text-color);
}

/* Streaming output area within detail row */
.detail-stream {
    display: none;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #1e293b;
    border-radius: 0.375rem;
    font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: #e2e8f0;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.detail-row.active .detail-stream {
    display: block;
}

/* News list in progress modal */
.detail-news-list {
    display: none;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    max-height: 180px;
    overflow-y: auto;
}

.detail-row.active .detail-news-list {
    display: block;
}

.news-list-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
}

.news-list-item:last-child {
    border-bottom: none;
}

.news-list-item .news-id {
    color: var(--primary-color);
    font-weight: 600;
    flex-shrink: 0;
    min-width: 60px;
}

.news-list-item .news-title {
    color: var(--text-color);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.news-list-item .news-source {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* AI thinking indicator */
.ai-thinking {
    color: var(--primary-color);
    font-size: 0.75rem;
    margin-left: 0.5rem;
    display: none;
}

.detail-row.active .ai-thinking {
    display: inline;
}

/* Expandable detail area toggle */
.detail-expand-btn {
    margin-left: auto;
    padding: 0.125rem 0.375rem;
    font-size: 0.6875rem;
    background: #e2e8f0;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    color: var(--text-muted);
}

.detail-expand-btn:hover {
    background: #cbd5e1;
}

/* ==================== Auth Pages ==================== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    padding: 2rem 1rem;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-title {
    font-size: 1.75rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-form .form-group {
    margin-bottom: 1rem;
}

.auth-form .form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
}

.auth-form .form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-form .btn-block {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.admin-login-section {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.admin-login-link {
    color: var(--text-secondary, #6b7280);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s;
}

.admin-login-link:hover {
    color: var(--primary-color, #667eea);
}

.alert-danger {
    background-color: #fef2f2;
    border: 1px solid #ef4444;
    color: #dc2626;
    padding: 0.75rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* ==================== App Layout with Sidebar ==================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--primary-color);
}

.sidebar-logo:hover {
    opacity: 0.9;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    letter-spacing: 0.05em;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.15s;
    font-size: 0.875rem;
    border-left: 3px solid transparent;
}

.sidebar-item:hover {
    background-color: var(--bg-color);
}

.sidebar-item.active {
    background-color: #eff6ff;
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.sidebar-item-icon {
    font-size: 1rem;
    width: 1.5rem;
    text-align: center;
}

.sidebar-item-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-item-badge {
    font-size: 0.5rem;
    color: var(--text-muted);
}

.sidebar-item-badge.active {
    color: var(--success-color);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
}

.user-name {
    color: var(--text-muted);
}

.logout-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
}

.logout-link:hover {
    color: var(--danger-color);
}

/* Main content wrapper (to the right of sidebar) */
.main-wrapper {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-wrapper .main {
    flex: 1;
    padding: 2rem 0;
}

.main-wrapper .footer {
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
}

/* Make header use the new layout context */
.main-wrapper .header {
    display: none;  /* Hide old header, using sidebar instead */
}

/* ==================== Translation Styles ==================== */

/* News list translate button */
.btn-translate-news {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.btn-translate-news:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-translate-news:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Detail page content translation */
.content-translated {
    padding: 1rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 0.375rem;
    margin-top: 0.5rem;
    line-height: 1.7;
    color: var(--text-color);
}
/* ==================== Search Bar Styles ==================== */

.search-bar {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 1rem;
    position: relative;
    max-width: 480px;
}

.search-input {
    flex: 1;
    padding: 0.5rem 2.25rem 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-color);
    background: var(--card-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    width: 100%;
}

.search-input::placeholder {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0.25rem;
    border-radius: 50%;
    display: none;
    transition: color 0.15s, background 0.15s;
}

.search-clear:hover {
    color: var(--text-color);
    background: var(--border-color);
}

.search-clear.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Search empty state (no matching results) */
.search-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    display: none;
}

.search-empty-state.visible {
    display: block;
}

.search-empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

.search-empty-state .search-empty-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Hide news items that don't match search */
.news-item.search-hidden {
    display: none;
}
