/* Base reset + variables ------------------------------------------- */
:root {
  --brand-primary: #461D7C;
  --brand-on-primary: #FFFFFF;
  --brand-accent: #841617;
  --text-strong: #1F1633;
  --text-neutral: #57416F;
  --text-muted: #8A8F99;
  --bg-base: #F7F5FB;
  --bg-card: #FFFFFF;
  --border-soft: #E0D6F5;
  --danger-bg: #FFF4F4;
  --danger-border: #F2B5B5;
  --danger-text: #7A1F1F;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-base);
  color: var(--text-strong);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand-primary); }
a:hover { text-decoration: underline; }

/* Header ----------------------------------------------------------- */
.app-header {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.app-brand {
  color: inherit;
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.app-brand:hover { text-decoration: none; opacity: 0.9; }
.app-nav {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.app-user {
  color: var(--brand-on-primary);
  opacity: 0.85;
  font-size: 0.9rem;
}
.nav-link {
  color: var(--brand-on-primary);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  opacity: 0.9;
}
.nav-link:hover {
  text-decoration: none;
  background: rgba(255,255,255,0.1);
  opacity: 1;
}
.logout-form { margin: 0; }

/* Main + cards ----------------------------------------------------- */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 1.5rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.card + .card { margin-top: 1.25rem; }
.card h1 { margin: 0 0 0.6rem; font-size: 1.45rem; color: var(--brand-primary); }
.card h2 { margin: 1rem 0 0.5rem; font-size: 1.1rem; color: var(--text-strong); }
.card p { margin: 0.5rem 0; color: var(--text-neutral); line-height: 1.5; }
.card .lead { font-size: 1.05rem; color: var(--text-strong); }
.card .muted { color: var(--text-muted); font-size: 0.92rem; }

/* Forms ------------------------------------------------------------ */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.form-stack label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-strong);
}
.form-stack input[type=text],
.form-stack input[type=email],
.form-stack input[type=password] {
  font: inherit;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: #FFFFFF;
  color: var(--text-strong);
}
.form-stack input:focus {
  outline: 2px solid var(--brand-primary);
  outline-offset: 1px;
  border-color: var(--brand-primary);
}
.form-helptext {
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.form-errors {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  color: var(--danger-text);
  font-size: 0.9rem;
}
.form-errors ul { margin: 0; padding-left: 1.1rem; }

/* Buttons ---------------------------------------------------------- */
.btn {
  font: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.55rem 1.1rem;
  font-weight: 600;
  transition: filter 120ms ease, background-color 120ms ease;
}
.btn-primary {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent;
  color: var(--brand-on-primary);
  border-color: rgba(255,255,255,0.35);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
.btn-block {
  display: block;
  width: 100%;
}
.btn-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Footer ----------------------------------------------------------- */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  padding: 1.25rem 0 2rem;
  font-size: 0.85rem;
}

/* Resource list (slideshows / menus / queues etc.) ----------------- */
.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.card-head-row h1 { margin: 0; }
.resource-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.resource-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #FCFBFE;
}
.resource-row-info { flex: 1; min-width: 0; }
.resource-title {
  display: block;
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--text-strong);
  text-decoration: none;
}
.resource-title:hover { color: var(--brand-primary); text-decoration: underline; }
.resource-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}
.btn-ghost-dark {
  background: transparent;
  color: var(--brand-primary);
  border: 1px solid var(--border-soft);
}
.btn-ghost-dark:hover { background: rgba(70,29,124,0.06); }
.btn-danger {
  background: #B23A3A;
  color: #FFFFFF;
}
.btn-danger:hover { filter: brightness(1.08); }
.card-danger { border-color: var(--danger-border); background: #FFF9F9; }
.flash {
  border-radius: 6px;
  padding: 0.55rem 0.85rem;
  margin: 0.5rem 0;
  font-size: 0.92rem;
}
.flash-success { background: #ECF8EE; border: 1px solid #BCE0C2; color: #1F5C2A; }
.flash-error,
.flash-danger { background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger-text); }
.flash-warning { background: #FFF8E1; border: 1px solid #F0DBA0; color: #6B5A1F; }

.muted-inline { color: var(--text-muted); font-size: 0.85em; }
.form-stack input[type=color] {
  /* Native color picker: shrink the swatch a bit so it doesn't
     dominate the form row. */
  width: 4rem;
  height: 2.2rem;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: #FFFFFF;
}

/* Slide list ------------------------------------------------------- */
.slide-upload {
  margin: 0.5rem 0 1.25rem;
  padding: 0.85rem 0.9rem;
  background: #FBFAFD;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}
.slide-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.slide-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #FFFFFF;
}
.slide-row-inactive { opacity: 0.55; background: #F5F4F8; }
.slide-thumb {
  flex: 0 0 96px;
  width: 96px;
  height: 64px;
  border-radius: 5px;
  overflow: hidden;
  background: #1F1633;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slide-thumb img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.slide-thumb-missing {
  color: #FFFFFF;
  opacity: 0.7;
  font-size: 0.78rem;
}
.slide-meta { flex: 1; min-width: 0; }
.slide-position { font-weight: 600; font-size: 0.92rem; }
.slide-filename {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.82rem;
  color: var(--text-neutral);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slide-dims { font-size: 0.78rem; }
.slide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.slide-actions form { margin: 0; }
.btn-sq {
  padding: 0.4rem 0.65rem;
  font-weight: 700;
  min-width: 2.2rem;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Centered single-card layout (login / signup / logged-out) -------- */
.auth-shell .app-main {
  max-width: 440px;
  margin-top: 3rem;
}
.auth-meta {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.92rem;
  color: var(--text-neutral);
}
