/*
 * base.css — PSU Volunteer Hub design tokens (single source of truth)
 * ---------------------------------------------------------------------------
 * Every public, authentication, and role stylesheet consumes these shared
 * tokens. This remains the system's only global stylesheet.
 */

/* Shared native session warning, used by public, account and role layouts. */
.session-idle {
  box-sizing: border-box;
  width: min(30rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: clamp(1rem, 4vw, 2rem);
  overflow: auto;
  overscroll-behavior: contain;
  border: 2px solid #00408b;
  border-radius: .75rem;
  background: #ffffff;
  color: #111c2c;
  font: inherit;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.session-idle::backdrop { background: rgb(17 28 44 / 60%); }
.session-idle h2 { margin: 0 0 1rem; color: #00408b; font-size: 1.5rem; }
.session-idle p { margin: 0 0 1rem; }
.session-idle__countdown { font-variant-numeric: tabular-nums; }
.session-idle [data-idle-status]:empty { display: none; }
.session-idle__actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.session-idle__actions form { margin: 0; }
.session-idle button {
  min-height: 44px;
  padding: .625rem 1rem;
  border: 2px solid #00408b;
  border-radius: .375rem;
  background: #00408b;
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
.session-idle button.session-idle__secondary { background: #ffffff; color: #00408b; }
.session-idle button:focus-visible { outline: 3px solid #00408b; outline-offset: 3px; }
.session-idle button:hover { text-decoration: underline; }
.session-idle button:disabled { cursor: wait; }
@media (max-width: 30rem) {
  .session-idle__actions { flex-direction: column; }
  .session-idle__actions button { width: 100%; }
}

/* Persistent feedback stays in document flow so sticky navigation never hides it. */
.flash-stack {
  width: min(calc(100% - 2rem), 72rem);
  margin: 1rem auto 0;
  display: grid;
  gap: 8px;
}
.flash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1rem;
  padding: 14px 16px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-md);
  overflow-wrap: anywhere;
}
.flash__content { display: grid; gap: 2px; min-width: 0; }
.flash__label { font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
.flash__action,
.flash__dismiss { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.flash__action { padding: 8px 12px; border-radius: 6px; color: #fff; font-weight: 700; }
.flash__action:hover { background: rgb(255 255 255 / 14%); }
.flash__dismiss { padding: 8px 12px; border: 1px solid rgb(255 255 255 / 75%); border-radius: 6px; background: transparent; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.flash__dismiss:hover { background: rgb(255 255 255 / 14%); }
.flash__action:focus-visible, .flash__dismiss:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.flash--error { background: var(--error); border-color: var(--error); }
.flash--warning { background: #8a6700; border-color: #8a6700; }
.flash--success { background: var(--color-success); border-color: var(--color-success); }
.flash--session-expired { background: var(--primary-dark); border-color: var(--gold); }
@media (max-width: 560px) {
  .flash { grid-template-columns: 1fr auto; }
  .flash__content { grid-column: 1 / -1; }
  .flash__action, .flash__dismiss { width: 100%; }
}

:root {
  /* Brand / primary (PSU blue) */
  --color-primary: #00408b;
  --color-primary-hover: #003370;
  --color-container: #0057b8;
  --color-gold: #f6bf22;
  --color-primary-light: #d8e2ff;

  /* Surfaces & text */
  --color-bg-main: #f9f9ff;
  --color-bg-card: #ffffff;
  --color-text-main: #111c2c;
  --color-text-muted: #424752;
  --color-border: #c2c6d4;
  --color-secondary: #0057b8;
  --color-accent: #f6bf22;
  --color-accent-dark: #553f00;
  --color-warning: #e00f00;
  --color-error: #ba1a1a;
  --color-error-bg: #ffdad6;
  --color-success: #2f8f5b;
  --color-success-bg: #dff5e6;

  /* Radii & motion */
  --border-radius-sm: 8px;
  --border-radius-lg: 12px;
  --border-radius: 12px;
  --control-radius: 8px;
  --transition-speed: 0.2s;

  /* Compatibility aliases used by existing public and profile components. */
  --primary: #00408b;
  --primary-hover: #003370;
  --primary-variant: #002d62;
  --primary-dark: #001a41;
  --primary-light: #d8e2ff;
  --primary-fixed: #d8e2ff;
  --on-primary: #ffffff;
  --on-primary-fixed: #001a41;
  --on-primary-fixed-variant: #004493;
  --secondary: #5b5f61;
  --secondary-blue: #0057b8;
  --secondary-container: #e0e3e6;
  --on-secondary-container: #626567;
  --tertiary: #553f00;
  --on-tertiary: #ffffff;
  --tertiary-fixed: #ffdf99;
  --on-tertiary-fixed: #251a00;
  --tertiary-fixed-dim: #f6bf22;
  --gold: #f6bf22;
  --surface: #f9f9ff;
  --surface-low: #f1f4fb;
  --surface-lowest: #ffffff;
  --surface-container-low: #f0f3ff;
  --on-surface: #111c2c;
  --on-surface-variant: #424752;
  --outline: #d1d5db;
  --outline-variant: #c2c6d4;
  --error: #ba1a1a;
  --error-container: #ffdad6;

  /* Shadows */
  --card-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 64, 139, .06);
  --shadow-sm: 0 1px 3px rgba(17, 28, 44, .06), 0 1px 2px rgba(17, 28, 44, .04);
  --shadow-md: 0 4px 14px rgba(17, 28, 44, .08);

  /* Layout */
  --sidebar-width: 280px;
  --sidebar-w: 260px;
  --header-height: 60px;
  --radius: 8px;
  --radius-card: 12px;
  --radius-full: 9999px;
  --max-width: 1200px;
  --gutter: 24px;

  /* Spacing scale */
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Backwards-compat aliases (profile/opportunity sheets) */
  --bg: #f9f9ff;
  --text: #111c2c;
  --text-muted: #424752;
  --border: #c2c6d4;
}

/* ===========================================================================
 * Shared component primitives
 * ---------------------------------------------------------------------------
 * One visual language for the whole product. Every page resolves buttons,
 * inputs, cards, and navigation through these shared rules.
 * =========================================================================== */

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  /* touch target (a11y) */
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition-speed) ease,
    border-color var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease,
    transform var(--transition-speed) ease;
}

.btn:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn--primary:hover {
  background: var(--primary-hover);
}

.btn--secondary {
  background: var(--secondary);
  color: #fff;
}

.btn--secondary:hover {
  background: #4a4e50;
}

.btn--outline {
  background: transparent;
  border-color: var(--primary);
  color: var(--primary);
}

.btn--outline:hover {
  background: var(--primary-light);
}

.btn--ghost {
  background: transparent;
  color: var(--on-surface-variant);
}

.btn--ghost:hover {
  background: var(--surface-container-low);
}

.btn--danger {
  background: var(--error);
  color: #fff;
}

.btn--danger:hover {
  background: #8f1515;
}

.muted {
  color: var(--on-surface-variant);
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn--sm {
  min-height: 36px;
  padding: 7px 14px;
  font-size: 14px;
  border-radius: 8px;
}

.btn--lg {
  min-height: 52px;
  padding: 13px 26px;
  font-size: 16px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 9px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button--primary {
  background: var(--primary);
  color: var(--on-primary);
}

.button--primary:hover {
  background: var(--primary-hover);
}

.button--secondary {
  background: #fff;
  color: var(--primary);
  border-color: var(--outline-variant);
}

.button--block {
  width: 100%;
}

.button-row,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
}

.check-row input {
  width: auto;
}

.status-label {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
  font-size: 12px;
}

/* Form fields ------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field__label,
.field-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface-variant);
}

.input,
.select,
.form-input {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 16px;
  /* >=16px avoids iOS zoom */
  color: var(--on-surface);
  background: #fff;
  border: 1px solid var(--outline-variant);
  border-radius: 8px;
  transition: border-color var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease;
}

.input:focus,
.select:focus,
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 64, 139, .15);
}

.input--invalid,
.form-input.is-invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px var(--error-container);
}

/* Surfaces / cards -------------------------------------------------------- */
.card {
  background: var(--surface-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 20px;
  min-width: 0;
}

.table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.card__title,
.panel-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--on-surface);
  margin-bottom: 12px;
}

/* Page header ------------------------------------------------------------- */
.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--on-surface);
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 15px;
  color: var(--on-surface-variant);
  margin-top: 4px;
}

