/*
 * Portal skin: reuses Jet's admin styles (vendor.css + theme base.css) and adds
 * only the bits the portal needs, so it matches the Django admin look.
 * Jet palette: sidebar #354052, contrast #2b3647, accent #47bac1, hover #639af5.
 */

/* Jet hides the page title inside #content; show it. */
#content > h1 { display: block; }

/* ---- Header / top bar ---- */
#branding {
  text-align: left;
  padding: 0 20px;
  min-height: 52px;
  line-height: 52px;
}
#branding h1#site-name,
#branding h1#site-name a {
  font-size: 16px;
  text-transform: none;
  font-weight: 300;
  letter-spacing: 0.5px;
  vertical-align: middle;
}
#branding .portal-nav-toggle {
  display: none;
  cursor: pointer;
  font-size: 20px;
  margin-right: 12px;
  vertical-align: middle;
  color: #c0cad8;
}

#user-tools { position: absolute; top: 0; right: 0; }
.portal-user {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 52px;
  padding: 0 20px;
  color: #c0cad8;
  font-size: 12px;
}
.portal-user a { color: #c0cad8; }
.portal-user a:hover { color: #fff; }
.portal-user-name { font-weight: bold; }
.portal-logout button {
  background: none;
  border: 0;
  color: #c0cad8;
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.portal-logout button:hover { color: #fff; }

/* ---- Page head ---- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 20px;
}
.page-head h1 { margin: 0; }
.page-head .btn { margin-left: 6px; }

/* ---- Cards as admin "modules" ---- */
.card {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 0 0 #d0dbe6;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.card.narrow { max-width: 520px; }
.card h2 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.cards { display: flex; flex-wrap: wrap; gap: 20px; }
.card.stat { min-width: 170px; text-align: center; padding: 18px 24px; }
.stat-value { display: block; font-size: 30px; font-weight: 300; color: #6f7e95; }
.stat-label { display: block; text-transform: uppercase; font-size: 11px; font-weight: bold; color: #6f7e95; }
a.card { text-decoration: none; }
a.card:hover { box-shadow: 0 2px 0 0 #639af5; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }

/* ---- Buttons (mirror Jet's .button) ---- */
.btn {
  display: inline-block;
  background: #d0dbe6;
  color: #6f7e95;
  border: 0;
  border-radius: 4px;
  height: 32px;
  line-height: 32px;
  font-size: 12px;
  padding: 0 12px;
  cursor: pointer;
  text-decoration: none;
  vertical-align: middle;
  transition: background 0.3s, color 0.3s;
}
.btn:hover, .btn:focus { background: #639af5; color: #fff; }
.btn.primary { background: #47bac1; color: #fff; text-transform: uppercase; padding: 0 20px; font-weight: lighter; }
.btn.primary:hover { background: #639af5; }
.btn.danger { background: #c14747; color: #fff; }
.btn.danger:hover { background: #639af5; }

/* ---- Tables: Jet styles bare <table>; just make them full width ---- */
.table { width: 100%; }

/* ---- Forms ---- */
.card p label { display: block; font-weight: bold; margin-bottom: 3px; }
.card input[type="text"], .card input[type="password"], .card input[type="email"],
.card input[type="number"], .card input[type="datetime-local"], .card textarea, .card select {
  width: 100%;
  max-width: 520px;
}
.card .helptext, .help { color: #d0dbe6; font-size: 12px; }
.check { display: block; margin: 4px 0; }

.filter { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.inline-form { display: inline; }
.muted { color: #6f7e95; }

.pagination { display: flex; gap: 16px; align-items: center; margin-top: 12px; }

/* ---- Monitoring chart ---- */
.chart-head { display: flex; align-items: center; justify-content: space-between; }
.chart-head h2 { margin: 0; }
.chart-legend { margin-top: 8px; font-size: 12px; color: #6f7e95; }
.chart-legend .legend {
  display: inline-block; width: 12px; height: 12px; border-radius: 2px;
  vertical-align: middle; margin: 0 4px 0 12px;
}
.chart-legend .legend-l1 { background: #47bac1; }
.chart-legend .legend-l5 { background: #639af5; }
.chart-legend .legend-l15 { background: #c0cad8; }
.chart-legend .legend-cpu { background: #639af5; }
.warn-text { color: #d49d9d; font-weight: bold; }
.danger-text { color: #c14747; font-weight: bold; }

/* ---- Service status pills ---- */
.service-list { display: flex; flex-wrap: wrap; gap: 10px; }
.service-item {
  display: flex; align-items: center; gap: 8px;
  background: #f6fafc; border-radius: 4px; padding: 6px 10px;
}
.service-name { font-weight: bold; min-width: 120px; }
.service-pill {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: bold;
}
.service-pill.is-active { background: #c4ecc5; color: #4c8a4c; }
.service-pill.is-inactive { background: #f0dada; color: #b36060; }
.service-actions { display: flex; gap: 4px; }
.service-actions .btn { height: 26px; line-height: 26px; padding: 0 8px; font-size: 11px; }

/* ---- Alerts ---- */
.alert-list { margin: 0 0 16px; }
.alert {
  padding: 10px 14px; border-radius: 6px; margin-bottom: 8px;
  background: #e8e8bd; color: #b9b97f;
}
.alert-warning { background: #f0dada; color: #d49d9d; }
.alert-critical { background: #c14747; color: #fff; }

/* ---- Range buttons ---- */
.range-buttons { margin-bottom: 10px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Dashboard ---- */
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Bulk actions ---- */
.bulk-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.bulk-actions select { height: 32px; }

/* ---- Aliases / log viewer ---- */
.alias-list { list-style: none; padding: 0; margin: 0 0 10px; }
.alias-list li { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.card pre { max-height: 520px; overflow: auto; }

/* ---- Notifications / search ---- */
.badge {
  display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 9px;
  background: #c14747; color: #fff; font-size: 11px; text-align: center;
}
tr.unread td { font-weight: bold; }
.portal-search input[type="text"] {
  border: 0; border-radius: 4px; padding: 5px 8px; font-size: 12px;
  background: #2b3647; color: #c0cad8; width: 160px;
}

/* ---- File manager ---- */
.crumbs { margin-bottom: 12px; font-size: 13px; }
.file-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.file-actions input[type="text"] { width: 180px; }
.file-actions input[type="file"] { color: #6f7e95; }

pre { white-space: pre-wrap; word-break: break-word; }

/* Fallback message styling if Jet's messagelist isn't applied */
.messages { list-style: none; padding: 0; }
.messages li { padding: 10px; border-radius: 6px; margin: 0 20px 10px; background: #e8e8bd; }

/* ---- Responsive sidebar toggle ---- */
@media (max-width: 960px) {
  #branding .portal-nav-toggle { display: inline-block; }
  #branding { text-align: left; }
}
