/* =========================================================
   Matematikrevyen – Shared Stylesheet
   ========================================================= */

/* --- Reset & base ---------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  line-height: 1.6;
  color: #1f2328;
  background: #ffffff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Site header / navigation ---------------------------- */
.site-header {
  background: #1f2328;
  color: #ffffff;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-title {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: #ffffff;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  color: #c9d1d9;
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
}

.site-nav a.active {
  background: rgba(255,255,255,0.15);
  color: #ffffff;
  font-weight: 500;
}

.site-nav-locked {
  color: #6e7681;
  padding: 0.35rem 0.75rem;
  font-size: 0.9rem;
  cursor: not-allowed;
  user-select: none;
}

/* --- Login button / modal --------------------------------- */
.site-auth {
  margin-left: auto;
}

.site-login-btn {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.site-login-btn:hover {
  background: rgba(255,255,255,0.2);
}

.site-gate-login {
  background: #3b82d4;
  border: none;
  margin-top: 0.5rem;
}

.site-gate-login:hover {
  background: #2f6cb3;
}

.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.login-modal {
  background: #ffffff;
  border-radius: 8px;
  padding: 1.5rem;
  width: min(340px, 90vw);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.login-modal h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.login-modal p {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.login-modal input[type="password"] {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.login-error {
  color: #c0392b;
  font-size: 0.82rem;
  min-height: 1.2em;
  margin-top: 0.4rem;
}

.login-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.site-btn-primary,
.site-btn-secondary {
  border-radius: 6px;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
}

.site-btn-primary {
  background: #3b82d4;
  color: #ffffff;
  border: none;
}

.site-btn-primary:hover { background: #2f6cb3; }
.site-btn-primary:disabled { opacity: 0.6; cursor: default; }

.site-btn-secondary {
  background: #ffffff;
  color: #1f2328;
  border: 1px solid #d0d7de;
}

.site-btn-secondary:hover { background: #f0f2f5; }

/* --- Main content ---------------------------------------- */
.page-content {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-content h1 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: #1f2328;
}

.page-content h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #1f2328;
}

/* --- Card ------------------------------------------------ */
.card {
  background: #f7f8fa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.card ul {
  padding-left: 1.2rem;
}

/* --- Edit modal (site-utils.js siteOpenEditModal) --------- */
.edit-modal {
  width: min(480px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
}

.edit-field {
  margin-bottom: 0.75rem;
}

.edit-field label {
  display: block;
  font-size: 0.8rem;
  color: #57606a;
  margin-bottom: 0.25rem;
}

.edit-field input,
.edit-field textarea,
.edit-field select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #ffffff;
  color: #1f2328;
}

.edit-field textarea {
  min-height: 90px;
  resize: vertical;
}

.edit-field-row {
  display: flex;
  gap: 0.75rem;
}

.edit-field-row > .edit-field {
  flex: 1;
}

.edit-actions-left {
  margin-right: auto;
}

/* --- Card header + small admin buttons -------------------- */
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.card-head h2 {
  margin-bottom: 0;
}

.btn-small {
  background: #ffffff;
  color: #1f2328;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.btn-small:hover { background: #f0f2f5; }

.btn-small-danger {
  color: #c0392b;
  border-color: #e0b4ae;
}

.btn-small-danger:hover { background: #fbf1f0; }

/* --- Messages -------------------------------------------- */
.message-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  border-left: 3px solid #3b82d4;
  padding-left: 0.75rem;
}

.message-meta {
  font-size: 0.8rem;
  color: #57606a;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.message-badge {
  background: #eaf1fb;
  color: #2f6cb3;
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  font-size: 0.72rem;
  white-space: nowrap;
}

/* --- Footer ---------------------------------------------- */
.site-footer {
  text-align: center;
  padding: 1.25rem;
  font-size: 0.8rem;
  color: #57606a;
  border-top: 1px solid #e5e7eb;
  margin-top: auto;
}

/* --- Utility --------------------------------------------- */
p {
  color: #57606a;
  margin-bottom: 0.5rem;
}

p:last-child {
  margin-bottom: 0;
}
