/* UC Platform Admin Portal — Custom styles layered on Pico CSS */

:root {
  --uc-brand: #2563eb;
  --uc-brand-light: #eff6ff;
  --uc-success: #16a34a;
  --uc-warning: #d97706;
  --uc-danger:  #dc2626;
  --uc-muted:   #6b7280;
  --uc-surface: #f8fafc;
  --uc-border:  #e2e8f0;
  --nav-height: 56px;
}

/* ── Navigation ──────────────────────────────────────────────── */
.top-nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 0;
  height: var(--nav-height);
  background: #1e293b;
  padding: 0 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

.nav-brand {
  display: flex; align-items: center; gap: .5rem;
  color: #f1f5f9; font-size: .95rem;
  text-decoration: none; flex-shrink: 0;
  margin-right: 2rem;
}
.brand-icon { font-size: 1.2rem; }

.nav-links { display: flex; gap: .25rem; flex: 1; }
.nav-links a {
  color: #94a3b8; text-decoration: none;
  padding: .4rem .8rem; border-radius: 6px;
  font-size: .875rem; transition: all .15s;
}
.nav-links a:hover, .nav-links a.active {
  color: #f1f5f9; background: rgba(255,255,255,.08);
}
.nav-links a.active { color: #fff; font-weight: 600; }

.nav-user { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.user-badge {
  font-size: .8rem; color: #94a3b8;
  background: rgba(255,255,255,.07); padding: .2rem .6rem; border-radius: 4px;
}
.logout-link { font-size: .8rem; color: #64748b; text-decoration: none; }
.logout-link:hover { color: #f87171; }

/* ── Layout ──────────────────────────────────────────────────── */
main.container-fluid { padding: 1.5rem 2rem; max-width: 1400px; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--uc-border);
}
.page-header h1 { margin: 0; font-size: 1.4rem; font-weight: 700; }

footer {
  text-align: center; padding: 1rem;
  color: var(--uc-muted); font-size: .8rem;
  border-top: 1px solid var(--uc-border); margin-top: 2rem;
}

/* ── Stat cards (dashboard) ──────────────────────────────────── */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff; border: 1px solid var(--uc-border);
  border-radius: 10px; padding: 1.1rem 1.25rem;
  display: flex; flex-direction: column; gap: .3rem;
}
.stat-card .label { font-size: .78rem; color: var(--uc-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 2rem; font-weight: 700; line-height: 1.1; color: #1e293b; }
.stat-card .sub   { font-size: .78rem; color: var(--uc-muted); }
.stat-card.accent { border-left: 4px solid var(--uc-brand); }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--uc-border); }
table { margin: 0; border-collapse: collapse; width: 100%; }
thead tr { background: var(--uc-surface); }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--uc-muted); padding: .75rem 1rem !important; }
td { padding: .65rem 1rem !important; font-size: .875rem; vertical-align: middle; border-top: 1px solid var(--uc-border); }
tr:hover td { background: var(--uc-surface); }

