/* ===== Base layout ===== */

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: #020617; /* plain dark */
  color: #e5e7eb;
  min-height: 100vh;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* ===== Header ===== */

.site-header {
  width: 100%;
  background-color: #7ea253;
}

.site-header .header-inner {
  width: 100%;
  margin: 0 auto;

  /* MATCH transcript header height */
  padding: 10px 16px;
  min-height: 64px;

  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.site-header .logo {
  height: 40px;
  width: auto;
  display: block;
}

/* Center text behaves like transcript site (centered, no forced extra height) */
.site-header .header-text {
  min-width: 0;
  text-align: center;
  line-height: 1.2;
}

.site-header .site-title {
  color: #fff;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.1px;
  margin: 0 8px 2px;

  /* keep tidy if narrow */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-header .site-link a {
  color: #cce8c1;
  font-size: 0.94rem;
  font-weight: 500;
  text-decoration: none;
  opacity: 0.95;

  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-header .site-link a:hover {
  text-decoration: underline;
  opacity: 1;
}

/* ===== Header alignment on logged-out pages =====
   When not signed in, we still show the logo on the left.
   This centers the title block to the page/login form instead of being offset by the logo width.
*/
.role-anon .site-header .header-inner {
  position: relative;
}

.role-anon .site-header .header-text {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 120px));
}

/* ===== Header right actions ===== */

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.95rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  row-gap: 8px;
}

.top-actions a {
  color: #f9fafb;
  opacity: 0.95;
  font-weight: 700;
  white-space: nowrap;
}

.top-actions a:hover {
  opacity: 1;
  text-decoration: underline;
}

.top-actions .logout-btn {
  background: rgba(2, 6, 23, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: none;
  padding: 8px 12px;
  font-weight: 700;
  white-space: nowrap;
}

.top-actions .logout-btn:hover {
  filter: none;
  background: rgba(2, 6, 23, 0.32);
}

@media (max-width: 720px) {
   .role-anon .site-header .header-text {
    position: static;
    transform: none;
    width: auto;
  }
  
  .site-header .header-inner {
    /* stack logo + title + link vertically */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 12px 12px;
    min-height: unset;
    row-gap: 6px; /* harmless even in flex */
    gap: 6px;
  }

  .site-header .brand {
    display: inline-flex;
    justify-content: center;
  }

  .site-header .logo {
    height: 34px;
  }

  .site-header .header-text {
    min-width: 0;
    text-align: center;
    line-height: 1.15;
  }

  .site-header .site-title {
    font-size: 1.05rem;   /* slightly smaller to avoid collisions */
    margin: 0 0 2px 0;
    white-space: normal;  /* allow wrap */
    overflow: visible;
    text-overflow: clip;
  }

  .site-header .site-link a {
    font-size: 0.9rem;
    white-space: normal;  /* allow wrap */
    overflow: visible;
    text-overflow: clip;
  }

  .top-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
  }
}


/* ===== Global links ===== */

a {
  color: #a3e635;
  font-weight: 500;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===== Page container ===== */

.page {
  width: 100%;
  max-width: 1000px;
  margin: 18px auto 28px auto;
  padding: 0 16px;
  box-sizing: border-box;
}

/* Admin pages can be wider to keep controls on one line */
.role-admin .page {
  max-width: 1400px;
}

/* ===== Cards ===== */

.card {
  border: 1px solid rgba(55, 65, 81, 0.9);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  background: #0b1220;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7);
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stat {
  flex: 1;
  min-width: 220px;
}

.muted {
  color: #9ca3af;
}

/* ===== Admin feedback banners ===== */
.flash {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(2, 6, 23, 0.35);
}

.flash.success {
  border-color: rgba(190, 242, 100, 0.35);
  background: rgba(22, 163, 74, 0.12);
  color: #bbf7d0;
}

.flash.error {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
}

/* ===== Inputs ===== */

input, select {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  width: 100%;
  background: #020617;
  color: #e5e7eb;
  box-sizing: border-box;
  outline: none;
}

input:focus, select:focus {
  border-color: rgba(126, 162, 83, 0.85);
  box-shadow: 0 0 0 3px rgba(126, 162, 83, 0.20);
}

/* ===== Buttons ===== */

button {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(190, 242, 100, 0.5);
  background: linear-gradient(135deg, #7ea253, #4d7c0f);
  color: #f9fafb;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(22, 101, 52, 0.75);
}

button:hover {
  filter: brightness(1.05);
}

/* ===== Login layout helpers ===== */

.login-page {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.login-wrap {
  width: 100%;
  max-width: 420px;
  margin-top: 32px;
}

.error {
  color: #fecaca;
  margin-top: 12px;
}

.note {
  text-align: center;
  font-style: italic;
  font-size: 12px;
  color: #9ca3af;
  margin: 6px 0 18px 0;
}

/* === Make header consistently tall like transcript site (no wrapping surprises) === */
/* === Desktop-only header height + no-wrap actions === */
@media (min-width: 721px) {
  .site-header .header-inner {
    min-height: 110px;
    padding: 12px 16px;
    align-items: center;
  }

  .top-actions {
    flex-wrap: nowrap;
  }

  .site-header .logo {
    height: 40px;
  }
}


/* Login: give the Sign in button breathing room */
.login-wrap form button {
  margin-top: 12px;
}


.login-wrap form input {
  margin-top: 6px;
  margin-bottom: 10px;
}