/*
 * 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.
 */

/*
 * Palette
 * Blue Slate:   #595f72
 * Dusty Grape:  #575d90  ← primary interactive
 * Muted Teal:   #84a07c  ← secondary accents, eyebrows
 * Lemon Lime:   #c3d350  ← softer highlight
 * Lemon Lime 2: #e6f14a  ← active / CTA pop
 */

:root {
  --bg:           #13151f;
  --panel:        #1b1e2d;
  --panel-strong: #22263a;
  --text:         #e0e3f0;
  --muted:        #7880a8;
  --border:       rgba(87, 93, 144, 0.3);
  --accent:       #575d90;
  --accent-strong:#454a78;
  --accent-text:  #9097cc;
  --teal:         #84a07c;
  --lime:         #e6f14a;
  --lime-dim:     #c3d350;
  --danger:       #c05048;
  --danger-strong:#a03d36;
  --shadow:       0 18px 40px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top, rgba(87, 93, 144, 0.2), transparent 50%),
    linear-gradient(180deg, #191c2c 0%, var(--bg) 100%);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.flash {
  margin: 1rem auto 0;
  width: min(1100px, calc(100% - 2rem));
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.flash-notice {
  border-color: rgba(87, 93, 144, 0.5);
}

.flash-alert {
  border-color: rgba(192, 80, 72, 0.5);
}

.page-shell {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: end;
  margin-bottom: 1.75rem;
}

.page-header h1,
.panel h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-header h1 {
  font-size: clamp(2.1rem, 5vw, 3.8rem);
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
}

.page-copy {
  margin: 0.5rem 0 0;
  max-width: 40rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.header-actions,
.form-actions,
.card-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.header-actions form {
  margin: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  font: inherit;
}

.button-primary {
  background: var(--lime);
  color: #0f1018;
}

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

.button-secondary {
  border-color: var(--border);
  background: rgba(87, 93, 144, 0.12);
  color: var(--text);
}

.button-secondary:hover {
  background: rgba(87, 93, 144, 0.22);
}

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

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

.filter-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.7rem 1rem;
  background: rgba(87, 93, 144, 0.1);
  border: 1px solid var(--border);
  border-radius: 1rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group-right {
  margin-left: auto;
}

.filter-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.filter-tabs {
  display: flex;
  gap: 0.2rem;
}

.filter-selects-form {
  display: contents;
}

.filter-select {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(87, 93, 144, 0.15);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.filter-select.has-value {
  border-color: var(--accent);
  background: rgba(87, 93, 144, 0.28);
  color: var(--accent-text);
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.filter-tab.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.filter-tab:hover:not(.is-active) {
  background: rgba(87, 93, 144, 0.2);
  border-color: var(--border);
  color: var(--text);
}

.watch-list {
  display: grid;
  gap: 1.5rem;
}

.watch-group {
  display: grid;
  gap: 0.6rem;
}

.watch-group-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.25rem;
}

.watch-group-name {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.watch-group-count {
  font-size: 0.82rem;
  color: var(--muted);
  background: rgba(87, 93, 144, 0.2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-weight: 600;
}

.watch-group-market-link {
  margin-left: auto;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.intro-panel {
  display: grid;
  gap: 0.9rem;
}

.intro-panel-strong {
  background:
    radial-gradient(circle at top right, rgba(87, 93, 144, 0.3), transparent 40%),
    linear-gradient(180deg, var(--panel-strong) 0%, var(--panel) 100%);
}

.panel-kicker {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
}

.intro-panel p,
.intro-list {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.intro-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.intro-stats div {
  display: grid;
  gap: 0.15rem;
  padding: 0.95rem;
  border-radius: 1rem;
  background: rgba(87, 93, 144, 0.15);
  border: 1px solid var(--border);
}

.intro-stat-value {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
}

.intro-stat-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.intro-list {
  padding-left: 1.1rem;
}

.intro-list li + li {
  margin-top: 0.6rem;
}

.panel {
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: linear-gradient(180deg, var(--panel-strong) 0%, var(--panel) 100%);
  box-shadow: var(--shadow);
}

.watch-card-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.criteria-summary {
  margin: 0.5rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.is-active {
  background: rgba(230, 241, 74, 0.15);
  color: var(--lime);
}

.status-badge.is-inactive {
  background: rgba(87, 93, 144, 0.2);
  color: var(--muted);
}

.watch-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1.2rem 0;
}

.watch-stats div {
  padding: 0.95rem;
  border-radius: 1rem;
  background: rgba(87, 93, 144, 0.12);
  border: 1px solid var(--border);
}

.watch-stats dt {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.watch-stats dd {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

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

.recent-matches {
  margin: 0 0 1.2rem;
}

.recent-matches h3 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
}

.section-note {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.recent-match-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.recent-match-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: rgba(87, 93, 144, 0.08);
}

.recent-match-link,
.recent-match-text {
  display: block;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: rgba(87, 93, 144, 0.08);
  text-decoration: none;
}

.recent-match-link:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.recent-match-empty {
  margin: 0;
  color: var(--muted);
}

.freshness-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.freshness-active {
  background: rgba(230, 241, 74, 0.15);
  color: var(--lime);
}

.freshness-recent {
  background: rgba(195, 211, 80, 0.15);
  color: var(--lime-dim);
}

.freshness-stale {
  background: rgba(87, 93, 144, 0.15);
  color: var(--muted);
}

.freshness-unknown {
  background: rgba(87, 93, 144, 0.15);
  color: var(--muted);
}

.button-sm {
  min-height: 2rem;
  padding: 0.4rem 0.8rem;
  font-size: 0.88rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field-wide {
  grid-column: 1 / -1;
}

.field label {
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: rgba(87, 93, 144, 0.15);
  color: var(--text);
  font: inherit;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field textarea {
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.checkbox-field input {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.error-panel {
  border-color: rgba(192, 80, 72, 0.5);
}

.error-list {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
}

.empty-state {
  text-align: center;
}

@media (max-width: 800px) {
  .intro-grid {
    grid-template-columns: 1fr;
  }

  .page-header,
  .watch-card-header {
    align-items: start;
    flex-direction: column;
  }

  .intro-stats,
  .watch-stats,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .filter-group-right {
    margin-left: 0;
  }

  .watch-group-header {
    flex-wrap: wrap;
  }

  .recent-match-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}