/* ── Badges / pills ──────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .15rem .55rem;
  border-radius: 4px; font-size: .72rem; font-weight: 600;
  letter-spacing: .02em; white-space: nowrap;
}
.badge-active  { background: #dcfce7; color: #166534; }
.badge-suspended { background: #fef3c7; color: #92400e; }
.badge-terminated { background: #fee2e2; color: #991b1b; }
.badge-answered { background: #dcfce7; color: #166534; }
.badge-no_answer { background: #fef3c7; color: #92400e; }
.badge-failed, .badge-busy { background: #fee2e2; color: #991b1b; }
.badge-running { background: #dcfce7; color: #166534; }
.badge-exited  { background: #fee2e2; color: #991b1b; }
.badge-ok   { background: #dcfce7; color: #166534; }
.badge-fail  { background: #fee2e2; color: #991b1b; }
.badge-warn  { background: #fef9c3; color: #854d0e; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .9rem;
       border-radius: 6px; font-size: .85rem; font-weight: 500; cursor: pointer;
       text-decoration: none; border: none; transition: all .15s; }
.btn-primary   { background: var(--uc-brand); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: var(--uc-surface); color: #374151; border: 1px solid var(--uc-border); }
.btn-secondary:hover { background: var(--uc-border); }
.btn-danger    { background: #fee2e2; color: var(--uc-danger); border: 1px solid #fca5a5; }
.btn-danger:hover { background: #fca5a5; }
.btn-sm { padding: .25rem .6rem; font-size: .78rem; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-card {
  background: #fff; border: 1px solid var(--uc-border);
  border-radius: 10px; padding: 1.5rem; max-width: 640px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .75rem; }
.field label { font-size: .82rem; font-weight: 600; color: #374151; }
.field input, .field select, .field textarea {
  padding: .45rem .7rem; border: 1px solid var(--uc-border);
  border-radius: 6px; font-size: .875rem;
  background: #fff; color: #1e293b;
}
.field input:focus, .field select:focus { border-color: var(--uc-brand); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.field .hint { font-size: .75rem; color: var(--uc-muted); }
.error-msg { color: var(--uc-danger); font-size: .85rem; padding: .5rem .75rem; background: #fee2e2; border-radius: 6px; margin-bottom: 1rem; }

/* ── Filter bar ──────────────────────────────────────────────── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end;
  background: var(--uc-surface); border: 1px solid var(--uc-border);
  border-radius: 10px; padding: .85rem 1rem; margin-bottom: 1rem;
}
.filter-bar .field { margin: 0; }
.filter-bar input, .filter-bar select {
  height: 34px; box-sizing: border-box;
  padding: 0 .6rem; border: 1px solid var(--uc-border);
  border-radius: 6px; font-size: .82rem; min-width: 140px; background: #fff;
}
.filter-bar .btn { height: 34px; box-sizing: border-box; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-top: 1rem; }
.pagination a, .pagination span {
  padding: .3rem .7rem; border-radius: 6px; font-size: .82rem;
  border: 1px solid var(--uc-border); text-decoration: none; color: #374151;
}
.pagination a:hover { background: var(--uc-brand-light); border-color: var(--uc-brand); }
.pagination .current { background: var(--uc-brand); color: #fff; border-color: var(--uc-brand); }

/* ── Grid panels ─────────────────────────────────────────────── */
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.panel {
  background: #fff; border: 1px solid var(--uc-border);
  border-radius: 10px; padding: 1.1rem 1.25rem;
}
.panel h3 { font-size: .9rem; font-weight: 700; margin-bottom: .85rem; color: #1e293b; }
.panel-full { grid-column: 1 / -1; }

/* ── Nav dropdown (CSS-only hover) ───────────────────────────── */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  display: none;
  position: absolute; top: calc(100% + 2px); left: 0;
  background: #1e293b; border: 1px solid #334155;
  border-radius: 8px; padding: .4rem;
  min-width: 170px; z-index: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown-menu:hover {
  display: block;
}
.nav-dropdown-menu a {
  display: block; padding: .4rem .8rem;
  color: #cbd5e1; font-size: .82rem; text-decoration: none;
  border-radius: 5px; transition: all .12s; white-space: nowrap;
}
.nav-dropdown-menu a:hover { background: rgba(255,255,255,.1); color: #f1f5f9; }

/* ── Checkbox field ──────────────────────────────────────────── */
.field-check {
  display: flex; flex-direction: row; align-items: center;
  gap: .5rem; margin-bottom: .75rem;
}
.field-check input[type="checkbox"] {
  width: 16px; height: 16px; padding: 0; margin: 0;
  cursor: pointer; flex-shrink: 0; accent-color: var(--uc-brand);
}
.field-check label { font-weight: 400; margin: 0; cursor: pointer; font-size: .875rem; }

/* ── Login page ──────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}
.login-card {
  background: #fff; border-radius: 14px; padding: 2.5rem;
  width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo .icon { font-size: 2.5rem; }
.login-logo h2 { margin: .4rem 0 0; font-size: 1.15rem; color: #1e293b; }
.login-logo small { color: var(--uc-muted); font-size: .8rem; }

/* ── Container list ──────────────────────────────────────────── */
.container-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .75rem;
}
.container-card {
  border: 1px solid var(--uc-border); border-radius: 8px; padding: .75rem 1rem;
  display: flex; align-items: center; gap: .75rem; background: #fff;
}
.container-card .c-name { font-size: .875rem; font-weight: 600; }
.container-card .c-status { font-size: .75rem; color: var(--uc-muted); }
.c-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.c-dot.running { background: var(--uc-success); }
.c-dot.exited, .c-dot.dead { background: var(--uc-danger); }
.c-dot.paused  { background: var(--uc-warning); }

@media (max-width: 768px) {
  .panel-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .top-nav { flex-wrap: wrap; height: auto; padding: .5rem 1rem; }
  .nav-links { flex-wrap: wrap; }
  main.container-fluid { padding: 1rem; }
}
