/* Robotradio admin page: dark theme */
:root {
  color-scheme: dark;            /* native form controls and scrollbars in dark */
  --background: #121316;
  --header: #0b0c0e;
  --card: #1c1e22;
  --input: #141518;
  --text: #e6e6e3;
  --muted: #9a9a95;
  --border: #33363c;
  --accent: #c8102e;             /* Nieuwspaal red, for buttons */
  --accent-hover: #e0233f;
  --focus: #ff5c73;
  --error: #ff6b6b;
  --notice-bg: #2a2414;
  --notice-border: #6b5a22;
  --notice-text: #f3e3b0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--background);
  color: var(--text);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--header);
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
header h1 { margin: 0; font-size: 1.15rem; }

main { max-width: 760px; margin: 2rem auto; padding: 0 1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 0 0 1.25rem;
}
.narrow { max-width: 380px; margin: 3rem auto; }

h2 { margin-top: 0; }
legend { font-weight: 600; padding: 0 0.4rem; color: var(--text); }

label { display: block; font-weight: 500; margin-bottom: 0.25rem; }
label.small { font-weight: normal; font-size: 0.9rem; margin-top: 0.35rem; color: var(--muted); }
label.toggle { display: flex; gap: 0.5rem; align-items: center; }

input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font: inherit;
  background: var(--input);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: transparent;
}
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
textarea { font-family: ui-monospace, monospace; }

