/* =============================================================
   Timemap – Stylesheet
   ============================================================= */

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

:root {
  --font:        'Inter', system-ui, sans-serif;
  --bg-dark:     #0d0d0d;
  --overlay-bg:  rgba(10, 10, 10, 0.82);
  --glass:       rgba(255,255,255,0.06);
  --glass-border:rgba(255,255,255,0.12);
  --accent:      #6c63ff;
  --accent-hover:#8078ff;
  --text:        #f0f0f0;
  --muted:       #888;
  --danger:      #e74c3c;
  --radius:      12px;
  --shadow:      0 8px 32px rgba(0,0,0,0.5);
  --transition:  0.3s ease;

  /* Category colours */
  --cat-love:    #e91e8c;
  --cat-social:  #1da1f2;
  --cat-action:  #f5a623;
  --cat-event:   #7ed321;
  --cat-news:    #d0021b;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text);
  overflow: hidden;
}

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

/* Leaflet dark tiles filter */
.leaflet-tile-pane {
  filter: brightness(0.8) saturate(0.7);
}

/* =============================================================
   INTRO OVERLAY
   ============================================================= */
#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--overlay-bg);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 32px;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

#intro-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 48px 56px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow);
}

.intro-card h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.intro-card h1 span {
  color: var(--accent);
}

.intro-card .tagline {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 36px;
}

.date-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 8px;
  text-align: left;
}

#intro-date {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  padding: 12px 16px;
  margin-bottom: 24px;
  outline: none;
  transition: border-color var(--transition);
}

#intro-date:focus {
  border-color: var(--accent);
}

/* Style the date picker calendar icon */
#intro-date::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.5);
  cursor: pointer;
}

#btn-start {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  padding: 14px;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s;
}

#btn-start:hover  { background: var(--accent-hover); }
#btn-start:active { transform: scale(0.98); }

.intro-footer {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 16px;
}

/* =============================================================
   TIME BAR  (bottom)
   ============================================================= */
#time-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: rgba(13,13,13,0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--glass-border);
  padding: 10px 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Needed for date-picker absolute positioning */
  position: fixed;
}

/* ---- Date Navigation ---- */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}

.date-nav-btns {
  display: flex;
  gap: 4px;
}

.tnav-btn {
  width: 34px;
  height: 38px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
  user-select: none;
}

.tnav-btn.tnav-large {
  width: 44px;
  font-size: 1.3rem;
}

.tnav-btn:hover  { background: rgba(255,255,255,0.1); border-color: var(--accent); }
.tnav-btn:active { transform: scale(0.93); }
.tnav-btn:disabled { opacity: 0.3; cursor: default; }

.date-pill {
  min-width: 240px;
  padding: 8px 22px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background var(--transition), border-color var(--transition);
}

.date-pill:hover       { background: rgba(108,99,255,0.1); border-color: var(--accent); }
.date-pill.picker-open { background: rgba(108,99,255,0.15); border-color: var(--accent); }

.date-caret {
  font-size: 0.6rem;
  color: var(--accent);
  display: inline-block;
  transition: transform var(--transition);
}

.date-pill.picker-open .date-caret { transform: rotate(180deg); }

.pin-count-badge {
  position: absolute;
  right: 0;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
}

/* ---- Date Picker Popup ---- */
.date-picker {
  position: fixed;
  bottom: 110px;        /* sits above the time bar */
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  z-index: 800;   /* above Leaflet marker-pane (600) + popup-pane (700) */
  width: 310px;
  background: rgba(14, 14, 22, 0.98);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 -16px 48px rgba(0,0,0,0.7);
  backdrop-filter: blur(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.date-picker.open {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

.dp-header {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 16px;
}

.dp-nav-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.dp-nav-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--accent); }

.dp-year-input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--accent);
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--font);
  text-align: center;
  padding: 2px 4px;
  outline: none;
  -moz-appearance: textfield;
}

