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

:root {
  --bg: #0a0e1a;
  --surface: #141929;
  --surface2: #1e2640;
  --border: #2a3350;
  --text: #e8eaf6;
  --text-muted: #8892b0;
  --accent: #5c9eff;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ---- Auth ---- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 50%, #1a2040 0%, #0a0e1a 70%);
}

.auth-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.auth-card h1 {
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #5c9eff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 28px;
}

.tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.tab.active {
  background: var(--surface2);
  color: var(--text);
  font-weight: 600;
}

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

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--accent);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #4a7fe8, #7c5af0);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  margin-top: 4px;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }

.error-msg {
  color: #ff6b6b;
  font-size: 0.85rem;
  margin-top: 10px;
  min-height: 20px;
}

/* Colour picker */
.color-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.color-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.color-btn:hover { transform: scale(1.15); }
.color-btn.active { border-color: white; transform: scale(1.15); }

/* ---- App layout ---- */
#app-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  background: rgba(20, 25, 41, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  z-index: 10;
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 14px; }

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #5c9eff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.anniversary-badge {
  background: rgba(92, 158, 255, 0.15);
  border: 1px solid rgba(92, 158, 255, 0.3);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.8rem;
  color: var(--accent);
}

.topbar-right { display: flex; align-items: center; gap: 14px; }

.user-indicators {
  display: flex;
  gap: 10px;
}

.user-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

.btn-logout {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* Globe */
#globe-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Side panel */
.side-panel {
  position: absolute;
  top: 56px;
  right: 0;
  bottom: 0;
  width: 320px;
  background: rgba(14, 19, 35, 0.92);
  border-left: 1px solid var(--border);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  z-index: 5;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-export {
  padding: 3px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-export:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.dest-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 12px;
}

/* Add form */
.add-form {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.add-row {
  display: flex;
  gap: 8px;
}

.add-row input {
  flex: 1;
  padding: 9px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.add-row input:focus { border-color: var(--accent); }

.note-input {
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.note-input:focus {
  border-color: var(--accent);
  color: var(--text);
}

.btn-add {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #4a7fe8, #7c5af0);
  color: white;
  font-size: 1.4rem;
  font-weight: 300;
  cursor: pointer;
  transition: opacity 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding-bottom: 2px;
}

.btn-add:hover { opacity: 0.85; }

/* Destination list */
.dest-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.dest-list::-webkit-scrollbar { width: 4px; }
.dest-list::-webkit-scrollbar-track { background: transparent; }
.dest-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.dest-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  transition: background 0.15s;
  cursor: default;
}

.dest-item:hover { background: rgba(255,255,255,0.03); }

.dest-pin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  box-shadow: 0 0 6px currentColor;
}

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

.dest-name {
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dest-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.dest-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dest-edit, .dest-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  padding: 0 2px;
  flex-shrink: 0;
}

.dest-item:hover .dest-edit,
.dest-item:hover .dest-delete { opacity: 1; }
.dest-edit:hover { color: var(--accent); }
.dest-delete:hover { color: #ff6b6b; }

.dest-item--editing {
  flex-direction: column;
  align-items: stretch;
  padding: 10px 16px;
}

.dest-edit-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-input {
  padding: 7px 10px;
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
}

.edit-input--note {
  border-color: var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.edit-input--note:focus {
  border-color: var(--accent);
  color: var(--text);
}

.edit-error { margin: 0; min-height: 16px; font-size: 0.78rem; }

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

.btn-save {
  flex: 1;
  padding: 6px;
  background: linear-gradient(135deg, #4a7fe8, #7c5af0);
  border: none;
  border-radius: 7px;
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-save:hover { opacity: 0.85; }

.btn-cancel {
  flex: 1;
  padding: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel:hover { border-color: var(--text-muted); color: var(--text); }

.loading-dots::after {
  content: '...';
  animation: dots 1s steps(3, end) infinite;
}

@keyframes dots {
  0%, 33% { content: '.'; }
  34%, 66% { content: '..'; }
  67%, 100% { content: '...'; }
}

.globe-tooltip {
  background: rgba(14, 19, 35, 0.95) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  font-family: inherit !important;
  color: var(--text) !important;
  font-size: 0.85rem !important;
  pointer-events: none;
}

/* Responsive: hide panel on small screens, show toggle */
@media (max-width: 640px) {
  .side-panel {
    width: 100%;
    top: auto;
    bottom: 0;
    left: 0;
    height: 45vh;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  #globe-container {
    height: 55vh;
    flex: none;
  }
}
