/* MaFel Hub — base layout and component styles. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- App shell ------------------------------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  min-height: 100vh;
}

.app-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.app-header h1 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.01em;
}

.app-sidebar {
  grid-area: sidebar;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.app-sidebar .brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2);
}
.app-sidebar .brand img { height: 40px; width: auto; max-width: 100%; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: block;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-weight: 500;
}
.nav a:hover { background: var(--bg-inset); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }

.app-main {
  grid-area: main;
  padding: var(--sp-6);
  overflow-x: hidden;
}

/* --- Panels ---------------------------------------------------------- */

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow);
}

.panel-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 var(--sp-3);
}

/* --- Theme toggle ---------------------------------------------------- */

.icon-btn {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  font: inherit;
}
.icon-btn:hover { border-color: var(--accent); }

/* --- Status semaphore ------------------------------------------------ */

.dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--status-ok);
  vertical-align: middle;
}
.dot.ok { background: var(--status-ok); }
.dot.warn { background: var(--status-warn); }
.dot.crit { background: var(--status-crit); }

/* Online pulse */
.dot.live { position: relative; }
.dot.live::after {
  content: "";
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  color: var(--status-ok);
  opacity: 0.6;
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.7); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dot.live::after { animation: none; }
}

/* --- Login ----------------------------------------------------------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow);
}
.login-card img { height: 34px; margin-bottom: var(--sp-5); }
.field { margin-bottom: var(--sp-4); }
.field label { display: block; font-size: 0.82rem; color: var(--text-muted); margin-bottom: var(--sp-1); }
.field input {
  width: 100%;
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-inset);
  color: var(--text);
  font: inherit;
}
.btn {
  display: inline-block;
  width: 100%;
  padding: var(--sp-3);
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.06); }
.btn.secondary { background: var(--bg-inset); color: var(--text); border: 1px solid var(--border); }

.messages { list-style: none; padding: 0; margin: 0 0 var(--sp-4); }
.messages li {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: var(--sp-2);
  font-size: 0.88rem;
}

@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; grid-template-areas: "header" "main"; }
  .app-sidebar { display: none; }
}