.dp-year-input::-webkit-inner-spin-button,
.dp-year-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.dp-months-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 14px;
}

.dp-month {
  padding: 6px 2px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-family: var(--font);
  cursor: pointer;
  text-align: center;
  transition: all 0.13s;
}

.dp-month:hover  { background: rgba(255,255,255,0.07); color: var(--text); border-color: var(--glass-border); }
.dp-month.active { background: rgba(108,99,255,0.2); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.dp-divider {
  height: 1px;
  background: var(--glass-border);
  margin-bottom: 10px;
}

.dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 5px;
}

.dp-weekdays span {
  text-align: center;
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 0;
}

.dp-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dp-day {
  aspect-ratio: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.77rem;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}

.dp-day:hover                     { background: rgba(255,255,255,0.08); border-color: var(--glass-border); }
.dp-day.selected                  { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.dp-day.other-month               { color: rgba(255,255,255,0.18); pointer-events: none; }

/* Category filter chips */
.cat-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 7px;
  border-radius: 20px;
  font-size: 0.75rem;
  cursor: pointer;
  border: 1.5px solid transparent;
  opacity: 0.45;
  transition: opacity var(--transition), border-color var(--transition);
  user-select: none;
}

.cat-chip.active     { opacity: 1; }
.cat-chip[data-cat="love"]   { border-color: var(--cat-love);   color: var(--cat-love);   }
.cat-chip[data-cat="social"] { border-color: var(--cat-social); color: var(--cat-social); }
.cat-chip[data-cat="action"] { border-color: var(--cat-action); color: var(--cat-action); }
.cat-chip[data-cat="event"]  { border-color: var(--cat-event);  color: var(--cat-event);  }
.cat-chip[data-cat="news"]   { border-color: var(--cat-news);   color: var(--cat-news);   }

/* =============================================================
   TOP BAR (auth + add pin button)
   ============================================================= */
#top-bar {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  backdrop-filter: blur(8px);
}

.btn:hover { background: rgba(255,255,255,0.1); border-color: var(--accent); }

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

/* =============================================================
   PIN POPUP
   ============================================================= */
.leaflet-popup-content-wrapper {
  background: rgba(18,18,22,0.97) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius) !important;
  color: var(--text) !important;
  box-shadow: var(--shadow) !important;
  padding: 0 !important;
  min-width: 280px;
  max-width: 340px;
}

.leaflet-popup-tip {
  background: rgba(18,18,22,0.97) !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: 100% !important;
}

.popup-inner {
  padding: 18px 20px 16px;
}

.popup-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.popup-cat-badge.love   { background: rgba(233,30,140,0.15); color: var(--cat-love);   }
.popup-cat-badge.social { background: rgba(29,161,242,0.15); color: var(--cat-social); }
.popup-cat-badge.action { background: rgba(245,166,35,0.15); color: var(--cat-action); }
.popup-cat-badge.event  { background: rgba(126,211,33,0.15); color: var(--cat-event);  }
.popup-cat-badge.news   { background: rgba(208,2,27,0.15);   color: var(--cat-news);   }

.popup-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.3;
}

.popup-date {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.popup-desc {
  font-size: 0.85rem;
  color: rgba(240,240,240,0.75);
  margin-bottom: 12px;
  line-height: 1.5;
}

.popup-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
  margin-bottom: 12px;
}

.popup-link:hover { text-decoration: underline; }

/* Bearbeiten + Löschen im Popup */
.popup-owner-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.popup-edit-btn,
.popup-delete-btn {
  flex: 1;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s;
}
.popup-edit-btn {
  background: rgba(108, 99, 255, 0.15);
  border: 1px solid rgba(108, 99, 255, 0.4);
  color: #a39dff;
}
.popup-edit-btn:hover   { background: rgba(108, 99, 255, 0.3); }
.popup-delete-btn {
  background: rgba(220, 53, 69, 0.15);
  border: 1px solid rgba(220, 53, 69, 0.4);
  color: #ff6b7a;
}
.popup-delete-btn:hover { background: rgba(220, 53, 69, 0.3); }

