
/* ============================
   Base / Reset
   ============================ */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f5f5;
  color: #222;
}

/* ============================
   Header (Mobile-first)
   ============================ */

header {
  background: #1f2933;
  color: #ffffff;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: center;
}

header h1 {
  font-size: 1.2rem;
  margin: 0;
}

#user-info {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

#user-label {
  opacity: 0.9;
  cursor: pointer; /* allow “tap to change nickname” */
}

/* Hide nickname button on mobile, accessible via label tap */
#set-nickname-btn {
  display: none;
}

/* ============================
   Main Layout
   ============================ */

main {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

section h2 {
  margin: 0.25rem 0 0.5rem;
}

.section-header {
  margin-bottom: 0.5rem; /* identical to: section h2 { margin: 0.25rem 0 0.5rem; } */
}

/* ============================
   Buttons (Thumb-friendly)
   ============================ */

.btn {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  border: 1px solid #9aa5b1;
  background: #e5e7eb;
  color: #111827;
  font-size: 1rem;
  cursor: pointer;
}

.btn:hover {
  background: #d1d5db;
}

.btn-primary {
  background: #2563eb;
  color: white;
  border-color: #1d4ed8;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: #f3f4f6;
}

/* Action modal button variants */
.btn-action-primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  font-weight: 600;
}

.btn-action-secondary {
  background: #f8fafc;
}

.btn-action-destructive {
  background: #fee2e2;
  border-color: #fecaca;
  color: #7f1d1d;
}

.btn-action-cancel {
  margin-top: 0.5rem;
  background: #ffffff;
}

.modal-actions .btn {
  width: 100%;
}

/* ============================
   Charger Grid (Responsive)
   ============================ */

#charger-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 0.5rem;
}

.charger {
  padding: 0.6rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  font-size: 0.85rem;
}

/* Charger states */
.available {
  background: #dcfce7;
}

.occupied {
  background: #dbeafe;
}

.done {
  background: #fef3c7;
}

.broken {
  background: #fee2e2;
}

/* My charger highlight */
.charger.mine {
  outline: 3px solid #2563eb;
  position: relative;
}

.charger.mine::after {
  content: "ME";
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.65rem;
  font-weight: bold;
  color: #1e40af;
}

/* ============================
   Queue Summary (Key Mobile UX)
   ============================ */

.queue-summary {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  padding: 0.75rem;
  border-radius: 6px;
  text-align: center;
  margin-bottom: 0.5rem;
}

.queue-summary.hidden {
  display: none;
}

.queue-summary .queue-pos {
  font-size: 1.4rem;
  font-weight: bold;
}

.queue-summary .queue-ahead {
  font-size: 0.9rem;
  color: #475569;
}

/* ============================
   Queue Actions
   ============================ */

#queue-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================
   Queue List
   ============================ */

#queue-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
}

#queue-list li {
  padding: 0.35rem 0.4rem;
  font-size: 0.9rem;
}

/* Highlight self */
#queue-list li.me {
  font-weight: bold;
  background: #e0f2fe;
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
}

@media (max-width: 480px) {
  #queue-list {
    max-height: 200px;
    overflow-y: auto;
  }
}

/* ============================
   Muted text
   ============================ */

.muted {
  color: #6b7280;
  font-size: 0.9rem;
}

/* ============================
   Modals
   ============================ */

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 999;
}

.modal-content {
  background: white;
  border-radius: 6px;
  padding: 1rem;
  width: 100%;
  max-width: 360px;
}

.modal-content h3 {
  margin-top: 0;
}

.modal-content input {
  width: 100%;
  padding: 0.6rem;
  font-size: 1rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}


.modal-actions {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}


/* ============================
   Install Hint (unchanged, mobile-first)
   ============================ */

.install-hint.hidden {
  display: none;
}

.install-hint {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  background: #0f172a;
  color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  padding: 0.75rem;
  z-index: 1000;
}

.install-hint__content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.install-hint__text {
  font-size: 0.95rem;
  line-height: 1.35rem;
}

/* ============================
   Larger Screens (Optional polish only)
   ============================ */

@media (min-width: 768px) {
  header {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }

  #set-nickname-btn {
    display: inline-block;
  }
}

queue-summary {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  padding: 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  text-align: center;
}

.queue-summary .queue-pos {
  font-size: 1.4rem;
  font-weight: bold;
}

.queue-summary .queue-ahead {
  color: #475569;
  font-size: 0.9rem;
}

/* Map overlay image responsive sizing */
#map-overlay .modal-content img {
  max-width: 100%;
  max-height: 80vh;   /* prevents vertical overflow */
  width: auto;
  height: auto;
  display: block;
  border-radius: 6px;
}

#map-overlay .modal-content {
  width: auto;
  max-width: 90vw;
  max-height: 90vh;
}

/* Fix checkbox alignment in nickname modal */
#nickname-modal input[type="checkbox"] {
  width: auto !important;      /* undo width:100% */
  margin: 0;                   /* reset mobile spacing */
}

#nickname-modal .checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

#nickname-modal .checkbox-row span {
  flex: 1;                     /* allow label text to span full width */
}

/* --- Map button (ghost + icon) --- */
.btn-ghost {
  background: transparent;
  border: 1px solid currentColor;
  color: #111827;
}
.btn-ghost:hover {
  background: rgba(17, 24, 39, 0.06);
}

.btn-icon-left {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  line-height: 1;
  padding: 0.6rem 0.85rem; /* slightly tighter than default .btn */
}

/* optional: subtle rounded-pill look for secondary CTAs */
.btn-ghost.rounded-pill {
  border-radius: 999px;
}

/* --- Charger tile typography --- */
.charger-id {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.1rem;
  margin-bottom: 0.2rem;
}

.charger-occupant {
  font-weight: 500;
  font-size: 0.8rem;
  color: #374151;          /* a bit darker than .muted for readability */
  line-height: 1.1rem;
  opacity: 0.9;

  /* single-line, no-wrap, graceful truncation */
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  /* ensure it respects charger padding and grid width */
  max-width: 100%;
}

/* Checkbox row utility for modals/forms */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .75rem 0;
}

#nickname-modal input[type="checkbox"] {
  width: auto !important;     /* override global input width */
  margin: 0;
}
#nickname-modal .checkbox-row span {
  flex: 1;                    /* let text flow across the row */
}