/*
 * admin.css — Radar Self Admin UI
 */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #1a1a1a;
    background: #f5f6f8;
}

a { color: #2763eb; text-decoration: none; }
a:hover { text-decoration: underline; }

code {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    background: #eceef2;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
}

.muted { color: #6b7280; font-size: 12px; }

/* --- topbar --- */
.topbar {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    background: #111827;
    color: #fff;
    gap: 24px;
}
.topbar__brand { font-weight: 700; letter-spacing: 0.5px; }
.topbar__nav a {
    color: #cbd5e1;
    margin-right: 16px;
    font-weight: 500;
}
.topbar__nav a:hover { color: #fff; text-decoration: none; }

/* --- layout --- */
.main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}
.section { background: #fff; padding: 24px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.section + .section { margin-top: 16px; }
.section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.section h1 { margin: 0; font-size: 22px; }

/* --- cards --- */
.card-list { list-style: none; padding: 0; margin: 16px 0; }
.card {
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 12px;
}
.card h2 { margin: 0 0 8px 0; font-size: 16px; }

/* --- buttons --- */
.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #111827;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.btn--primary:hover { background: #1d4ed8; }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: #f3f4f6; }

/* --- filters --- */
.filters {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
}
.filters label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: #374151;
}
.filters label span { margin-bottom: 4px; font-weight: 500; }
.filters select,
.filters input[type="text"] {
    min-width: 150px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
}
.filters__toggle {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    align-self: flex-end;
}

/* --- table --- */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th, .table td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}
.table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.table tr:hover td { background: #fafbfc; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: #e5e7eb;
    color: #374151;
}
.badge--draft { background: #e5e7eb; color: #374151; }
.badge--ready_for_implementation { background: #fef3c7; color: #92400e; }
.badge--implemented { background: #dbeafe; color: #1e40af; }
.badge--verified { background: #d1fae5; color: #065f46; }
.badge--active { background: #bbf7d0; color: #065f46; }
.badge--disabled { background: #fee2e2; color: #991b1b; }
.badge--archived { background: #f3f4f6; color: #9ca3af; }

.badge--not_implemented { background: #fee2e2; color: #991b1b; }
.badge--generated { background: #fef3c7; color: #92400e; }
.badge--attached { background: #dbeafe; color: #1e40af; }
.badge--failed { background: #fecaca; color: #7f1d1d; }

/* --- form --- */
.section--form { max-width: 900px; }
.step-form { display: flex; flex-direction: column; gap: 16px; }

.block {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 20px;
    background: #fff;
    margin: 0;
}
.block legend {
    font-weight: 700;
    font-size: 13px;
    color: #111827;
    padding: 0 6px;
}
.block label {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    font-size: 13px;
}
.block label span { font-weight: 500; margin-bottom: 4px; color: #374151; }
.block label em { color: #6b7280; font-style: normal; font-weight: normal; }
.block input[type="text"],
.block input[type="number"],
.block textarea,
.block select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    background: #fff;
}
.block label.inline {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}
.block label.inline input[type="checkbox"] { width: auto; }
.block label.inline span { margin-bottom: 0; }

.json-editor {
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    min-height: 140px;
}
.block__actions {
    margin-top: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
}
.block--actions {
    display: flex;
    gap: 12px;
    flex-direction: row;
    align-items: center;
    background: #f9fafb;
}

/* --- alerts --- */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
}
.alert--error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert--ok { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }

/* --- modal --- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal[hidden] { display: none; }
.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
}
.modal__panel {
    position: relative;
    width: min(780px, 92vw);
    max-height: 86vh;
    background: #fff;
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal__header h2 { margin: 0; font-size: 18px; }
.modal__meta { font-size: 12px; color: #374151; display: flex; flex-direction: column; gap: 4px; }
.modal__footer {
    display: flex;
    align-items: center;
    gap: 12px;
}

.prompt-text {
    width: 100%;
    flex: 1;
    min-height: 360px;
    padding: 12px;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    resize: vertical;
}
