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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #0f0f0f;
  color: #e0e0e0;
}

/* --- Header bar --- */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  background: #1a1a2e;
  border-bottom: 1px solid #2a2a4a;
  flex-shrink: 0;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-left h1 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.role-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge.editor {
  background: #2d6a4f;
  color: #95d5b2;
}

.role-badge.viewer {
  background: #3a3a5c;
  color: #a0a0d0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #aaa;
}

#btn-add-pin {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  background: #3a86ff;
  color: #fff;
  border: none;
  border-radius: 50px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#btn-add-pin:hover {
  background: #2b6de0;
}

.temp-pin .pin-icon {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* --- Buttons --- */

button {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

button:active {
  transform: scale(0.97);
}

.btn-primary {
  background: #3a86ff;
  color: #fff;
}

.btn-primary:hover {
  background: #2b6de0;
}

.btn-secondary {
  background: #2a2a4a;
  color: #ccc;
}

.btn-secondary:hover {
  background: #3a3a5c;
}

.btn-danger {
  background: #c1121f;
  color: #fff;
}

.btn-danger:hover {
  background: #a01018;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* --- Map --- */

#map {
  flex: 1;
  width: 100%;
}

/* --- Custom pin markers --- */

.custom-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  cursor: pointer;
  transition: transform 0.15s;
}

.custom-pin:hover {
  transform: scale(1.2);
}

/* --- Info window --- */

.info-window h3 {
  margin-bottom: 4px;
  font-size: 15px;
  color: #222;
}

.info-window p {
  font-size: 13px;
  color: #555;
  margin-bottom: 4px;
}

.info-meta {
  font-size: 11px;
  color: #999;
}

.info-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.info-actions button {
  font-size: 12px;
  padding: 4px 10px;
}

/* --- Dialog overlay --- */

.dialog-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  background: rgba(0,0,0,0.6);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.dialog {
  background: #1e1e36;
  border: 1px solid #3a3a5c;
  border-radius: 12px;
  padding: 24px;
  width: 360px;
  max-width: 90vw;
}

.dialog h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: #fff;
}

.dialog label {
  display: block;
  font-size: 12px;
  color: #aaa;
  margin-bottom: 4px;
  margin-top: 12px;
}

.dialog input,
.dialog textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #3a3a5c;
  border-radius: 6px;
  background: #12122a;
  color: #e0e0e0;
  font-family: inherit;
  font-size: 14px;
}

.dialog textarea {
  resize: vertical;
  min-height: 60px;
}

.dialog input:focus,
.dialog textarea:focus {
  outline: none;
  border-color: #3a86ff;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* --- Login page --- */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: #0f0f0f;
}

.login-card {
  background: #1e1e36;
  border: 1px solid #3a3a5c;
  border-radius: 12px;
  padding: 32px;
  width: 380px;
  max-width: 90vw;
}

.login-card h1 {
  font-size: 22px;
  margin-bottom: 4px;
  color: #fff;
}

.login-card .subtitle {
  font-size: 13px;
  color: #888;
  margin-bottom: 24px;
}

.login-card label {
  display: block;
  font-size: 12px;
  color: #aaa;
  margin-bottom: 4px;
  margin-top: 14px;
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #3a3a5c;
  border-radius: 6px;
  background: #12122a;
  color: #e0e0e0;
  font-size: 14px;
}

.login-card input:focus {
  outline: none;
  border-color: #3a86ff;
}

.login-card .btn-primary {
  width: 100%;
  padding: 10px;
  margin-top: 20px;
  font-size: 15px;
}

.login-card .toggle-link {
  display: block;
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
  color: #3a86ff;
  cursor: pointer;
}

.login-card .toggle-link:hover {
  text-decoration: underline;
}

.error-msg {
  margin-top: 12px;
  font-size: 13px;
  color: #ff6b6b;
  text-align: center;
}

/* --- Responsive --- */

@media (max-width: 600px) {
  .header {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px;
    gap: 6px;
  }

  .header-right {
    font-size: 12px;
  }

  .dialog, .login-card {
    width: 95vw;
  }
}