/* Navigation links (sidebar / topbar) ------------------------------------ */
.navlink {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--on-surface-variant);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: background-color var(--transition-speed) ease,
    color var(--transition-speed) ease;
}

.navlink:hover {
  background: var(--surface-container-low);
  color: var(--on-surface);
}

.navlink--active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* Badges ------------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge--primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge--neutral {
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Prevent horizontal scroll from off-canvas sidebars / decorative elements.
   Tables and scroll-rows already manage their own internal overflow. */
html,
body {
  overflow-x: clip;
}
.submit-spinner {
  animation: submit-spin 0.75s linear infinite;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  height: 1em;
  width: 1em;
}

.is-submitting {
  align-items: center;
  display: inline-flex;
  gap: 0.5rem;
}

@keyframes submit-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .submit-spinner {
    animation-duration: 1.5s;
  }
}
.choice-fieldset {
  border: 1px solid var(--outline-variant);
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-block: 1rem;
  padding: 1rem;
}

.choice-fieldset legend {
  font-weight: 700;
  padding-inline: 0.4rem;
}

.choice-fieldset label {
  align-items: center;
  display: flex;
  gap: 0.55rem;
  min-height: 44px;
}

.password-input {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1fr auto;
}

.icon-button--danger {
  color: var(--danger, #a40000);
  font-size: 1.5rem;
}

.event-announcement summary {
  cursor: pointer;
  min-height: 44px;
  padding-block: 0.7rem;
}

.event-announcement form {
  display: grid;
  gap: 0.75rem;
  min-width: min(320px, 80vw);
  padding-block: 0.5rem;
}

.event-updates article {
  border-top: 1px solid var(--outline-variant);
  padding-block: 0.75rem;
}