.field { margin-bottom: 1rem; }
.field small, .save small { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
.field.error input, .field.error textarea, .field.error select { border-color: var(--error); }
.error-message { color: var(--error); font-size: 0.9rem; margin: 0.25rem 0 0; }

button {
  margin-top: 1rem;
  padding: 0.55rem 1.4rem;
  border: 0;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: var(--accent-hover); }
button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button.secondary {
  margin: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.3rem 0.9rem;
}
button.secondary:hover { background: var(--card); }

.notice {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  color: var(--notice-text);
  border-radius: 5px;
  padding: 0.6rem 0.9rem;
}

.save {
  position: sticky;
  bottom: 0;
  background: var(--background);
  padding: 0.5rem 0 1rem;
  border-top: 1px solid var(--border);
}

/* Export / import */
.transfer { margin-top: 1.5rem; }
.transfer h2 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.transfer .warning {
  margin: 0 0 0.6rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--notice-border);
  border-radius: 5px;
  background: var(--notice-bg);
  color: var(--notice-text);
}
.transfer-actions { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.transfer-actions form { margin: 0; }
.import-form { display: flex; gap: 0.6rem; align-items: center; flex: 1; min-width: 18rem; }
.import-form input[type="file"] { flex: 1; }
.import-form button, .transfer-actions button { margin-top: 0; }
.secondary-button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.secondary-button:hover { background: var(--input); }
.recordings p { margin: 0 0 0.6rem; }
.recordings .transfer-actions { align-items: center; }
.recordings label.small { margin-top: 0; }
.transfer small { display: block; margin-top: 0.6rem; color: var(--muted); font-size: 0.85rem; }

/* Master switch at the top */
.master { display: flex; align-items: center; gap: 1.1rem; }
.master form { margin: 0; }
.master h2 { margin: 0 0 0.15rem; font-size: 1.15rem; }
.master small { color: var(--muted); font-size: 0.88rem; }
.master.is-on { border-color: #2f6b3d; }
.master.is-off { border-color: var(--accent); }
.switch {
  position: relative;
  width: 3.6rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input);
  cursor: pointer;
  transition: background 0.2s ease;
}
.switch .knob {
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  background: var(--muted);
  transition: left 0.2s ease, background 0.2s ease;
}
.is-on .switch { background: #2f6b3d; border-color: #3f8a50; }
.is-on .switch .knob { left: 1.85rem; background: #fff; }
.switch:hover { background: var(--card); }
.is-on .switch:hover { background: #377a47; }

/* Latest bulletin: player, regenerate and download */
.bulletin h2 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.bulletin-meta { margin: 0 0 0.5rem; color: var(--muted); }
.bulletin audio { width: 100%; height: 2.4rem; }
/* Regenerate now, Download and Settings: exactly the same size, side by side on one line
   (equal grid columns; on a narrow screen they share the width) */
.bulletin-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 11rem;
  justify-content: start;
  gap: 0.75rem;
  margin: 0.6rem 0 0.4rem;
}
.bulletin-actions > form { display: flex; margin: 0; min-width: 0; }
.bulletin-actions button,
.bulletin-actions a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.6rem;
  border: 1px solid transparent;
  font-size: 1rem;
  line-height: 1.5;
  text-align: center;
  white-space: nowrap;
}
.bulletin-actions a.button.secondary { border-color: var(--border); }
.bulletin small { display: block; color: var(--muted); font-size: 0.85rem; }
a.button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.55rem 1.4rem;
  border-radius: 5px;
  font-weight: 600;
  text-decoration: none;
}
a.button.secondary {
  border: 1px solid var(--border);
  color: var(--text);
  background: transparent;
}
a.button.secondary:hover { background: var(--input); }

/* Progress of "Regenerate now" */
.progress { margin: 0.6rem 0 0.4rem; }
.progress[hidden] { display: none; }
.progress progress {
  width: 100%;
  height: 0.6rem;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--input);
  accent-color: var(--accent);
  overflow: hidden;
}
.progress progress::-webkit-progress-bar { background: var(--input); border-radius: 999px; }
.progress progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; transition: width 0.4s ease; }
.progress progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.progress-text { display: flex; align-items: center; gap: 0.5rem; margin: 0.45rem 0 0; }
.progress-time { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.spinner {
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
button:disabled { opacity: 0.6; cursor: progress; }

/* Volume sliders (dB) */
.slider { display: flex; align-items: center; gap: 0.9rem; }
.slider input[type="range"] {
  flex: 1;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
}
.slider-value {
  min-width: 5.2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Upload fields: current file with a player, then the file chooser */
.current-file {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.current-file audio { width: 100%; height: 2.2rem; }
.current-file label.small { margin-top: 0; }
.no-file { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.9rem; }
input[type="file"] { padding: 0.4rem; cursor: pointer; }
input[type="file"]::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

pre {
  background: var(--input);
  border: 1px solid var(--border);
  padding: 0.6rem;
  border-radius: 5px;
}

/* Navigation */
header h1 a { color: var(--text); text-decoration: none; }
header nav { display: flex; gap: 1.2rem; margin-left: 2rem; margin-right: auto; }
header nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
header nav a:hover { color: var(--text); }
header nav a[aria-current="page"] { color: var(--text); border-bottom: 2px solid var(--accent); }
.breadcrumb { color: var(--muted); margin: 0 0 1rem; }
.breadcrumb a, .bulletin h2 a { color: var(--text); }
.intro-text { color: var(--muted); margin: 0 0 1.25rem; }

/* Bulletin cards (overview and bulletin page) */
.bulletin-head { display: flex; gap: 1rem; align-items: flex-start; }
.bulletin-head form { margin: 0.15rem 0 0; }
.bulletin-head > div { flex: 1; }
.bulletin.is-off { border-color: var(--border); }
.bulletin.is-off h2 a { color: var(--muted); }
.small-switch { width: 2.9rem; height: 1.6rem; }
.small-switch .knob { width: 1.2rem; height: 1.2rem; }
.is-on .small-switch .knob { left: 1.45rem; }

/* Schedule: 24 hour boxes */
.hours { display: grid; grid-template-columns: repeat(12, 1fr); gap: 0.3rem; }
.hours label {
  display: flex; flex-direction: column; align-items: center; gap: 0.1rem;
  font-weight: normal; font-size: 0.85rem; color: var(--muted); margin: 0;
  padding: 0.25rem 0; border: 1px solid var(--border); border-radius: 5px; background: var(--input);
}
.hours label:has(input:checked) { color: var(--text); border-color: #3f8a50; }
.field[hidden] { display: none; }
textarea.long { font-family: inherit; font-size: 0.9rem; line-height: 1.45; }

/* Duplicate or delete a bulletin */
.danger { border-color: #5a2a30; }

/* ---------------------------------------------------------------------------
   Small screens (phones, narrow windows)
   --------------------------------------------------------------------------- */
fieldset { min-width: 0; }                       /* never wider than the screen */
header form button { white-space: nowrap; }
.progress-text .spinner { flex-shrink: 0; }
.progress-time { flex-shrink: 0; white-space: nowrap; }

@media (max-width: 600px) {
  header { flex-wrap: wrap; padding: 0.6rem 1rem; row-gap: 0.45rem; }
  header h1 { font-size: 1.05rem; }
  header nav { order: 3; flex-basis: 100%; margin: 0; gap: 1.5rem; }
  header nav a { padding: 0.15rem 0; }
  header form button.secondary { padding: 0.25rem 0.7rem; font-size: 0.9rem; }

  main { margin: 1rem auto; padding: 0 0.6rem; }
  .card { padding: 1rem; }
  fieldset.card { padding: 0.9rem 1rem 1rem; }

  /* The three bulletin buttons: equal thirds of the row, text may use two lines */
  .bulletin-actions { grid-auto-columns: minmax(0, 1fr); justify-content: stretch; gap: 0.5rem; }
  .bulletin-actions button,
  .bulletin-actions a.button {
    white-space: normal;
    font-size: 0.9rem;
    line-height: 1.25;
    padding: 0.55rem 0.35rem;
  }

  .hours { grid-template-columns: repeat(6, 1fr); }
  .master { gap: 0.9rem; }
  .bulletin-head { gap: 0.75rem; }

  /* Export/import, Delete: one item per line */
  .transfer-actions,
  .recordings .transfer-actions { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .transfer-actions > .import-form { align-self: stretch; }
  .transfer-actions > form { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .import-form { flex-wrap: wrap; min-width: 0; }
  .import-form input[type="file"] { flex-basis: 100%; }

  .save small { display: none; }
}

@media (max-width: 360px) {
  .bulletin-actions button,
  .bulletin-actions a.button { font-size: 0.84rem; padding: 0.5rem 0.25rem; }               /* keeps the sticky Save bar small */
  .save { padding: 0.5rem 0 0.75rem; }
}

/* Account page */
.account h2 { font-size: 1.05rem; margin-bottom: 0.6rem; }
.account h3 { font-size: 1rem; margin: 0 0 0.5rem; }
.account form + form { margin-top: 1rem; }
.account .status.is-on strong { color: #6fcf86; }
.account .status.is-off strong { color: var(--error); }
.account .warning {
  margin: 0 0 0.8rem; padding: 0.5rem 0.75rem; border: 1px solid var(--notice-border);
  border-radius: 5px; background: var(--notice-bg); color: var(--notice-text);
}
.account .off-form { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1.25rem; }
.account .off-form button { display: block; }
.qr { background: #fff; border-radius: 6px; padding: 0.5rem; width: fit-content; margin: 0.5rem 0; }
.qr svg { display: block; width: 220px; height: 220px; }
.small-print { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.inline-form input { width: 9rem; }
.inline-form button { margin-top: 0; }
