/* LLM Docs - Minimal CSS */

:root {
    --bg: #fafafa;
    --fg: #222;
    --muted: #666;
    --border: #ddd;
    --primary: #0066cc;
    --primary-hover: #0052a3;
    --danger: #cc3300;
    --success: #228b22;
    --code-bg: #f4f4f4;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: var(--fg);
    background: var(--bg);
    margin: 0;
    padding: 0;
}

/* Navigation */
.navbar {
    background: var(--fg);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.navbar .brand {
    font-weight: bold;
    font-size: 1.2rem;
    color: white;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}

.nav-links a:hover {
    color: white;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Typography */
h1 {
    margin-top: 0;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

h2 {
    margin-top: 2rem;
}

a {
    color: var(--primary);
}

code {
    background: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

pre {
    background: var(--code-bg);
    padding: 1rem;
    overflow-x: auto;
    border-radius: 4px;
}

pre code {
    padding: 0;
    background: none;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--border);
    color: var(--fg);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.4;
    box-sizing: border-box;
    font-family: inherit;
}

.btn:hover {
    background: #ccc;
}

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

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

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

.btn-danger:hover {
    background: #aa2200;
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    min-width: 60px;
    text-align: center;
}

/* Forms */
.ingest-form, .search-form {
    margin: 1.5rem 0;
}

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

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

.form-group small {
    color: var(--muted);
    font-size: 0.85rem;
}

.form-group.checkbox label {
    display: inline;
    font-weight: normal;
}

input[type="text"],
input[type="url"],
input[type="file"],
textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
}

textarea {
    resize: vertical;
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-form input {
    flex: 1;
}

/* Tables */
.docs-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    table-layout: fixed;
}

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

.docs-table th {
    background: var(--code-bg);
    font-weight: 600;
}

.docs-table tr:hover {
    background: rgba(0,0,0,0.02);
}

/* Column widths */
.docs-table .col-title {
    width: auto;
}

.docs-table .col-type {
    width: 80px;
}

.docs-table .col-tokens {
    width: 100px;
    white-space: nowrap;
    text-align: right;
}

.docs-table .col-date {
    width: 130px;
    white-space: nowrap;
}

.docs-table .col-actions {
    width: 80px;
    text-align: right;
}

.docs-table td:first-child {
    word-break: break-word;
}

.docs-table td:nth-child(2),
.docs-table td:nth-child(3) {
    white-space: nowrap;
}

.docs-table td:last-child {
    text-align: right;
}

/* Tags */
.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: var(--code-bg);
    border-radius: 3px;
    font-size: 0.8rem;
    margin-right: 0.25rem;
}

/* Search Results */
.results {
    margin-top: 1.5rem;
}

.result-item {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 1rem;
}

.result-title {
    font-size: 1.1rem;
    font-weight: 500;
}

.result-meta {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0.25rem 0;
}

.result-meta .score {
    margin-right: 1rem;
}

.snippet {
    margin: 0.5rem 0 0 0;
    color: var(--muted);
}

/* Quick Actions */
.quick-actions {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.quick-actions .btn {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Document Detail */
.doc-detail header {
    margin-bottom: 1.5rem;
}

.doc-meta, .project-meta {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-item {
    display: inline-flex;
    gap: 0.3rem;
}

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

.meta-item a {
    word-break: break-all;
}

.doc-actions, .project-actions {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--code-bg);
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.doc-actions .btn, .project-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.doc-content {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

/* Project Detail */
.project-docs {
    margin-top: 2rem;
}

.add-doc-form {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
}

.add-doc-form input {
    flex: 1;
}

/* Error */
.error {
    background: #ffeeee;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.error-page {
    text-align: center;
    padding: 3rem;
}

/* Actions bar */
.actions {
    margin-bottom: 1rem;
}

/* Description */
.description {
    color: var(--muted);
    font-style: italic;
}

/* Inline Ingest */
.ingest-inline {
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--code-bg);
    border-radius: 4px;
}

.ingest-form-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ingest-form-vertical textarea {
    width: 100%;
    margin: 0;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

.ingest-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ingest-row input[type="text"] {
    flex: 1;
    margin: 0;
}

.ingest-row input[type="file"].hidden {
    display: none;
}

.ingest-row .btn,
.ingest-row label.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    box-sizing: border-box;
}

.ingest-row label.btn {
    cursor: pointer;
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ingest-row label.btn.file-selected {
    background: var(--primary);
    color: white;
}

.ingest-status {
    margin-top: 0.75rem;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.ingest-status.success {
    background: #e8f5e9;
    color: var(--success);
}

.ingest-status.error {
    background: #ffeeee;
    color: var(--danger);
}

.ingest-status.hidden {
    display: none;
}

/* Docs Section */
.docs-section {
    margin-top: 2rem;
}

.docs-section h2 {
    margin-top: 0;
}

.empty-state {
    color: var(--muted);
}

.search-section {
    margin-bottom: 1.5rem;
}

/* Projects Section */
.projects-section {
    margin-top: 2rem;
}

.projects-section h2 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.projects-section h2 .btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
}

/* Document Picker Dropdown */
.doc-picker {
    position: relative;
    flex: 1;
}

.doc-picker input[type="text"] {
    width: 100%;
}

.dropdown-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.dropdown-list.show {
    display: block;
}

.dropdown-item {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

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

.dropdown-item:hover,
.dropdown-item.active {
    background: var(--code-bg);
}

.dropdown-item.empty {
    color: var(--muted);
    cursor: default;
}

.dropdown-item.empty:hover {
    background: none;
}

.dropdown-item .doc-title {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 1rem;
}

.dropdown-item .doc-type {
    font-size: 0.8rem;
    color: var(--muted);
    flex-shrink: 0;
}

/* Login Page */
.login-container {
    max-width: 400px;
    margin-top: 10vh;
}

.login-form {
    margin-top: 2rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form .btn {
    width: 100%;
}

/* Rename Form */
.rename-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.rename-form input[type="text"] {
    flex: 1;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 0.25rem 0.5rem;
}

.rename-form.hidden {
    display: none;
}

.editable-title {
    cursor: pointer;
}

.editable-title:hover {
    text-decoration: underline;
    text-decoration-style: dotted;
}

.hidden {
    display: none !important;
}

/* Token display */
.token-total {
    font-size: 0.9rem;
    font-weight: normal;
    color: var(--muted);
}
