/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* See edit_mode_controller.js — a control's (or viewOnly's — same issue,
   opposite direction) own display rules (e.g. .program-list__row-actions'
   display: flex, .program-list__movements' display: grid) are an
   author-origin rule, which can otherwise outrank the `hidden`
   attribute's user-agent-origin `display: none`, regardless of selector
   specificity. !important is what actually guarantees hidden wins here. */
[data-edit-mode-target="control"][hidden],
[data-edit-mode-target="viewOnly"][hidden] {
  display: none !important;
}

/* Always leaves room for the vertical scrollbar, so a page short enough
   not to need one isn't a few pixels wider than a long one — content
   centered on the page (a group's or performer's header) would otherwise
   shift sideways when moving between them. */
html {
  scrollbar-gutter: stable;
}

:root {
  --page-bg: linear-gradient(135deg, #eef4ff 0%, #f8fafc 100%);
  --card-bg: rgba(255, 255, 255, 0.94);
  --text: #0f172a;
  --muted: #64748b;
  --border: #dbe4f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #e2e8f0;
  --secondary-text: #0f172a;
  --success-bg: #e8f8ef;
  --success-text: #166534;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
  background: var(--page-bg);
  color: var(--text);
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  width: min(100%, 520px);
  background: var(--card-bg);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 20px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
  padding: 2rem;
  backdrop-filter: blur(8px);
}

/* The site's own brand/tagline, shown here because the login/register
   pages are the only ones a logged-out visitor ever sees — the site
   header (with its own brand link) only renders once logged in, so
   without this a first-time visitor never sees the site's name at all. */
.auth-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-brand__name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}

.auth-brand__tagline {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

.auth-card h1 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
}

.auth-card p,
.auth-card label,
.auth-card li {
  color: var(--muted);
}

.auth-subtitle {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 1rem;
}

/* An index page's search box, set apart from the result cards right
   below it (see venues/index.html.erb). */
.search-form {
  margin-bottom: 1.5rem;
}

/* A venue edit page's "Concerts here:" list, above the form itself
   (see venues/edit.html.erb). */
.venue-concerts-here {
  margin-bottom: 1.5rem;
}

.venue-concerts-here .card-meta {
  margin: 0 0 0.5rem;
}

.field-group {
  display: grid;
  gap: 0.4rem;
}

/* The `hidden` attribute and this rule are equal-specificity, author
   CSS wins by source order — without this, a hidden .field-group (e.g.
   pieces/show.html.erb's "How many parts?" field, hidden until an
   instrument is picked) would render anyway. */
.field-group[hidden] {
  display: none;
}

/* Two controls side by side in one field (a month and a day). */
.inline-fields {
  display: flex;
  gap: 0.5rem;
}

.field-group label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

/* :not([type="checkbox"]):not([type="radio"]) -- a checkbox/radio has
   its own small intrinsic size; stretching it to the same full-width
   text-input box as everything else here (previously every input in
   a .field-group, checkboxes included) blows it up to fill the row,
   pushing its own label text down onto the next line instead of
   sitting immediately beside it -- see the "Weekly rehearsals" and
   per-date "Skip rehearsal" checkboxes in rehearsal_schedules/_form.html.erb,
   the bug this was found from. */
.field-group input:not([type="checkbox"]):not([type="radio"]),
.account-form input:not([type="checkbox"]):not([type="radio"]),
.dashboard-actions input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.98rem;
  background: #ffffff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-group input:focus,
.account-form input:focus,
.dashboard-actions input:focus {
  border-color: rgba(37, 99, 235, 0.65);
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

/* Only for screen readers: a control's label where the sentence it sits
   in already says it (see rehearsal_schedules/_form.html.erb). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* rehearsal_schedules/_form.html.erb's "[Tuesday] from [7:00 PM] –
   [9:30 PM] at [venue]" and "Running from [date] through [date]": one line, each control only as wide as what it
   holds. Wraps on narrow screens. */
.weekly-rehearsal-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* Matches the time boxes beside it (.field-group input above). */
.weekly-rehearsal-line select {
  width: auto;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.98rem;
  background: #ffffff;
  color: var(--text);
}

/* A month-and-year date (user_memberships/index.html.erb's Joined and
   Departed): the two side by side, each its label over its month and
   year selects on one line, every select only as wide as its text. */
.month-year-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  align-items: flex-start;
}

.month-year-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
}

