/* XXBILLION DISTILLER — Dokument-Destillierer v1 */
:root {
    --bg: #0a0a0f; --card: #12121a; --border: #1e1e2e;
    --text: #e0e0e8; --text-dim: #8888aa; --accent: #f59e0b; --accent-dim: #b45309;
    --success: #22c55e; --error: #ef4444; --blue: #3b82f6; --purple: #8b5cf6;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.app-header { padding: 1.2rem 1.5rem 0.8rem; border-bottom: 1px solid var(--border); }
.header-top { display: flex; justify-content: space-between; align-items: center; }
.app-header .logo { font-size: 1.3rem; font-weight: 700; letter-spacing: 0.1em; }
.accent { color: var(--accent); }
.app-header .tagline { color: var(--text-dim); font-size: 0.85rem; }

/* Layout */
main { max-width: 1100px; margin: 1.5rem auto; padding: 0 1.5rem; flex: 1; width: 100%; }
.app-footer { text-align: center; padding: 1rem; color: var(--text-dim); font-size: 0.75rem; border-top: 1px solid var(--border); }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; }
.card h2 { font-size: 1.1rem; margin-bottom: 1rem; color: var(--text); }
.card.hidden { display: none; }

/* Forms */
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: 0.3rem; font-weight: 500; font-size: 0.85rem; color: var(--text-dim); }
textarea, input[type="text"], select {
    width: 100%; padding: 0.7rem 1rem; background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font-size: 0.95rem; transition: border-color 0.2s; font-family: inherit;
}
textarea { resize: vertical; min-height: 200px; font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace; font-size: 0.85rem; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--accent); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.5rem; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s; min-height: 44px; }
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: #fbbf24; }
.btn-primary:disabled { background: var(--accent-dim); cursor: not-allowed; opacity: 0.6; }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; min-height: 36px; }
.btn-danger { background: transparent; color: var(--error); border: 1px solid var(--error); }
.btn-danger:hover { background: rgba(239,68,68,0.1); }

/* Button row */
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }

/* Drop Zone */
.drop-zone { border: 2px dashed var(--border); border-radius: 12px; padding: 2rem; text-align: center; color: var(--text-dim); cursor: pointer; transition: all 0.2s; margin-bottom: 1rem; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); color: var(--accent); }
.drop-zone input[type="file"] { display: none; }

/* Preset Buttons */
.preset-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.preset-btn { padding: 0.5rem 1.2rem; border: 1px solid var(--border); border-radius: 20px; background: transparent; color: var(--text-dim); font-size: 0.85rem; cursor: pointer; transition: all 0.2s; min-height: 44px; }
.preset-btn:hover { border-color: var(--accent); color: var(--text); }
.preset-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

/* Toggle */
.toggle-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.toggle-switch { position: relative; width: 48px; height: 26px; cursor: pointer; }
.toggle-switch input { display: none; }
.toggle-slider { position: absolute; inset: 0; background: var(--border); border-radius: 13px; transition: 0.2s; }
.toggle-slider::before { content: ''; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px; background: var(--text-dim); border-radius: 50%; transition: 0.2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); background: #000; }

/* Token Stats Bar */
.token-stats { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1rem; background: var(--bg); border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.token-bar { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.token-bar-fill { height: 100%; background: var(--success); border-radius: 4px; transition: width 0.5s ease; }
.token-display { color: var(--accent); font-weight: 600; white-space: nowrap; }

/* Result Tabs */
.result-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.result-tab { padding: 0.6rem 1.2rem; cursor: pointer; color: var(--text-dim); border-bottom: 2px solid transparent; transition: all 0.2s; font-size: 0.9rem; min-height: 44px; display: flex; align-items: center; }
.result-tab:hover { color: var(--text); }
.result-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Result text */
.result-text { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace; font-size: 0.85rem; white-space: pre-wrap; word-break: break-word; max-height: 600px; overflow-y: auto; line-height: 1.5; }

/* Model Search */
.model-search { position: relative; margin-bottom: 1rem; }
.model-search input { width: 100%; }
.model-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--card); border: 1px solid var(--border); border-radius: 8px; max-height: 250px; overflow-y: auto; z-index: 100; display: none; }
.model-dropdown.visible { display: block; }
.model-option { padding: 0.5rem 1rem; cursor: pointer; font-size: 0.85rem; transition: background 0.1s; }
.model-option:hover, .model-option.selected { background: rgba(245,158,11,0.1); color: var(--accent); }

/* Skipped List */
.skipped-list { list-style: none; }
.skipped-item { padding: 0.4rem 0; color: var(--text-dim); font-size: 0.85rem; border-bottom: 1px solid var(--border); }
.skipped-item .reason { font-size: 0.75rem; padding: 0.1rem 0.4rem; border-radius: 4px; background: rgba(136,136,170,0.15); margin-left: 0.5rem; }

/* Error Banner */
.error-banner { background: rgba(239,68,68,0.1); border: 1px solid var(--error); border-radius: 8px; padding: 1rem; color: var(--error); margin-bottom: 1rem; display: none; }
.error-banner.visible { display: block; }

/* Streaming */
.streaming-indicator { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--accent); font-size: 0.85rem; }
.streaming-dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Prompt Editor */
.prompt-section { margin-bottom: 1rem; }
.prompt-section summary { cursor: pointer; padding: 0.5rem 0; color: var(--text-dim); font-size: 0.9rem; }
.prompt-section summary:hover { color: var(--text); }
.prompt-section textarea { min-height: 100px; margin-top: 0.5rem; }

/* Badges */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-error { background: rgba(239,68,68,0.15); color: var(--error); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--accent); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--blue); }

/* Preview info */
.preview-info { display: flex; gap: 1.5rem; color: var(--text-dim); font-size: 0.85rem; margin-bottom: 0.5rem; }

/* Toast */
.toast-container { position: fixed; bottom: 1rem; right: 1rem; z-index: 200; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 1rem; font-size: 0.85rem; animation: slideIn 0.3s ease; max-width: 350px; }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Spinner */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
    main { padding: 0 1rem; }
    .preset-row { flex-direction: column; }
    .preset-btn { width: 100%; text-align: center; }
    .token-stats { flex-direction: column; align-items: flex-start; }
}

/* Preset Model Info */
.preset-model-info { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 1rem; margin-bottom: 1rem; font-size: 0.85rem; color: var(--text-dim); display: flex; justify-content: space-between; align-items: center; }
.preset-model-info .model-name { color: var(--accent); font-weight: 600; }
.preset-model-info .model-params { font-size: 0.75rem; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 300; display: flex; align-items: center; justify-content: center; }
.modal-overlay.hidden { display: none; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 12px; width: 90%; max-width: 800px; max-height: 85vh; display: flex; flex-direction: column; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 1.1rem; margin: 0; }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 1rem 1.5rem; border-top: 1px solid var(--border); }

/* Focus (Accessibility) */
.btn:focus-visible, .preset-btn:focus-visible, .result-tab:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

/* Scope-Freeze Ghost-Button (dezenter Discard, rot nur bei Hover) */
.freeze-ghost-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    transition: border-color 0.15s, color 0.15s;
}
.freeze-ghost-btn:hover:not(:disabled) {
    border-color: var(--error);
    color: var(--error);
}

/* Globaler Hidden-Override (mit !important, damit es inline-style display:* schlaegt) */
.hidden { display: none !important; }