/* OG Preview Image */
.popup-preview {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin: 8px 0 6px;
}

/* ================================================================
   MARKER CLUSTER (dark glass style)
   ================================================================ */
.pin-cluster {
  background: transparent !important;
  border: none !important;
}
.cluster-inner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  font-family: inherit;
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255,255,255,0.25);
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  color: #fff;
  transition: transform 0.15s;
}
.pin-cluster-small  .cluster-inner { background: rgba(108, 99, 255, 0.75); }
.pin-cluster-medium .cluster-inner { background: rgba(255, 160,  50, 0.80); width:46px; height:46px; font-size:0.95rem; }
.pin-cluster-large  .cluster-inner { background: rgba(220,  53,  69, 0.85); width:54px; height:54px; font-size:1.05rem; }
.pin-cluster:hover  .cluster-inner { transform: scale(1.12); }

/* Standard-Cluster-Styles überschreiben (werden von der CDN-CSS gesetzt) */
.marker-cluster-small  div,
.marker-cluster-medium div,
.marker-cluster-large  div { display: none; }

/* Video embed */
.popup-video {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  border-radius: 8px;
  overflow: hidden;
  margin-top: 4px;
  background: #000;
}

.popup-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* =============================================================
   ADD PIN MODAL
   ============================================================= */
#pin-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

#pin-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

#pin-modal {
  background: #16161e;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 28px 32px;
  width: min(480px, 95vw);
  box-shadow: var(--shadow);
  transform: translateY(16px);
  transition: transform var(--transition);
}

#pin-modal-backdrop.open #pin-modal {
  transform: translateY(0);
}

#pin-modal h2 {
  font-size: 1.2rem;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.form-group input,
.form-group textarea,
.form-group select {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font);
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--transition);
}

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

.form-group textarea { resize: vertical; min-height: 70px; }

.form-group select option { background: #1c1c28; }

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

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

.error-msg {
  font-size: 0.82rem;
  color: var(--danger);
  margin-top: 8px;
}

/* =============================================================
   AUTH MODAL
   ============================================================= */
#auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

#auth-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

#auth-modal {
  background: #16161e;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 36px;
  width: min(400px, 95vw);
  box-shadow: var(--shadow);
}

#auth-modal h2 { font-size: 1.3rem; margin-bottom: 4px; }
.auth-subtitle { font-size: 0.82rem; color: var(--muted); margin-bottom: 20px; }

/* ---- Social Login Buttons ---- */
.social-login-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  font-family: inherit;
}
.btn-social:hover  { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.25); }
.btn-social:active { background: rgba(255,255,255,0.15); }

.btn-google {
  border-color: rgba(66,133,244,0.4);
  padding: 0;           /* renderButton füllt den Button selbst aus */
  overflow: hidden;
  background: transparent;
}
.btn-google:hover { border-color: rgba(66,133,244,0.7); }
/* Google-iframe soll den Button komplett füllen */
.btn-google > div { width: 100% !important; }

.btn-github { border-color: rgba(255,255,255,0.15); }
.btn-github:hover { border-color: rgba(255,255,255,0.35); }

.btn-apple { border-color: rgba(255,255,255,0.15); }
.btn-apple:hover { border-color: rgba(255,255,255,0.35); }

/* ---- Divider "oder" ---- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 18px;
  color: var(--muted);
  font-size: 0.78rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

.auth-switch {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 16px;
  text-align: center;
}

.auth-switch a { color: var(--accent); cursor: pointer; text-decoration: underline; }

/* =============================================================
   CUSTOM MAP MARKERS
   ============================================================= */
.pin-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 0.15s;
}

.pin-marker:hover { transform: rotate(-45deg) scale(1.2); }

