/* ICA Portal Admin — Light utility theme */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=JetBrains+Mono:wght@400;500&family=Epilogue:wght@400;500;600&display=swap');

:root {
  --a-bg:       #f5f4f0;
  --a-surface:  #ffffff;
  --a-border:   #e5e2db;
  --a-text:     #111827;
  --a-muted:    #6b7280;
  --a-accent:   #0ea5e9;
  --a-danger:   #ef4444;
  --a-success:  #22c55e;
  --a-sidebar:  #0d1117;
  --ff-display: 'Syne', sans-serif;
  --ff-mono:    'JetBrains Mono', monospace;
  --ff-body:    'Epilogue', sans-serif;
}

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

body {
  font-family: var(--ff-body);
  background: var(--a-bg);
  color: var(--a-text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Admin layout ─────────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.admin-sidebar {
  width: 256px;
  min-width: 256px;
  background: var(--a-sidebar);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.asb-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid #21262d;
}

.asb-brand {
  font-family: var(--ff-display);
  font-size: 14px;
  font-weight: 700;
  color: #f9fafb;
}

.asb-brand-sub {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: #6b7280;
  letter-spacing: .04em;
  margin-top: 2px;
}

.asb-label {
  font-family: var(--ff-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #4b5563;
  padding: 14px 20px 6px;
}

.asb-nav { flex: 1; padding: 8px 0; }

.asb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-family: var(--ff-mono);
  font-size: 12px;
  color: #9ca3af;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
  cursor: pointer;
  background: none;
  border-right: none;
  border-top: none;
  border-bottom: none;
  width: 100%;
  text-align: left;
}

.asb-link:hover { color: #f9fafb; background: rgba(255,255,255,.05); }
.asb-link.active { color: #0ea5e9; background: rgba(14,165,233,.08); border-left-color: #0ea5e9; }
.asb-link.danger { color: #f87171; }
.asb-link.danger:hover { color: #ef4444; }

.asb-link svg { width: 14px; height: 14px; flex-shrink: 0; }

.asb-count {
  margin-left: auto;
  font-family: var(--ff-mono);
  font-size: 10px;
  background: rgba(255,255,255,.06);
  padding: 1px 6px;
  border-radius: 10px;
  color: #6b7280;
}

.asb-footer {
  padding: 16px 20px;
  border-top: 1px solid #21262d;
}

/* ── Admin content ────────────────────────────────────────────────── */
.admin-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-topbar {
  background: var(--a-surface);
  border-bottom: 1px solid var(--a-border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-topbar-title {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 700;
}

.admin-topbar-meta {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--a-muted);
}

.admin-body { padding: 32px; flex: 1; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-family: var(--ff-mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }

.btn-primary  { background: var(--a-accent); color: #fff; border-color: var(--a-accent); }
.btn-primary:hover  { background: #0284c7; border-color: #0284c7; }

.btn-secondary { background: var(--a-surface); color: var(--a-text); border-color: var(--a-border); }
.btn-secondary:hover { background: var(--a-bg); }

.btn-danger   { background: var(--a-surface); color: var(--a-danger); border-color: #fca5a5; }
.btn-danger:hover   { background: #fef2f2; border-color: var(--a-danger); }

.btn-ghost    { background: none; border-color: transparent; color: var(--a-muted); }
.btn-ghost:hover    { color: var(--a-text); background: var(--a-bg); }

/* ── Card list (admin view of cards in a section) ─────────────────── */
.section-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.section-panel-title {
  font-family: var(--ff-display);
  font-size: 20px;
  font-weight: 700;
}

.card-list { display: flex; flex-direction: column; gap: 10px; }

.card-list-item {
  background: var(--a-surface);
  border: 1px solid var(--a-border);
  border-radius: 6px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.cli-img {
  width: 52px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--a-bg);
  flex-shrink: 0;
}

.cli-info { flex: 1; min-width: 0; }

.cli-title {
  font-family: var(--ff-display);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cli-url {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--a-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.cli-badge {
  font-family: var(--ff-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--a-bg);
  color: var(--a-muted);
  flex-shrink: 0;
}

.cli-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Empty state ──────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  border: 2px dashed var(--a-border);
  border-radius: 8px;
}
.empty-state svg { width: 40px; height: 40px; color: #d1d5db; margin: 0 auto 12px; display: block; }
.empty-state p { font-size: 13px; color: var(--a-muted); margin-bottom: 16px; }

/* ── Toast notifications ──────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: 6px;
  font-family: var(--ff-mono);
  font-size: 12px;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: toastIn .2s ease;
}
.toast.success { background: #16a34a; }
.toast.error   { background: #dc2626; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Modal ────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--a-surface);
  border-radius: 8px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-family: var(--ff-display); font-size: 18px; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--a-muted);
  padding: 4px;
  border-radius: 4px;
  line-height: 0;
  transition: color .12s;
}
.modal-close:hover { color: var(--a-text); }
.modal-close svg { width: 18px; height: 18px; }

.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 20px; display: flex; justify-content: flex-end; gap: 8px; }

/* ── Form ─────────────────────────────────────────────────────────── */
.form-row { margin-bottom: 16px; }
.form-row:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-family: var(--ff-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--a-muted);
  margin-bottom: 5px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 9px 12px;
  background: var(--a-bg);
  border: 1px solid var(--a-border);
  border-radius: 5px;
  font-family: var(--ff-body);
  font-size: 13px;
  color: var(--a-text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--a-accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,.12);
}

.form-textarea { resize: vertical; min-height: 80px; }

.form-hint {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--a-muted);
  margin-top: 4px;
}

/* Color picker */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  appearance: none;
  background-clip: padding-box;
}
.color-swatch:hover          { transform: scale(1.15); }
.color-swatch.selected       { border-color: var(--a-text); }

/* Icon picker */
.icon-picker { display: flex; gap: 8px; flex-wrap: wrap; }

.icon-opt {
  width: 36px;
  height: 36px;
  border: 2px solid var(--a-border);
  border-radius: 6px;
  background: var(--a-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--a-muted);
  transition: border-color .12s, color .12s, background .12s;
}
.icon-opt:hover    { border-color: #d1d5db; color: var(--a-text); }
.icon-opt.selected { border-color: var(--a-accent); color: var(--a-accent); background: rgba(14,165,233,.06); }
.icon-opt svg      { width: 17px; height: 17px; pointer-events: none; }

/* Toggle row */
.toggle-row { display: flex; gap: 8px; }

.toggle-opt {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--a-border);
  border-radius: 5px;
  background: var(--a-bg);
  font-family: var(--ff-mono);
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  transition: border-color .12s, background .12s, color .12s;
  color: var(--a-muted);
}
.toggle-opt.selected { border-color: var(--a-accent); background: rgba(14,165,233,.08); color: var(--a-text); }

/* ── Login page ───────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--a-sidebar);
  padding: 24px;
}

.login-box {
  background: #161d2e;
  border: 1px solid #21262d;
  border-radius: 10px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

.login-logo {
  font-family: var(--ff-display);
  font-size: 20px;
  font-weight: 800;
  color: #f9fafb;
  text-align: center;
  margin-bottom: 4px;
}

.login-sub {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: #6b7280;
  text-align: center;
  letter-spacing: .04em;
  margin-bottom: 32px;
}

.login-label {
  display: block;
  font-family: var(--ff-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #9ca3af;
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  padding: 10px 14px;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 5px;
  font-family: var(--ff-body);
  font-size: 14px;
  color: #f9fafb;
  outline: none;
  transition: border-color .15s;
  margin-bottom: 20px;
}

.login-input:focus { border-color: #0ea5e9; }
.login-input::placeholder { color: #4b5563; }

.login-btn {
  width: 100%;
  padding: 11px;
  background: #0ea5e9;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-family: var(--ff-display);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.login-btn:hover { background: #0284c7; }

.login-error {
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
  font-family: var(--ff-mono);
  font-size: 12px;
  padding: 10px 14px;
  border-radius: 5px;
  margin-bottom: 16px;
  text-align: center;
}

.login-back {
  display: block;
  text-align: center;
  margin-top: 20px;
  font-family: var(--ff-mono);
  font-size: 11px;
  color: #6b7280;
  text-decoration: none;
  transition: color .12s;
}
.login-back:hover { color: #9ca3af; }