.month-year-field label {
  flex-basis: 100%;
}

.month-year-field select {
  width: auto;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.98rem;
  background: #ffffff;
  color: var(--text);
}

/* !important: beats .field-group input's own width: 100%. */
.weekly-rehearsal-line input[type="time"],
.weekly-rehearsal-line input[type="date"] {
  width: auto !important;
}

.weekly-rehearsal-line > label {
  font-weight: 400;
}

.venue-picker--inline {
  flex: 1 1 12rem;
}

/* A rehearsal's "Venue TBD" box (shared/_venue_picker.html.erb's tbd:),
   above the picker it hides when checked. */
.venue-tbd {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
  font-weight: 400;
}

.venue-tbd input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.venue-picker--inline [data-venue-picker-target="selected"] {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  margin: 0;
}

.venue-picker--inline [data-venue-picker-target="selected"][hidden] {
  display: none;
}

.venue-picker--inline .secondary-link {
  width: auto;
}

/* Searching for a venue needs room for its result cards: the picker
   takes its own full-width line under the sentence. */
.venue-picker--inline:has([data-venue-picker-target="searchPanel"]:not([hidden])) {
  flex-basis: 100%;
}

/* Each per-date row in rehearsal_schedules/_form.html.erb's weekly-date
   list: date, Mandatory checkbox, and Skip checkbox all on one line,
   with that date's own reason/note field (whichever applies) right
   beside them rather than dropping to its own line the way a plain
   .field-group's grid stacking would put it. Wraps on narrow screens. */
.rehearsal-date-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.rehearsal-date-row__date {
  font-weight: 700;
  min-width: 11rem;
}

.rehearsal-date-row__mandatory,
.rehearsal-date-row__skip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

/* Hides the Mandatory checkbox+label once "Skip rehearsal" is checked
   without removing it from the flex row -- visibility (not display, and
   not the `hidden` attribute) so it still occupies its own space, and
   "Skip rehearsal" stays at the same horizontal spot on every row
   rather than sliding left on the rows where Mandatory is hidden. */
.rehearsal-date-row__mandatory--hidden {
  visibility: hidden;
}

/* !important: needed to beat .field-group input:not(checkbox):not(radio)'s
   own width: 100% above, which otherwise forces each of these onto its
   own full-width line despite the row's flex layout, the opposite of
   "same line as the date" this row exists for. */
.rehearsal-date-row__reason,
.rehearsal-date-row__note {
  flex: 1 1 14rem;
  width: auto !important;
}

.report-reasons {
  display: grid;
  gap: 0.5rem;
  border: none;
  padding: 0;
  margin: 0;
}

.report-reasons legend {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  padding: 0;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.radio-option input[type="radio"] {
  width: auto;
}

.radio-option label {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text);
}

.primary-button,
.secondary-link,
.logout-button,
.auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.primary-button:hover,
.secondary-link:hover,
.logout-button:hover,
.auth-button:hover {
  transform: translateY(-1px);
}

