/*
 * Application-wide styles. Propshaft serves every file in this directory;
 * later files override earlier ones per the standard cascade.
 */

:root {
  --bg: #16161d;
  --surface: #1f1f29;
  --surface-raised: #2a2a38;
  --border: #3a3a4c;
  --text: #e8e6e3;
  --text-muted: #9b98a5;
  --accent: #c0392b;
  --accent-hover: #e74c3c;
  --ok: #27ae60;
  --warn: #f39c12;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1.5;
}

a { color: var(--accent-hover); }

h1, h2, h3 { line-height: 1.2; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header .brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-header nav a { color: var(--text-muted); text-decoration: none; }
.site-header nav a:hover { color: var(--text); }
.nav-email { color: var(--text-muted); font-size: 0.85rem; }
.locale-switcher select { width: auto; padding: 0.25rem 0.5rem; font-size: 0.85rem; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.flash-notice { background: rgba(39, 174, 96, 0.15); border: 1px solid var(--ok); }
.flash-alert { background: rgba(192, 57, 43, 0.15); border: 1px solid var(--accent); }

/* Forms */
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: 0.25rem; font-weight: 600; }
.field small { color: var(--text-muted); }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], textarea, select {
  width: 100%;
  max-width: 24rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
}

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

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { border-color: var(--text-muted); }

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

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0;
  cursor: pointer;
  font: inherit;
}
.btn-link:hover { color: var(--text); }

.btn-danger { border-color: var(--accent); color: var(--accent-hover); background: none; }
.btn-danger:hover { background: rgba(192, 57, 43, 0.15); }

.form-errors {
  background: rgba(192, 57, 43, 0.15);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
}

.auth-card {
  max-width: 26rem;
  margin: 3rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

/* Cards & lists */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card h2, .card h3 { margin-top: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-setup { background: var(--surface-raised); color: var(--text-muted); }
.badge-night { background: #2c3e70; color: #aec3f5; }
.badge-dawn { background: #7a4a20; color: #f5c9ae; }
.badge-day { background: #7a6220; color: #f5dfae; }
.badge-voting { background: #6e2f7a; color: #eaaef5; }
.badge-completed { background: #2f5e3a; color: #aef5c0; }

.badge-alive { background: rgba(39, 174, 96, 0.2); color: #7ce0a3; }
.badge-dead { background: rgba(192, 57, 43, 0.2); color: #f0968c; }
.badge-effect { background: rgba(230, 126, 34, 0.2); color: #f5b87a; }

/* Delayed submit (hold-to-confirm replacement for confirm dialogs) */
.delay-bar {
  display: block;
  height: 6px;
  margin-top: 0.4rem;
  min-width: 8rem;
  max-width: 16rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.delay-bar-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--warn);
  transition-property: width;
  transition-timing-function: linear;
}

.delay-bar-fill.depleting { width: 0; }

.btn-armed, .btn.btn-armed, input.btn-armed {
  background: none;
  border-color: var(--warn);
  color: var(--warn);
}

.text-muted { color: var(--text-muted); }
.warning-box {
  background: rgba(243, 156, 18, 0.12);
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.actions-row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }

.night-dead-role { opacity: 0.6; font-style: italic; }

.role-list { display: flex; flex-direction: column; gap: 0.4rem; margin: 1rem 0; }
.role-row { display: flex; align-items: center; gap: 1rem; max-width: 20rem; }
.role-row span { flex: 1; }
.role-row input[type="number"] { width: 5rem; max-width: 5rem; text-align: center; }

/* Public live page */
.live-page { max-width: 640px; margin: 0 auto; text-align: center; }
.live-page .phase-banner { font-size: 2rem; font-weight: 700; margin: 1rem 0; }
.live-roster { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
.live-roster li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
}
.live-roster li.dead { opacity: 0.55; text-decoration: line-through; }
.live-roster li.dead .badge { text-decoration: none; }

/* Mobile */
@media (max-width: 640px) {
  .container { padding: 1rem 0.75rem; }

  .site-header {
    padding: 0.5rem 0.75rem;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
  }
  .nav-email { display: none; }

  .card { padding: 1rem 0.75rem; }
  .auth-card { margin: 1rem auto; padding: 1.25rem; }

  h1 { font-size: 1.5rem; }

  /* Full-width inputs and comfortable tap targets */
  input[type="text"], input[type="email"], input[type="password"],
  textarea, select {
    max-width: 100%;
    width: 100%;
  }
  td select { width: 100%; }
  .actions-row input[type="text"], .actions-row select { width: auto; flex: 1; min-width: 0; }
  .btn { padding: 0.65rem 1.1rem; }

  /* Tables scroll sideways instead of breaking the page */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  th, td { padding: 0.45rem 0.4rem; }

  .live-page .phase-banner { font-size: 1.6rem; }
  .live-roster li { font-size: 1rem; }
}
