/* UCplus Portal Patch 07 – oprydning og legacy-kompatibelt layout
   Formål: ét roligt basissæt, færre CSS-konflikter og bedre testbarhed.
*/

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fafc;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --subtle: #98a2b3;
  --border: #e4e7ec;
  --accent: #2f6fed;
  --accent2: #6957ff;
  --success: #12b76a;
  --warning: #f79009;
  --danger: #f04438;
  --radius: 16px;
  --radius-xl: 24px;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);

  /* Nye navne brugt af portal-laget */
  --uc-bg: var(--bg);
  --uc-bg-2: var(--surface-soft);
  --uc-bg-3: #eef2f7;
  --uc-card: var(--card);
  --uc-card-2: var(--surface-soft);
  --uc-border: var(--border);
  --uc-border-2: #d0d5dd;
  --uc-text: var(--text);
  --uc-muted: var(--muted);
  --uc-subtle: var(--subtle);
  --uc-blue: var(--accent);
  --uc-purple: var(--accent2);
  --uc-green: var(--success);
  --uc-orange: var(--warning);
  --uc-red: var(--danger);
}

* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

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

h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.025em; }
p { margin: 0; }

/* Topnavigation */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  backdrop-filter: blur(14px);
}
.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: .04rem;
  color: var(--text);
  font-size: 1.16rem;
  font-weight: 800;
  min-width: max-content;
}
.nav-logo img { max-height: 30px; width: auto; display: block; }
.logo-uc { color: var(--text); }
.logo-plus { color: var(--accent2); }
.logo-arena { margin-left: .45rem; color: var(--muted); font-weight: 700; }
.nav-links {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: .45rem .75rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 650;
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active {
  background: #eef4ff;
  color: var(--accent);
  text-decoration: none;
}
.nav-user { display: inline-flex; align-items: center; gap: .7rem; min-width: max-content; }
.nav-name { color: var(--muted); font-size: .9rem; }
.btn-logout {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: .48rem .85rem;
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
}
.btn-logout:hover { background: var(--surface-soft); }

/* Generelt layout */
.page, .portal-shell, .arena-module-shell, .admin-content, main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}
.page-sm { width: min(520px, calc(100% - 2rem)); margin: 0 auto; padding: 3rem 0; }

.portal-kicker, .breadcrumb, .kicker {
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .76rem;
  font-weight: 800;
  margin-bottom: .45rem;
}
.portal-title, .page h1, main h1 {
  font-size: clamp(1.9rem, 4vw, 3.1rem);
  margin-bottom: .65rem;
}
.portal-text, .lead, .page > p, main > p {
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 840px;
}

/* Portal */
.portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}
.portal-panel, .card, .stat-card, .kpi-card, .status-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.portal-actions, .hero-actions, .quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: 1.1rem;
}
.portal-action-link, .btn, button.btn, input[type="submit"].btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: .55rem .9rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
}
.portal-action-link:hover, .btn:hover { filter: brightness(.96); text-decoration: none; }
.btn-secondary, .btn-muted { background: #fff; color: var(--text); border-color: var(--border); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-sm { min-height: 34px; padding: .42rem .7rem; font-size: .88rem; }

.portal-grid, .portal-modules, .mode-cards, .card-grid, .module-grid, .dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.portal-module-card, .mode-card, .module-card, a.card {
  display: block;
  min-height: 168px;
  padding: 1.15rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.portal-module-card:hover, .mode-card:hover, .module-card:hover, a.card:hover {
  transform: translateY(-2px);
  border-color: #b2ccff;
  box-shadow: 0 16px 38px rgba(16, 24, 40, .12);
  text-decoration: none;
}
.portal-module-card.is-disabled { opacity: .55; pointer-events: none; }
.portal-module-icon, .mode-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #eef4ff;
  margin-bottom: .9rem;
  font-size: 1.35rem;
}
.portal-module-card h2, .mode-card h2 { font-size: 1.12rem; margin-bottom: .4rem; }
.portal-module-card p, .mode-card p { color: var(--muted); font-size: .95rem; }
.portal-module-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 700;
}
.portal-status, .badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: .18rem .55rem;
  border-radius: 999px;
  background: #f2f4f7;
  color: #475467;
  font-size: .78rem;
  font-weight: 800;
}
.portal-status.is-active, .badge-success { background: #ecfdf3; color: #027a48; }
.badge-info { background: #eef4ff; color: #175cd3; }
.badge-warning { background: #fff6e5; color: #b54708; }
.badge-muted { background: #f2f4f7; color: #667085; }

/* Arena stats */
.arena-stat-list, .stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: .7rem;
}
.arena-stat-list > div, .stat-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: .85rem;
}
.arena-stat-list strong, .stat-value {
  display: block;
  font-size: 1.55rem;
  line-height: 1;
  color: var(--text);
}
.arena-stat-list span, .stat-label { color: var(--muted); font-size: .82rem; font-weight: 650; }

/* Admin */
.admin-layout {
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  gap: 1.25rem;
  width: min(1240px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}
.admin-sidebar, .sidebar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: .8rem;
  align-self: start;
  position: sticky;
  top: 82px;
}
.admin-sidebar a, .sidebar a {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .62rem .72rem;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 650;
}
.admin-sidebar a:hover, .sidebar a:hover, .admin-sidebar a.active, .sidebar a.active {
  background: #eef4ff;
  color: var(--accent);
  text-decoration: none;
}
.admin-content { width: 100%; padding: 0; }
.admin-content h1 { font-size: clamp(1.55rem, 3vw, 2.25rem); margin-bottom: 1rem; }

/* Forms og tabeller */
.form-group { display: grid; gap: .35rem; }
.form-label, label { color: var(--text); font-weight: 750; font-size: .9rem; }
.form-control, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="file"], select, textarea {
  width: 100%;
  min-height: 42px;
  padding: .58rem .72rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
.form-control:focus, input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(47, 111, 237, .16);
  border-color: #84adff;
}
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .8rem .9rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: var(--surface-soft); color: #475467; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fcfcfd; }

.alert, .flash, .notice {
  padding: .85rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  margin-bottom: 1rem;
}
.alert-success, .flash-success { background: #ecfdf3; border-color: #abefc6; color: #027a48; }
.alert-error, .flash-error { background: #fef3f2; border-color: #fecdca; color: #b42318; }

/* Media preview */
.media-preview img, img.media-preview { max-width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--border); }
video, audio { max-width: 100%; }

/* Mobil */
@media (max-width: 880px) {
  .navbar { align-items: flex-start; flex-wrap: wrap; padding: .75rem 1rem; gap: .55rem; }
  .nav-links { order: 3; width: 100%; }
  .nav-user { margin-left: auto; }
  .portal-hero { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; padding-top: 1rem; }
  .admin-sidebar, .sidebar { position: static; display: flex; overflow-x: auto; gap: .35rem; }
  .admin-sidebar a, .sidebar a { min-width: max-content; }
}
@media (max-width: 560px) {
  .page, .portal-shell, .arena-module-shell, main { width: min(100% - 1rem, 1180px); padding-top: 1rem; }
  .portal-panel, .card, .portal-module-card, .mode-card { border-radius: 18px; padding: 1rem; }
  .nav-name { display: none; }
}
