/* MyBus65 Admin Panel Styles */
:root {
    --primary: #E04E39;
    --primary-hover: #B12E1C;
    --bg: #F7F7F8;
    --surface: #FFFFFF;
    --border: #E5E7EB;
    --text: #111827;
    --text-secondary: #4B5563;
    --text-muted: #6B7280;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
}

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

body {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* Navigation */
.admin-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
}
.nav-brand {
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
}
.nav-links { display: flex; gap: 4px; }
.nav-link {
    padding: 8px 14px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: 13px;
    transition: background 0.15s;
}
.nav-link:hover { background: var(--bg); color: var(--text); }

/* Content */
.admin-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h2 { font-size: 20px; font-weight: 600; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.btn:hover { background: var(--bg); }
.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #FEF2F2; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn-close {
    background: none; border: none; font-size: 24px;
    cursor: pointer; color: var(--text-muted); line-height: 1;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 700; }

/* Tables */
.table-container { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.data-table th, .data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.data-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table a { color: var(--primary); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }

.actions { display: flex; gap: 6px; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.badge-active { background: #D1FAE5; color: #065F46; }
.badge-inactive { background: #F3F4F6; color: var(--text-muted); }
.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-indexing { background: #DBEAFE; color: #1E40AF; }
.badge-error { background: #FEE2E2; color: #991B1B; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.error-message {
    background: #FEE2E2;
    color: #991B1B;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
}

/* Section */
.section { margin-bottom: 32px; }
.section h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.text-muted { color: var(--text-muted); font-size: 13px; }

/* Detail */
.detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}
.detail-table { width: 100%; }
.detail-table td {
    padding: 6px 0;
    font-size: 13px;
    vertical-align: top;
}
.detail-table td:first-child {
    width: 180px;
    color: var(--text-muted);
    font-weight: 500;
}
.detail-actions { margin-top: 16px; display: flex; gap: 8px; }

/* Chunks */
.chunk-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}
.chunk-header {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}
.chunk-text { font-size: 13px; line-height: 1.5; white-space: pre-wrap; }

/* Filters */
.filters { display: flex; gap: 12px; margin-bottom: 16px; }
.filters select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: var(--surface);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-muted);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-header h3 { font-size: 16px; }

/* Period selector */
.period-selector select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
}

/* Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-container {
    background: var(--surface);
    border-radius: 16px;
    padding: 40px;
    width: 380px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}
.login-header { text-align: center; margin-bottom: 28px; }
.login-header h1 { color: var(--primary); font-size: 24px; }
.login-header p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* Progress */
.progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-bottom: 12px;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s;
}
