/* Intellecta Portal — admin console styles (layers on brand.css). */

body.admin { background: var(--bg-soft); }

.admin-topbar {
    background: #0d0f13; color: #fff;
    border-bottom: 3px solid transparent;
    border-image: var(--brand-grad) 1;
}
.admin-topbar .bar { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 24px; }
.admin-topbar .brand { display: flex; align-items: center; gap: 12px; font-weight: 800; color: #fff; }
.admin-topbar .brand img { height: 26px; filter: brightness(0) invert(1); }
.admin-topbar .tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: #cdd2db; background: rgba(255,255,255,.08); padding: 3px 10px; border-radius: 999px; }
.admin-nav { display: flex; align-items: center; gap: 22px; }
.admin-nav a { color: #cdd2db; font-weight: 600; font-size: .95rem; }
.admin-nav a:hover, .admin-nav a.active { color: #fff; text-decoration: none; }
.admin-nav form { margin: 0; }
.admin-nav .linkbtn { background: none; border: 0; color: #cdd2db; font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.admin-nav .linkbtn:hover { color: #fff; }
.admin-bar-inner { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

.admin-main { max-width: 1080px; margin: 0 auto; padding: 36px 24px 80px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.admin-head h1 { font-size: 1.7rem; margin: 0; }
.crumbs { font-size: .92rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* Cards / panels */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 22px; }
.panel h2 { font-size: 1.15rem; margin: 0 0 16px; }
.panel .panel-help { color: var(--muted); font-size: .92rem; margin: -8px 0 16px; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 26px; }
@media (max-width: 700px) { .stats { grid-template-columns: 1fr; } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.stat .n { font-size: 2rem; font-weight: 800; color: var(--brand-2); }
.stat .l { color: var(--muted); font-size: .92rem; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.table .actions { display: flex; gap: 8px; justify-content: flex-end; }

.pill { display: inline-block; font-size: .76rem; font-weight: 700; padding: 3px 11px; border-radius: 999px; }
.pill-live { color: var(--ok); background: rgba(31,157,85,.12); }
.pill-draft { color: #9a6700; background: #fff5e0; }

/* Buttons (small) */
.btn-sm { padding: 8px 16px; font-size: .9rem; }
.btn-danger { background: #fff; color: #c0392b; border-color: #f0c7c1; }
.btn-danger:hover { background: #c0392b; color: #fff; border-color: #c0392b; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.field input[type=text], .field input[type=number], .field input[type=date],
.field input[type=email], .field input[type=password], .field textarea, .field select {
    width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
    font: inherit; color: var(--ink); background: #fff;
}
.field textarea { resize: vertical; min-height: 90px; }
.field textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86rem; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 0; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(106,44,145,.12); }
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: 18px; height: 18px; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 22px; }

/* Flash messages */
.flash { padding: 13px 18px; border-radius: 10px; margin-bottom: 20px; font-weight: 600; }
.flash-ok { background: rgba(31,157,85,.1); color: #167544; border: 1px solid rgba(31,157,85,.25); }
.flash-err { background: #fdecea; color: #b3261e; border: 1px solid #f5c2bd; }

/* Version history list */
.vrow { display: grid; grid-template-columns: 90px 120px 1fr auto; gap: 14px; align-items: baseline; padding: 13px 0; border-top: 1px solid var(--line); }
.vrow:first-child { border-top: 0; }
.vrow .vv { font-weight: 800; color: var(--brand-2); }
.vrow .vd { color: var(--muted); font-size: .9rem; }
@media (max-width: 640px) { .vrow { grid-template-columns: 1fr; gap: 4px; } }

/* Drag-and-drop image upload */
.dropzone {
    border: 2px dashed var(--line); border-radius: 12px; padding: 16px;
    text-align: center; cursor: pointer; background: var(--bg-soft);
    transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover { border-color: var(--brand-2); }
.dropzone.dz-over { border-color: var(--brand-1); background: #fff; }
.dropzone.dz-busy { opacity: .65; pointer-events: none; }
.dz-preview { min-height: 0; }
.dz-preview img { max-height: 130px; max-width: 100%; border-radius: 8px; margin: 0 auto 10px; display: block; }
.dz-prompt { font-size: .88rem; color: var(--muted); font-weight: 600; }
.dropzone.has-image .dz-prompt { font-size: .82rem; }

/* Login */
.auth-wrap { max-width: 420px; margin: 8vh auto; padding: 0 24px; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; box-shadow: var(--shadow); }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo img { height: 32px; display: inline-block; }

/* Small screens: let the bar + nav wrap so every item stays on-screen and clickable. */
@media (max-width: 860px) {
    .admin-topbar .bar { flex-wrap: wrap; height: auto; gap: 8px 18px; padding: 10px 0; }
    .admin-nav { flex-wrap: wrap; gap: 12px 18px; width: 100%; }
}

/* API reference page (/admin/api) */
.api-lead { color: var(--muted); max-width: 760px; margin: -10px 0 24px; }
.api-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 32px; align-items: start; }

/* Sticky left menu */
.api-side { position: sticky; top: 18px; max-height: calc(100vh - 36px); overflow-y: auto; }
.api-toc { font-size: .9rem; }
.api-toc-group { margin-bottom: 18px; }
.api-toc-title { display: block; font-weight: 800; color: var(--ink); margin-bottom: 8px; }
.api-toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.api-toc li a { display: flex; align-items: center; gap: 8px; padding: 5px 0 5px 12px; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); }
.api-toc li a:hover { color: var(--ink); border-left-color: var(--brand-2); text-decoration: none; }
.api-toc li code { font-size: .82rem; background: none; padding: 0; color: inherit; overflow-wrap: anywhere; }

/* Method badges */
.api-m { display: inline-block; font-size: .68rem; font-weight: 800; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; text-transform: uppercase; flex: none; }
.api-m.m-get { background: rgba(31,157,85,.14); color: #167544; }
.api-m.m-post { background: rgba(106,44,145,.12); color: var(--brand-2); }
.api-m.m-other { background: rgba(20,24,30,.1); color: var(--ink); }

/* Content */
.api-content { min-width: 0; }
.api-group { margin-bottom: 8px; scroll-margin-top: 18px; }
.api-group-h { display: flex; align-items: center; gap: 12px; font-size: 1.35rem; margin: 28px 0 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.api-group:first-child .api-group-h { border-top: 0; margin-top: 0; }
.api-intro { color: var(--muted); max-width: 820px; margin: 0 0 18px; }
.api-intro code, .api-desc code, .api-table code { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: .85em; }

.api-ep { scroll-margin-top: 18px; }
.api-ep-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.api-path { font-size: 1rem; font-weight: 700; color: var(--ink); background: none !important; border: 0 !important; padding: 0 !important; overflow-wrap: anywhere; }
.api-ep-name { font-weight: 700; margin-bottom: 6px; }
.api-desc { color: var(--ink); margin: 0 0 4px; }
.api-h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.api-table th, .api-table td { padding: 9px 10px; font-size: .9rem; vertical-align: top; }
.api-req { color: #b3261e; font-weight: 700; font-size: .82rem; }
.api-pre { background: #0d0f13; color: #e7e9ee; border-radius: 10px; padding: 16px 18px; overflow-x: auto; font-size: .85rem; line-height: 1.5; margin: 0; }
.api-pre code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: none; border: 0; padding: 0; color: inherit; }

@media (max-width: 860px) {
    .api-layout { grid-template-columns: 1fr; gap: 20px; }
    .api-side { position: static; max-height: none; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
}
