/*
 * 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;
}

: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;
}

.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;
}

.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);
}

/* 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);
}

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

.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;
}

.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;
}

.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;
}

.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 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;
}
