/* Tem Gelo? – styles */
:root {
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --radius: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ========== PUBLIC MAP ========== */
#map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* Top bar */
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: linear-gradient(to bottom, rgba(15,23,42,0.95), transparent);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.logo {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.logo span {
  color: var(--green);
}

.badge {
  background: var(--card);
  color: var(--muted);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #334155;
}

/* Safety banner */
.safety-banner {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #7f1d1d;
  color: #fecaca;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  font-size: 0.8rem;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}

.safety-banner strong {
  color: white;
}

.safety-banner button {
  background: transparent;
  border: none;
  color: #fecaca;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}

/* Legend */
.legend {
  position: absolute;
  top: calc(70px + var(--safe-top));
  right: 12px;
  z-index: 1000;
  background: var(--card);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.8rem;
  border: 1px solid #334155;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.green { background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,0.3); }
.dot.red { background: var(--red); box-shadow: 0 0 0 3px rgba(239,68,68,0.3); }

/* Popup styles (Leaflet) */
.leaflet-popup-content-wrapper {
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  border: 1px solid #334155;
}

.leaflet-popup-content {
  margin: 14px 16px;
  min-width: 200px;
}

.leaflet-popup-tip {
  background: var(--card);
}

.popup-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.popup-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin: 4px 0;
}

.popup-row span:last-child {
  font-weight: 600;
}

.popup-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.popup-status.ok {
  background: rgba(34,197,94,0.2);
  color: #4ade80;
}

.popup-status.no {
  background: rgba(239,68,68,0.2);
  color: #f87171;
}

.btn-wa {
  display: block;
  width: 100%;
  margin-top: 12px;
  background: #25d366;
  color: white;
  text-align: center;
  padding: 10px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.btn-wa:active {
  opacity: 0.9;
}

.btn-report {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: transparent;
  color: var(--muted);
  border: 1px solid #475569;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
}

/* ========== ADMIN ========== */
.admin-body {
  background: #0f172a;
  min-height: 100vh;
  padding: 20px 16px calc(20px + var(--safe-bottom));
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
}

.admin-header h1 span {
  color: var(--green);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  color: white;
}

.btn-primary { background: var(--primary); }
.btn-green { background: var(--green); color: #052e16; }
.btn-red { background: var(--red); }
.btn-ghost {
  background: transparent;
  border: 1px solid #475569;
  color: var(--muted);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid #334155;
}

.card h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #475569;
  background: #0f172a;
  color: var(--text);
  font-size: 16px; /* prevent zoom on iOS */
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.seller-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.seller-item {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.seller-item .info {
  flex: 1;
  min-width: 0;
}

.seller-item .name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seller-item .meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.status-pill {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.status-pill.ok { background: rgba(34,197,94,0.2); color: #4ade80; }
.status-pill.no { background: rgba(239,68,68,0.2); color: #f87171; }

.actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.actions button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: #1e293b;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
}

.actions button:hover {
  background: #334155;
  color: white;
}

/* Login */
.login-box {
  max-width: 360px;
  margin: 80px auto;
  background: var(--card);
  padding: 28px 24px;
  border-radius: var(--radius);
  border: 1px solid #334155;
}

.login-box h2 {
  text-align: center;
  margin-bottom: 20px;
}

.login-box input {
  width: 100%;
  padding: 12px;
  margin-bottom: 14px;
  border-radius: 8px;
  border: 1px solid #475569;
  background: #0f172a;
  color: white;
  font-size: 16px;
}

.login-box button {
  width: 100%;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.modal {
  background: var(--card);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  border: 1px solid #334155;
}

.modal h3 {
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions .btn {
  flex: 1;
}

/* Utility */
.hidden { display: none !important; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 0.85rem; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }

/* Leaflet marker icons override */
.custom-marker {
  background: transparent;
  border: none;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
  }
  .modal {
    border-radius: 16px;
  }
}