.primary-button,
.auth-button {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

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

/* See submit_once_controller.js — a button whose form is on its way. */
.primary-button[aria-busy="true"] {
  gap: 0.6rem;
  cursor: progress;
  opacity: 0.85;
  transform: none;
}

.button-spinner {
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: button-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .button-spinner { animation-duration: 2.4s; }
}

.upload-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* Sized to its own label rather than the full width .primary-button
   otherwise takes (e.g. a page header's small Edit toggle). */
.primary-button--fit {
  width: auto;
  flex: 0 0 auto;
  padding: 0.65rem 1.25rem;
}

.secondary-link {
  background: var(--secondary);
  color: var(--secondary-text);
}

/* A done action shown in place of its button (a performer's profile
   once you've invited them). */
.secondary-link:disabled {
  opacity: 0.75;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.logout-button {
  background: #dc2626;
  color: #ffffff;
}

.auth-links,
.inline-links {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}

.auth-links a,
.inline-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

/* A blue button among these links keeps its white label: the rule above
   is more specific than .primary-button alone, and turned "Hire this
   musician" (shared/_contact_actions.html.erb) blue text on its own blue
   background. */
.auth-links a.primary-button,
.inline-links a.primary-button {
  color: #ffffff;
}

.flash {
  position: fixed;
  top: 1rem;
  right: 1rem;
  max-width: 360px;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-weight: 700;
  z-index: 10;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
}

.flash.notice {
  background: var(--success-bg);
  color: var(--success-text);
}

.flash.alert {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.auth-error-list {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
}

/* Files a batch upload skipped — see program_documents/_skipped_uploads. */
.skipped-uploads {
  margin: 0 0 1.2rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--danger-text);
  border-radius: 12px;
  background: var(--card-bg);
}

.skipped-uploads h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.skipped-uploads ul {
  margin: 0;
  padding-left: 1.15rem;
}

.skipped-uploads li + li {
  margin-top: 0.3rem;
}

.profile-summary {
  margin-bottom: 1.2rem;
  padding: 1rem;
  border-radius: 12px;
  background: #f8fafc;
}

.account-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* The account page's profile summary on its own, now that its password
   form lives on the profile editor's Security tab. */
.account-layout--single {
  grid-template-columns: 1fr;
}

.account-layout .profile-summary,
.account-layout .account-form {
  margin: 0;
}

.dashboard-actions {
  display: grid;
  gap: 0.75rem;
}

.dashboard-actions .primary-button,
.dashboard-actions .secondary-link,
.dashboard-actions .logout-button {
  width: 100%;
}

.account-card {
  width: min(100%, 760px);
}

@media (max-width: 640px) {
  .auth-shell {
    padding: 1rem;
  }

  .auth-card {
    padding: 1.25rem;
  }

  .auth-card h1 {
    font-size: 1.6rem;
  }

  .account-layout {
    grid-template-columns: 1fr;
  }
}

/* Development-only, top of every page (see layouts/_dev_banner.html.erb)
   — the opposite of .dev-footer below: loud on purpose, striped amber so
   it can't be mistaken for any real site chrome. */
.dev-banner {
  padding: 0.35rem 1rem;
  background: repeating-linear-gradient(-45deg, #f59e0b 0 14px, #fbbf24 14px 28px);
  color: #1c1917;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-align: center;
}

/* Development-only diagnostics (see layouts/_dev_footer.html.erb) —
   deliberately understated so it reads as a debug aside, not part of
   the page's own content. */
.dev-footer {
  margin-top: 2rem;
  padding: 0.5rem 2rem;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  font-family: monospace;
}

/* The venue picker's own "Add a venue" panel (see
   shared/_new_venue_panel.html.erb) — set apart from the form around it. */
.new-venue-panel {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.new-venue-panel[hidden] {
  display: none;
}

.new-venue-panel h3,
.new-venue-panel .card-meta {
  margin: 0;
}

.new-venue-panel label:not(.checkbox-list__item) {
  display: grid;
  gap: 0.4rem;
}

.new-venue-panel__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* How to add a group, above the new-group form (performance_groups/new). */
.group-intro {
  margin-bottom: 1.5rem;
}

.group-intro h2 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.15rem;
}

.group-intro ul {
  margin: 0.25rem 0 0.75rem;
  padding-left: 1.25rem;
}
