/* ===== Shadow Protocol — Components ===== */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.85rem 1.8rem;
  border: none;
  border-radius: var(--radius-md);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%),
    rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.btn:active::after { opacity: 1; }

.btn-primary {
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--text-primary);
  box-shadow: inset 0 0 20px rgba(212, 133, 42, 0.05);
}

.btn-primary:hover {
  background: var(--accent-subtle);
  box-shadow: var(--shadow-glow), inset 0 0 30px rgba(212, 133, 42, 0.08);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-accent {
  background: var(--accent);
  color: var(--text-inverse);
  font-weight: var(--fw-bold);
}

.btn-accent:hover {
  background: var(--accent-light);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--border-medium);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.6rem;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--accent-subtle);
}

.btn-danger {
  background: transparent;
  border: 1.5px solid var(--role-spy);
  color: var(--role-spy);
}

.btn-danger:hover {
  background: var(--role-spy-dim);
}

.btn-full { width: 100%; }

.btn-lg {
  padding: 1rem 2rem;
  font-size: var(--fs-base);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: var(--fs-xs);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--duration-normal) var(--ease-out);
}

.card:hover {
  border-color: var(--border-medium);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ---------- Menu Items ---------- */
.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 1rem var(--space-lg);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  width: 100%;
  text-align: left;
}

.menu-item:last-child { border-bottom: none; }

.menu-item:hover {
  background: var(--accent-subtle);
  color: var(--accent-light);
}

.menu-item .icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  flex-shrink: 0;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  width: 100%;
  max-width: var(--max-width);
  max-height: 85dvh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.95);
  transition: transform var(--duration-normal) var(--ease-spring);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.modal-header h2 {
  font-size: var(--fs-lg);
}

/* ---------- Progress Bar ---------- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
}

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.2rem 0.6rem;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

.badge-accent {
  background: var(--accent-subtle);
  color: var(--accent-light);
  border: 1px solid rgba(212, 133, 42, 0.2);
}

.badge-spy {
  background: var(--role-spy-dim);
  color: var(--role-spy);
}

.badge-safe {
  background: var(--role-civilian-dim);
  color: var(--role-civilian);
}

/* ---------- Inputs ---------- */
.input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--fs-base);
  transition: all var(--duration-fast) var(--ease-out);
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input::placeholder {
  color: var(--text-muted);
}

textarea.input {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

/* ---------- Slider ---------- */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-label {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
}

.slider-value {
  font-size: var(--fs-sm);
  color: var(--accent);
  font-weight: var(--fw-semibold);
  font-family: var(--font-mono);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: var(--radius-full);
  border: 3px solid var(--bg-primary);
  box-shadow: 0 0 10px var(--accent-glow);
  transition: transform var(--duration-fast) var(--ease-spring);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: var(--radius-full);
  border: 3px solid var(--bg-primary);
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: pointer;
}

/* ---------- Toggle Switch ---------- */
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
}

.toggle-label {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--text-muted);
  border-radius: var(--radius-full);
  transition: all var(--duration-normal) var(--ease-spring);
}

.toggle-switch input:checked + .toggle-track {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(22px);
  background: var(--accent);
}

/* ---------- Timer Display ---------- */
.timer-display {
  font-family: var(--font-mono);
  font-size: var(--fs-timer);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  text-align: center;
  letter-spacing: 0.05em;
  line-height: 1;
}

.timer-display.urgent {
  color: var(--role-spy);
  animation: timerPulse 1s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.02); }
}

/* ---------- Player List ---------- */
.player-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.player-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0.75rem var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
}

.player-item.voted {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.player-item.spy-reveal {
  border-color: var(--role-spy);
  background: var(--role-spy-dim);
}

.player-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  flex-shrink: 0;
}

.player-name {
  flex: 1;
  font-weight: var(--fw-medium);
  font-size: var(--fs-base);
}

/* ---------- Header ---------- */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-lg);
  min-height: var(--header-height);
}

.screen-header .back-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--fs-sm);
  padding: var(--space-sm);
  margin-left: calc(-1 * var(--space-sm));
  transition: color var(--duration-fast);
}

.screen-header .back-btn:hover { color: var(--accent); }

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ---------- Section ---------- */
.section {
  margin-bottom: var(--space-xl);
}

.section-title {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--space-md);
  font-weight: var(--fw-semibold);
}

/* ---------- Divider ---------- */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-lg) 0;
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}

/* ---------- Vote count badge ---------- */
.vote-count {
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.vote-count.has-votes {
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid rgba(212, 133, 42, 0.3);
}

/* ---------- Category chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.35rem 0.85rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.chip.active, .chip:hover {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* ---------- Active Word List Indicator ---------- */
.active-list-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0.85rem var(--space-lg);
  background: var(--bg-tertiary);
  border: 1.5px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  margin-bottom: var(--space-md);
}

.active-list-indicator:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.active-list-indicator.has-list {
  border-style: solid;
  border-color: var(--accent);
  background: rgba(212, 133, 42, 0.06);
}

.active-list-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.active-list-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.active-list-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}

.active-list-name {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--accent-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-list-count {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ---------- Disabled Button ---------- */
.btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: auto;
}

.btn-disabled:hover {
  transform: none;
  box-shadow: none;
}

/* ---------- Setup Word List Info ---------- */
.setup-wordlist-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--accent-subtle);
  border: 1px solid rgba(212, 133, 42, 0.2);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.setup-wordlist-info strong {
  color: var(--accent-light);
}
