/* forkask styles */

* {
  box-sizing: border-box;
}

:root {
  --bg: #101418;
  --panel: #1a2027;
  --text: #e8eef4;
  --accent: #ff7847;
  --muted: #8a97a5;
  --danger: #5c2626;
}

body {
  margin: 0;
  padding: 16px;
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

main {
  max-width: 480px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 32px;
}

header h1 {
  margin: 0 0 8px 0;
  font-size: 32px;
  font-weight: 700;
}

header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* Room banner */
#room-banner {
  background-color: var(--panel);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
}

#room-banner #room-code {
  font-family: monospace;
  font-size: 1.2rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin-bottom: 12px;
  font-weight: 700;
}

#btn-copy-code {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
  cursor: pointer;
}

/* Sections */
section {
  display: block;
}

section h2 {
  margin: 0 0 16px 0;
  font-size: 20px;
  font-weight: 600;
}

/* Inputs */
input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  background-color: var(--panel);
  border: 1px solid rgba(232, 238, 244, 0.1);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
}

input[type="text"]::placeholder,
input[type="number"]::placeholder {
  color: var(--muted);
}

input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
}

#code-input {
  text-transform: uppercase;
}

/* Buttons */
button {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  border: none;
  border-radius: 10px;
  background-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: opacity 0.2s;
}

button:hover {
  opacity: 0.9;
}

button:active {
  opacity: 0.8;
}

/* Small buttons (for list actions) */
li button,
.btn-small {
  width: auto;
  flex: none;
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 8px;
}

/* Divider */
.divider {
  text-align: center;
  color: var(--muted);
  margin: 16px 0;
}

/* Lists */
ul, ol {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
}

li {
  background-color: var(--panel);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

li .info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

/* Results list (ordered) */
#results-list li {
  flex-wrap: wrap;
}

/* List items with name + address stacked */
li.restaurant-row,
li.search-result {
  flex-direction: column;
  align-items: flex-start;
}


li.restaurant-row .info,
li.search-result .info {
  flex: 1;
}

li.restaurant-row .name,
li.search-result .name {
  font-weight: 600;
  margin-bottom: 4px;
}

li.restaurant-row .address,
li.search-result .address {
  font-size: 14px;
  color: var(--muted);
}

li.restaurant-row button,
li.search-result button {
  width: auto;
  padding: 6px 12px;
  margin: 0;
  font-size: 14px;
}

/* Rank list items */
#rank-list li {
  align-items: center;
  touch-action: none;
  cursor: grab;
}

#rank-list .rank-n {
  color: var(--accent);
  font-weight: 700;
  font-size: 18px;
  margin-right: 12px;
  min-width: 24px;
  text-align: center;
}

#rank-list .name {
  flex: 1;
}

#rank-list .controls {
  display: flex;
  gap: 6px;
}

#rank-list .controls button {
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  font-size: 1rem;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Links within restaurant/results items */
.links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.links a {
  color: var(--muted);
  text-decoration: underline;
  margin-right: 8px;
  font-size: 0.85rem;
  display: inline-block;
}

#results-list li.winner {
  outline: 2px solid var(--accent);
}

#search-row {
  margin-bottom: 16px;
}

#search-row input {
  margin-bottom: 12px;
}

#search-row button {
  margin-bottom: 16px;
}

/* Find results dropdown */
#find-results {
  list-style: none;
  margin: 0 0 16px 0;
  padding: 0;
  background-color: var(--panel);
  border: 1px solid rgba(232, 238, 244, 0.1);
  border-radius: 8px;
  max-height: 260px;
  overflow: auto;
}

#find-results li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 0;
  border-radius: 0;
  border-bottom: 1px solid rgba(232, 238, 244, 0.1);
  cursor: pointer;
  background-color: transparent;
}

#find-results li:last-child {
  border-bottom: none;
}

/* Add row */
.add-row {
  margin-bottom: 16px;
}

.add-hint {
  margin-top: 0;
  margin-bottom: 8px;
}

.add-row input {
  margin-bottom: 12px;
}

.add-row button {
  margin-bottom: 16px;
}

/* Host row (timer + start voting) */
.host-row {
  background-color: var(--panel);
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
}

.host-row label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

.host-row input {
  margin-bottom: 12px;
}

.host-row button {
  margin-bottom: 0;
}

/* Timer */
#timer {
  font-family: monospace;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin: 16px 0;
  color: var(--text);
}

#timer.urgent {
  color: var(--accent);
}

/* Dragging state — the grabbed row lifts and rides above the rest */
.dragging {
  cursor: grabbing;
  position: relative;
  z-index: 10;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
  transform-origin: center;
  transition: none;
}

/* Phase timer (suggest countdown) */
.phase-timer {
  font-family: monospace;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin: 16px 0;
  color: var(--text);
}

.phase-timer.urgent {
  color: var(--accent);
}

/* Error toast */
#error-toast {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  background-color: var(--danger);
  color: #ffcccc;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  max-width: calc(480px - 32px);
  margin-left: auto;
  margin-right: auto;
  z-index: 1000;
}

/* Hidden */
.hidden {
  display: none !important;
}

/* Room code in lobby section */
#screen-lobby #room-code {
  background-color: var(--panel);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
  font-family: monospace;
  font-size: 2.5rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  font-weight: 700;
}

/* Lobby timers */
.lobby-timers {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.lobby-timers label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.lobby-timers input {
  margin-bottom: 0;
}

/* Responsive adjustments for content that may appear */
#screen-home input,
#screen-home button,
#screen-lobby button,
#screen-suggest input {
  width: 100%;
}

/* Player list styling */
#player-list li {
  flex-direction: column;
  align-items: flex-start;
}

#player-list .player-name {
  font-weight: 600;
}

#player-list .player-status {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Results players list */
#results-players li {
  flex-direction: column;
  align-items: flex-start;
}

#results-players .player-name {
  font-weight: 600;
}

#results-players .player-points {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Submit status */
#submit-status {
  margin-top: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

#submit-status.success {
  color: var(--accent);
}

/* Suggest screen: 3-column grid (players | map+controls | suggestions) */
.suggest-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  grid-template-areas:
    "center"
    "bank"
    "players";
  align-items: start;
}

#suggest-players-panel { grid-area: players; }
.suggest-center { grid-area: center; }
#suggestion-bank { grid-area: bank; }

@media (min-width: 900px) {
  .suggest-grid {
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-areas: "players center bank";
  }
}

/* main is 480px-wide by default; the suggest grid needs room */
body:has(#screen-suggest:not(.hidden)) main {
  max-width: 1100px;
}

.side-panel {
  background-color: var(--panel);
  border-radius: 10px;
  padding: 12px;
}

.side-panel h3 {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.side-panel li {
  background-color: rgba(232, 238, 244, 0.05);
}

#map {
  width: 100%;
  height: 380px;
  border-radius: 10px;
  margin-bottom: 8px;
  background-color: var(--panel);
}

#map-hint {
  text-align: center;
  margin-bottom: 12px;
}

/* Leaflet popup, dark theme */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background-color: var(--panel);
  color: var(--text);
}

.leaflet-popup-content button {
  margin-top: 8px;
  margin-bottom: 0;
  width: 100%;
}

.leaflet-popup-content button:disabled {
  opacity: 0.5;
  cursor: default;
}
