/* Tectyl File Service — Admin UI */

:root {
    --red: #c22d2d;
    --red-dark: #a02020;
    --green: #28a745;
    --yellow: #ffc107;
    --gray-50: #f8f9fa;
    --gray-100: #e9ecef;
    --gray-200: #dee2e6;
    --gray-300: #ced4da;
    --gray-500: #6c757d;
    --gray-700: #495057;
    --gray-900: #212529;
    --blue: #0d6efd;
    --blue-dark: #0b5ed7;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    font-family: var(--font);
    color: var(--gray-900);
    background: var(--gray-50);
    line-height: 1.5;
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--gray-900);
    color: white;
    padding: 1.5rem 0;
    flex-shrink: 0;
}

.sidebar-brand {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid var(--gray-700);
    margin-bottom: 1rem;
}

.sidebar-brand h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-brand small {
    color: var(--gray-500);
    font-size: 0.75rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.5rem;
    color: var(--gray-300);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.main {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
}

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

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Cards */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--gray-700);
}

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

.stat-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 1.25rem;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-card .label {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
}

tr:hover {
    background: var(--gray-50);
}

/* Coverage matrix */
.coverage-table {
    overflow-x: auto;
}

.coverage-table th,
.coverage-table td {
    text-align: center;
    padding: 0.4rem;
    min-width: 50px;
}

.coverage-table th:first-child,
.coverage-table td:first-child {
    text-align: left;
    min-width: 200px;
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
}

.coverage-table th:first-child {
    background: var(--gray-50);
    z-index: 2;
}

.cell-ok {
    background: #d4edda;
    color: var(--green);
    font-weight: 700;
}

.cell-missing {
    background: #fff3cd;
    color: #856404;
}

.cell-none {
    color: var(--gray-300);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-green { background: #d4edda; color: #155724; }
.badge-yellow { background: #fff3cd; color: #856404; }
.badge-red { background: #f8d7da; color: #721c24; }
.badge-blue { background: #cce5ff; color: #004085; }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

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

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

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-100);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

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

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

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

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

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

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: var(--font);
}

.form-control:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(194, 45, 45, 0.15);
}

select.form-control {
    appearance: auto;
}

/* Login */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
}

.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Upload area */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--red);
    background: rgba(194, 45, 45, 0.03);
}

.upload-zone p {
    color: var(--gray-500);
    margin-top: 0.5rem;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

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

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-info {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

/* Review table specifics */
.review-item {
    padding: 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.review-item .file-info {
    flex: 1;
}

.review-item .file-info .filename {
    font-weight: 500;
}

.review-item .file-info .details {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.review-item .actions {
    flex-shrink: 0;
}

/* Utility */
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* HTMX loading indicator */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator {
    display: inline-block;
}

/* Search */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main { padding: 1rem; }
    .stats { grid-template-columns: 1fr 1fr; }
}
