/* NeuroCog admin interface */
:root {
  --ink: #0d1326; --accent: #6366f1; --accent-2: #06b6d4;
  --bg: #f2f4fa; --card: #fff; --border: #dfe3f0; --text: #1c2237; --muted: #67708c;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Inter", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }

/* auth screens */
.auth-page { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(110% 110% at 70% 0%, #1d2752, #090e1f); }
.auth-card { background: #fff; border-radius: 18px; padding: 44px 44px 36px; width: min(420px, 92vw); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
.auth-card h1 { font-size: 1.7rem; margin-bottom: 6px; }
.auth-card h1 em, .admin-brand em { font-style: normal; background: linear-gradient(100deg, #6366f1, #06b6d4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-sub { color: var(--muted); margin-bottom: 22px; }
.auth-error { background: #fde8e8; color: #b91c1c; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: .9rem; }
.auth-card label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 16px; }
.auth-card input { width: 100%; margin-top: 6px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 1rem; }
.auth-card input:focus { outline: none; border-color: var(--accent); }
.auth-card button { width: 100%; padding: 13px; border: 0; border-radius: 10px; background: linear-gradient(100deg, #6366f1, #06b6d4); color: #fff; font-weight: 700; font-size: 1rem; cursor: pointer; }
.auth-back { margin-top: 18px; text-align: center; font-size: .85rem; }
.auth-back a { color: var(--muted); }
.auth-hint { margin-top: 16px; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.auth-hint em { color: var(--text); font-style: normal; background: #eef0fa; padding: 1px 5px; border-radius: 5px; }

/* layout */
.admin-header {
  position: sticky; top: 0; z-index: 100; background: var(--ink); color: #fff;
  display: flex; align-items: center; gap: 28px; padding: 0 24px; height: 60px; flex-wrap: wrap;
}
.admin-brand { font-weight: 700; font-size: 1.15rem; }
.admin-brand small { opacity: .5; font-weight: 400; }
.admin-tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.admin-tabs button {
  background: none; border: 0; color: #aab2d0; font: inherit; font-weight: 600; font-size: .88rem;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.admin-tabs button:hover { color: #fff; }
.admin-tabs button.active { background: rgba(255,255,255,.14); color: #fff; }
.admin-actions { display: flex; gap: 16px; font-size: .85rem; }
.admin-actions a { color: #aab2d0; text-decoration: none; }
.admin-actions a:hover { color: #fff; }

.admin-panel { max-width: 1000px; margin: 28px auto 80px; padding: 0 20px; }

/* generic blocks */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 22px; margin-bottom: 18px; }
.card h2 { font-size: 1.15rem; margin-bottom: 14px; }
.card h3 { font-size: .98rem; margin: 14px 0 8px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .82rem; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .05em; }
.field input[type=text], .field input[type=date], .field input[type=number], .field input[type=password], .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 9px; font: inherit; background: #fff;
}
.field textarea { min-height: 90px; resize: vertical; }
.field textarea.tall { min-height: 170px; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.13); }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }

/* item lists (members, pubs, news…) */
.item { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; background: #fbfcff; }
.item-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; user-select: none; }
.item-head:hover { background: #f3f5fc; }
.item-head .title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-head .thumb { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: #e8eaf4; }
.item-head .chev { color: var(--muted); transition: transform .2s; }
.item.open .chev { transform: rotate(90deg); }
.item-body { display: none; padding: 16px; border-top: 1px solid var(--border); }
.item.open .item-body { display: block; }
.item-tools { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 9px; padding: 10px 16px; font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; }
.btn-primary { background: linear-gradient(100deg, #6366f1, #06b6d4); color: #fff; }
.btn-secondary { background: #e8eaf6; color: var(--text); }
.btn-secondary:hover { background: #dde0f2; }
.btn-danger { background: #fde8e8; color: #b91c1c; }
.btn-danger:hover { background: #fbd5d5; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-add { border: 1.5px dashed var(--accent); color: var(--accent); background: rgba(99,102,241,.05); width: 100%; justify-content: center; padding: 12px; }
.btn-add:hover { background: rgba(99,102,241,.1); }

/* save bar */
.savebar {
  position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--border);
  padding: 12px 24px; display: flex; justify-content: flex-end; gap: 12px; box-shadow: 0 -6px 24px rgba(12,18,48,.07); z-index: 90;
}
.savebar .dirty-note { margin-right: auto; align-self: center; color: var(--muted); font-size: .85rem; }

/* image picking */
.img-field { display: flex; align-items: center; gap: 12px; }
.img-field img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); background: #eee; }
.img-field .img-name { font-size: .82rem; color: var(--muted); flex: 1; word-break: break-all; }
.img-picker-overlay { position: fixed; inset: 0; background: rgba(10,14,30,.6); z-index: 200; display: grid; place-items: center; padding: 20px; }
.img-picker { background: #fff; border-radius: 16px; width: min(860px, 96vw); max-height: 86vh; display: flex; flex-direction: column; overflow: hidden; }
.img-picker header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.img-picker .close { background: none; border: 0; font-size: 1.1rem; cursor: pointer; color: var(--muted); }
.picker-upload { padding: 12px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; }
.upload-btn { display: inline-block; padding: 9px 16px; background: #e8eaf6; border-radius: 9px; font-weight: 600; font-size: .85rem; cursor: pointer; }
.upload-status { font-size: .82rem; color: var(--muted); }
.picker-grid { overflow-y: auto; padding: 16px 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.picker-grid button { border: 2px solid transparent; border-radius: 10px; padding: 0; cursor: pointer; background: none; overflow: hidden; }
.picker-grid button:hover { border-color: var(--accent); }
.picker-grid img { width: 100%; height: 90px; object-fit: cover; display: block; }
.picker-grid figcaption { font-size: .68rem; color: var(--muted); padding: 3px 4px; word-break: break-all; text-align: left; }

/* images tab grid */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.lib-grid figure { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.lib-grid img { width: 100%; height: 110px; object-fit: cover; display: block; }
.lib-grid figcaption { font-size: .7rem; color: var(--muted); padding: 6px 8px; word-break: break-all; }

/* toast */
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 99px; font-size: .9rem; z-index: 300; box-shadow: 0 14px 30px rgba(0,0,0,.3); }
.toast.error { background: #b91c1c; }

@media (max-width: 720px) { .row, .row3 { grid-template-columns: 1fr; } }
