/* =====================================================================
   MUPI Control - Estilo do painel
   Identidade visual ISPTEC ainda pendente (spec, seccao 10).
   Trocar o acento num unico sitio: --accent.
   ===================================================================== */
:root {
  --accent:        #1f6f8b;   /* acento provisorio */
  --accent-strong: #17566d;
  --bg:            #f4f6f8;
  --surface:       #ffffff;
  --ink:           #1c2530;
  --ink-soft:      #5b6b7b;
  --line:          #e2e8ee;
  --ok:            #1f9d55;
  --off:           #b0b8c1;
  --warn:          #c9791f;
  --danger:        #c0392b;
  --radius:        10px;
  --shadow:        0 1px 3px rgba(20,35,50,.08), 0 1px 2px rgba(20,35,50,.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}

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

/* ---- Estrutura ------------------------------------------------------ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  background: var(--ink);
  color: #cdd7e0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar .brand {
  padding: 20px 22px;
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  letter-spacing: .2px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand small {
  display: block;
  font-weight: 400;
  font-size: 11.5px;
  color: #8ea0b0;
  margin-top: 3px;
}
.nav { padding: 12px 0; flex: 1; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 22px;
  color: #cdd7e0;
  font-size: 14.5px;
}
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.nav a.active {
  background: rgba(255,255,255,.10);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav a.disabled { opacity: .45; pointer-events: none; }
.nav a .soon {
  margin-left: auto;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #8ea0b0;
}
.sidebar .foot {
  padding: 14px 22px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 13px;
}
.sidebar .foot .who { color: #fff; font-weight: 600; }
.sidebar .foot .role { color: #8ea0b0; font-size: 12px; }
.sidebar .foot a { color: #cdd7e0; font-size: 13px; }

.main { flex: 1; min-width: 0; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 { margin: 0; font-size: 19px; }
.content { padding: 26px 28px; }

/* ---- Cartoes / grelha ---------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat .n { font-size: 28px; font-weight: 700; line-height: 1; }
.stat .l { color: var(--ink-soft); font-size: 13px; margin-top: 6px; }
.stat.ok .n  { color: var(--ok); }
.stat.off .n { color: var(--off); }

.section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--ink);
}

.screens {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.screen-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.screen-card .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.screen-card .name { font-weight: 700; font-size: 15px; }
.screen-card .loc { color: var(--ink-soft); font-size: 13px; }
.screen-card .meta {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
}
.screen-card .slug { font-family: ui-monospace, "Cascadia Code", Menlo, monospace; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}
.badge::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.badge.on  { color: var(--ok);  background: rgba(31,157,85,.10); }
.badge.off { color: var(--off); background: rgba(176,184,193,.16); }

/* ---- Login ---------------------------------------------------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(31,111,139,.18), transparent),
    var(--bg);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(20,35,50,.10);
  padding: 30px 28px;
}
.login-card h1 { margin: 0 0 2px; font-size: 20px; }
.login-card .sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 22px; }

label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
input[type="text"], input[type="password"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31,111,139,.15);
}
.btn {
  display: inline-block;
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--accent-strong); }

.alert {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 4px;
}
.alert.error { background: rgba(192,57,43,.10); color: var(--danger); }
.alert.warn  { background: rgba(201,121,31,.12); color: var(--warn); }

@media (max-width: 720px) {
  .sidebar { width: 64px; }
  .sidebar .brand small, .nav a span.txt, .sidebar .foot .role { display: none; }
  .nav a .soon { display: none; }
}

/* ---- Modulo Utilizadores / paineis de formulario -------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 22px;
}
.card h3 { margin: 0 0 14px; font-size: 15px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px 16px;
  align-items: end;
}
.form-grid label { margin: 0 0 6px; }
select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
}
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31,111,139,.15);
}
.field-hint { font-size: 12px; color: var(--ink-soft); margin-top: 5px; }

.btn-inline {
  display: inline-block;
  width: auto;
  margin: 0;
  padding: 10px 16px;
  font-size: 14px;
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg); color: var(--ink); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--ink-soft);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table .actions { display: flex; gap: 8px; justify-content: flex-end; }
.table .actions a, .table .actions button {
  font-size: 13px;
  padding: 6px 11px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  width: auto;
  margin: 0;
  font-weight: 600;
}
.table .actions a:hover, .table .actions button:hover { background: var(--bg); text-decoration: none; }
.table .actions .danger { color: var(--danger); border-color: rgba(192,57,43,.25); }
.table .actions .danger:hover { background: rgba(192,57,43,.08); }

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}
.pill.admin  { color: var(--accent); background: rgba(31,111,139,.10); }
.pill.editor { color: var(--ink-soft); background: rgba(91,107,123,.10); }
.pill.on     { color: var(--ok);   background: rgba(31,157,85,.10); }
.pill.off    { color: var(--danger); background: rgba(192,57,43,.10); }

.alert.ok { background: rgba(31,157,85,.10); color: var(--ok); }
.you-tag { font-size: 11px; color: var(--ink-soft); margin-left: 6px; }

/* ---- Biblioteca de conteudos --------------------------------------- */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}
.media-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.media-card.is-archived { opacity: .6; }
.thumb {
  position: relative;
  aspect-ratio: 9 / 16;
  background: #0d1117;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.thumb img, .thumb video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.thumb .play {
  position: absolute;
  color: #fff;
  font-size: 30px;
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
  pointer-events: none;
}
.type-badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(13,17,23,.72);
  color: #fff; font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
}
.arch-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(192,57,43,.85);
  color: #fff; font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
}
.media-body { padding: 10px 12px 12px; }
.title-form input {
  width: 100%;
  padding: 6px 8px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
}
.title-form input:hover { border-color: var(--line); }
.title-form input:focus {
  outline: none; background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31,111,139,.15);
}
.media-meta { font-size: 12px; color: var(--ink-soft); margin: 4px 4px 10px; }
.media-actions { display: flex; gap: 8px; }
.media-actions button {
  flex: 1;
  font-size: 13px;
  padding: 7px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
}
.media-actions button:hover { background: var(--bg); }
.media-actions .danger { color: var(--danger); border-color: rgba(192,57,43,.25); }
.media-actions .danger:hover { background: rgba(192,57,43,.08); }

/* ---- Editor de playlist -------------------------------------------- */
.pl-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.pl-item:last-child { border-bottom: 0; }
.pl-thumb {
  width: 42px; height: 74px;
  border-radius: 6px; overflow: hidden;
  background: #0d1117; flex-shrink: 0;
}
.pl-thumb img, .pl-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl-info { flex: 1; min-width: 0; }
.pl-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-type { font-size: 12px; color: var(--ink-soft); }
.pl-move { display: flex; flex-direction: column; gap: 4px; }
button.mini {
  font-size: 12px; padding: 5px 9px; border-radius: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  cursor: pointer; font-weight: 600; width: auto; margin: 0;
}
button.mini:hover:not(:disabled) { background: var(--bg); }
button.mini:disabled { opacity: .4; cursor: default; }
button.mini.danger { color: var(--danger); border-color: rgba(192,57,43,.25); }
input[type="number"] {
  padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px;
  font-size: 14px; font-family: inherit;
}