.pin-marker .pin-icon {
  transform: rotate(45deg);
  font-size: 14px;
  line-height: 1;
}

.pin-marker.love   { background: var(--cat-love);   }
.pin-marker.social { background: var(--cat-social);  }
.pin-marker.action { background: var(--cat-action);  }
.pin-marker.event  { background: var(--cat-event);   }
.pin-marker.news   { background: var(--cat-news);    }

/* Temp marker when placing a new pin */
.temp-marker-pulse {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 0 0 0 rgba(108,99,255,0.4);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0   rgba(108,99,255,0.5); }
  70%  { box-shadow: 0 0 0 12px rgba(108,99,255,0);   }
  100% { box-shadow: 0 0 0 0   rgba(108,99,255,0);    }
}

/* =============================================================
   TOAST NOTIFICATIONS
   ============================================================= */
#toast-container {
  position: fixed;
  bottom: 130px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1e1e2e;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateX(20px);
  animation: toast-in 0.3s forwards, toast-out 0.3s 3s forwards;
  pointer-events: auto;
}

.toast.success { border-left: 3px solid #7ed321; }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }

@keyframes toast-in {
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}

/* =============================================================
   PLACING PIN MODE
   ============================================================= */
body.placing-pin #map { cursor: crosshair; }

.placing-hint {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}

body.placing-pin .placing-hint { opacity: 1; }

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 600px) {
  .intro-card    { padding: 32px 24px; }
  #time-bar      { padding: 8px 12px 12px; }
  #top-bar       { top: 10px; right: 10px; gap: 6px; }
  .btn           { padding: 7px 12px; font-size: 0.8rem; }
  .cat-filters   { gap: 5px; }
  .cat-chip      { font-size: 0.68rem; padding: 2px 8px; }
  .date-pill     { min-width: 160px; font-size: 0.88rem; padding: 7px 14px; }
  .tnav-btn      { width: 30px; height: 34px; }
  .tnav-btn.tnav-large { width: 38px; }
  .date-picker   { width: calc(100vw - 24px); }
  .pin-count-badge { display: none; }
}

/* =============================================================
   DASHBOARD PANEL
   ============================================================= */

/* Dashboard-Button im Top-Bar */
.btn-dashboard {
  display: none;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

/* Overlay */
.dashboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.dashboard-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Panel */
.dashboard-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  width: min(380px, 95vw);
  background: #12121a;
  border-left: 1px solid var(--glass-border);
  box-shadow: -8px 0 48px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-panel.open {
  transform: translateX(0);
}

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

.dash-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
}

.dash-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.dash-close-btn:hover { background: rgba(255,255,255,0.12); }

/* Tabs */
.dash-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.dash-tab {
  flex: 1;
  padding: 6px 4px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.dash-tab:hover  { background: var(--glass); color: var(--text); }
.dash-tab.active { background: rgba(108,99,255,0.15); border-color: rgba(108,99,255,0.5); color: var(--accent); }

/* Body / Panes */
.dash-body {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.dash-pane {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 14px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s;
}
.dash-pane.active { opacity: 1; visibility: visible; }

/* Scrollbar */
.dash-pane::-webkit-scrollbar         { width: 4px; }
.dash-pane::-webkit-scrollbar-track   { background: transparent; }
.dash-pane::-webkit-scrollbar-thumb   { background: rgba(255,255,255,0.12); border-radius: 4px; }

/* ---- Meine Pins ---- */
.my-pins-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.my-pin-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  transition: border-color 0.15s;
}
.my-pin-item:hover { border-color: rgba(108,99,255,0.4); }

.my-pin-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.my-pin-icon.love   { background: rgba(233,30,140,0.18); }
.my-pin-icon.social { background: rgba(29,161,242,0.18); }
.my-pin-icon.action { background: rgba(245,166,35,0.18); }
.my-pin-icon.event  { background: rgba(126,211,33,0.18); }
.my-pin-icon.news   { background: rgba(208,2,27,0.18);   }

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

.my-pin-title {
  font-size: 0.86rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.my-pin-date {
  font-size: 0.71rem;
  color: var(--muted);
  margin-top: 2px;
}

.my-pin-jump {
  background: transparent;
  border: 1px solid transparent;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 6px;
  transition: background 0.15s, border-color 0.15s;
  color: var(--muted);
  flex-shrink: 0;
}
.my-pin-jump:hover { background: rgba(255,255,255,0.08); border-color: var(--glass-border); color: var(--text); }

.dash-loading, .dash-empty, .dash-error {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 40px 0;
}
.dash-error { color: var(--danger); }

/* ---- Account Tab ---- */
.account-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 20px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 16px;
}

.account-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(108,99,255,0.2);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.account-details { flex: 1; min-width: 0; }

.account-username {
  font-size: 1rem;
  font-weight: 600;
}

.account-email {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-joined {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.28);
  margin-top: 5px;
}

/* Stats */
.account-stats {
  display: flex;
  gap: 10px;
}

.stat-card {
  flex: 1;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ---- Settings Tab ---- */
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.85rem;
}
.settings-label { color: var(--muted); }
.settings-value { color: var(--text); font-weight: 500; }

.btn-danger-soft {
  width: 100%;
  margin-top: 24px;
  padding: 10px;
  background: rgba(220,53,69,0.1);
  border: 1px solid rgba(220,53,69,0.35);
  border-radius: 8px;
  color: #ff6b7a;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}
.btn-danger-soft:hover { background: rgba(220,53,69,0.2); border-color: rgba(220,53,69,0.6); }

/* Responsive */
@media (max-width: 600px) {
  .dashboard-panel { width: 100vw; }
  .dash-tab { font-size: 0.68rem; }
}

/* =============================================================
   LANGUAGE SWITCHER
   ============================================================= */

/* Intro card – centered row */
.lang-switcher {
  display: flex;
  gap: 5px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

/* Compact inline variant used in Dashboard settings row */
.lang-switcher-settings {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin: 0;
}

.lang-btn {
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  color: var(--muted);
  font-size: 0.7rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}

.lang-btn:hover {
  background: var(--glass);
  color: var(--text);
  border-color: rgba(255,255,255,0.25);
}

.lang-btn.active {
  background: rgba(108,99,255,0.18);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* =============================================================
   LEGAL BAR (Impressum · Datenschutz – top-left)
   ============================================================= */
#legal-bar {
  position: fixed;
  bottom: 100px;   /* oberhalb der Time-Bar (~90px hoch) */
  left: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
}

.legal-link {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  font-size: 0.7rem;
  font-family: var(--font);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}
.legal-link:hover { color: rgba(255,255,255,0.85); }

.legal-sep {
  color: rgba(255,255,255,0.28);
  font-size: 0.65rem;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

/* Im Dashboard-Settings-Tab */
.legal-settings-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legal-settings-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.82rem;
  font-family: var(--font);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}
.legal-settings-btn:hover { color: var(--accent-hover); }

/* =============================================================
   LEGAL MODAL (Impressum / Datenschutz)
   ============================================================= */
#legal-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

#legal-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

#legal-modal {
  background: #15151e;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  width: min(620px, 95vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

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

.legal-modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.legal-modal-body {
  overflow-y: auto;
  padding: 24px;
  flex: 1;
  font-size: 0.85rem;
  line-height: 1.7;
  color: rgba(240,240,240,0.8);
}

.legal-modal-body::-webkit-scrollbar         { width: 4px; }
.legal-modal-body::-webkit-scrollbar-track   { background: transparent; }
.legal-modal-body::-webkit-scrollbar-thumb   { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* Typografie im Modal */
.legal-modal-body h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 22px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--glass-border);
}

.legal-modal-body h3:first-child { margin-top: 0; }

.legal-modal-body p  { margin-bottom: 10px; }
.legal-modal-body ul { margin: 6px 0 10px 18px; }
.legal-modal-body li { margin-bottom: 3px; }

.legal-modal-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-addr {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 8px 0 12px;
  font-style: normal;
  line-height: 1.8;
}

/* =============================================================
   MOBILE / TOUCH OPTIMIZATIONS
   ============================================================= */

/* 1. Remove tap flash globally */
* { -webkit-tap-highlight-color: transparent; }

/* 2. Safe-area padding for fixed bars (desktop = 0px, iOS = actual inset) */
#time-bar {
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}
#legal-bar {
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}
#toast-container {
  bottom: calc(130px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 600px) {

  /* ---- Safe-area: mobile overrides ---- */
  #time-bar {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  #legal-bar {
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }
  #toast-container {
    right: 12px;
    left:  12px;
    bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  }
  .toast { font-size: 0.82rem; }

  /* ---- Status-bar offset for fixed top elements ---- */
  #top-bar       { top: calc(10px + env(safe-area-inset-top, 0px)); }
  .placing-hint  { top: calc(16px + env(safe-area-inset-top, 0px)); }

  /* ---- Touch targets: ≥ 44px tall ---- */
  .tnav-btn             { height: 44px; }
  .tnav-btn.tnav-large  { width: 44px; height: 44px; }
  .lang-btn             { padding: 6px 10px; font-size: 0.75rem; }

  /* ---- Category chips: horizontal scroll instead of wrap ---- */
  .cat-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 4px 2px;
    margin: 0 -4px;
  }
  .cat-filters::-webkit-scrollbar { display: none; }
  .cat-chip { flex-shrink: 0; padding: 5px 10px; }

  /* ---- iOS input zoom prevention (font-size must be ≥ 16px) ---- */
  .form-group input,
  .form-group textarea,
  .form-group select,
  #dp-year-input,
  #auth-email,
  #auth-password,
  #auth-username { font-size: 16px; }

  /* ---- Form row: single column ---- */
  .form-row { grid-template-columns: 1fr; gap: 0; }

  /* ---- Modal actions: full-width buttons ---- */
  .modal-actions .btn { flex: 1; justify-content: center; }

  /* ================================================================
     BOTTOM SHEETS – Pin Modal
  ================================================================ */
  #pin-modal-backdrop { align-items: flex-end; }

  #pin-modal {
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 8px 18px calc(24px + env(safe-area-inset-bottom, 0px));
    max-height: 92vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
  #pin-modal-backdrop.open #pin-modal { transform: translateY(0); }

  /* Drag-handle pill */
  #pin-modal::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.18);
    border-radius: 2px;
    margin: 0 auto 18px;
  }

  /* ================================================================
     BOTTOM SHEETS – Auth Modal
  ================================================================ */
  #auth-modal-backdrop { align-items: flex-end; }

  #auth-modal {
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 8px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    max-height: 92vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
  #auth-modal-backdrop.open #auth-modal { transform: translateY(0); }

  #auth-modal::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.18);
    border-radius: 2px;
    margin: 0 auto 18px;
  }

  /* ================================================================
     BOTTOM SHEETS – Legal Modal
  ================================================================ */
  #legal-modal-backdrop { align-items: flex-end; }

  #legal-modal {
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 88vh;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }
  #legal-modal-backdrop.open #legal-modal { transform: translateY(0); }

  #legal-modal::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.18);
    border-radius: 2px;
    margin: 10px auto 0;
  }
  .legal-modal-header { padding-top: 14px; }

  /* ================================================================
     LEAFLET POPUP – Constrain to viewport
  ================================================================ */
  .leaflet-popup-content-wrapper {
    min-width: unset !important;
    max-width: calc(100vw - 32px) !important;
  }
  .leaflet-popup { max-width: calc(100vw - 32px) !important; }

}
