/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: #f5f5f0;
  color: #1a1a1a;
  line-height: 1.6;
  min-height: 100vh;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border: none; border-radius: 8px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all .15s ease;
}
.btn-primary { background: #2d5016; color: #fff; }
.btn-primary:hover { background: #3a6b1e; }
.btn-outline { background: transparent; color: #555; border: 1px solid #ccc; }
.btn-outline:hover { background: #f0f0f0; }
.app-header .btn-outline { color: #fff; border-color: rgba(255,255,255,.5); }
.app-header .btn-outline:hover { background: rgba(255,255,255,.15); }
.btn-danger { background: #c53030; color: #fff; }
.btn-danger:hover { background: #e53e3e; }
.btn-small { padding: 6px 14px; font-size: 13px; }

/* ===== LOGIN PAGE ===== */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: #f7f5f2;
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(61,107,53,.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(61,107,53,.05) 0%, transparent 50%);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 48px 40px;
  width: 100%; max-width: 380px; text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.04);
  position: relative; z-index: 1; border: 1px solid rgba(0,0,0,.04);
}
.login-title {
  font-size: 24px; font-weight: 700; color: #2a4d24; margin-bottom: 2px;
  letter-spacing: -0.03em;
}
.login-subtitle {
  font-size: 13px; color: #9a9690; margin-bottom: 36px;
}
.login-form input[type="password"] {
  width: 100%; padding: 13px 16px; border: 1.5px solid #e8e6e2;
  border-radius: 10px; font-size: 15px; margin-bottom: 14px;
  transition: all .2s; background: #f7f5f2;
}
.login-form input:focus { outline: none; border-color: #3d6b35; background: #fff; box-shadow: 0 0 0 3px #e8f0e6; }
.login-form .btn { width: 100%; padding: 13px; font-size: 15px; border-radius: 10px; }
.error-msg {
  color: #c53030; font-size: 13px; margin-top: 12px;
}

/* ===== APP HEADER ===== */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; background: #2d5016; color: #fff;
}
.app-title { font-size: 20px; font-weight: 700; }

/* ===== TAB NAVIGATION ===== */
.tab-nav {
  display: flex; background: #fff; border-bottom: 2px solid #e5e5e0;
  padding: 0 24px; gap: 0;
}
.tab-btn {
  padding: 14px 24px; border: none; background: none;
  font-size: 15px; font-weight: 500; color: #777; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  transition: all .15s;
}
.tab-btn:hover { color: #333; }
.tab-btn.active { color: #2d5016; border-bottom-color: #2d5016; font-weight: 600; }

/* ===== TAB CONTENT ===== */
.tab-content { display: none; padding: 32px 24px; max-width: 960px; margin: 0 auto; }
.tab-content.active { display: block; }

/* ===== WELCOME ===== */
.welcome-section h2 { font-size: 24px; margin-bottom: 12px; color: #2d5016; }
.welcome-section p { font-size: 15px; color: #555; margin-bottom: 20px; }
.info-card, .gdpr-card {
  background: #fff; border-radius: 12px; padding: 24px;
  margin-bottom: 16px; border: 1px solid #e5e5e0;
}
.info-card h3, .gdpr-card h3 { font-size: 16px; margin-bottom: 10px; color: #333; }
.info-card ul, .gdpr-card ul { padding-left: 20px; }
.info-card li, .gdpr-card li { font-size: 14px; color: #555; margin-bottom: 6px; }
.gdpr-card { border-left: 4px solid #2d5016; }

/* ===== CONTACTS ===== */
.contacts-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.contacts-header h2 { font-size: 24px; color: #2d5016; }
.contacts-grid {
  display: flex; flex-direction: column; gap: 16px;
}

/* Plot bubbles */
.plot-bubble {
  background: #fff; border-radius: 14px;
  border: 1px solid #e5e5e0; overflow: hidden;
  transition: box-shadow .15s;
}
.plot-bubble:hover { box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.plot-bubble-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; cursor: pointer;
  background: #f9f9f6; border-bottom: 1px solid #e5e5e0;
  transition: background .15s;
}
.plot-bubble-header:hover { background: #f0f0ea; }
.plot-bubble-title {
  font-size: 16px; font-weight: 700; color: #2d5016;
}
.plot-bubble-count {
  font-size: 13px; color: #888; flex: 1;
}
.plot-add-btn { padding: 4px 10px !important; font-size: 14px !important; }
.plot-bubble-chevron {
  font-size: 14px; color: #aaa; transition: transform .2s;
}
.plot-bubble.collapsed .plot-bubble-chevron { transform: rotate(-90deg); }
.plot-bubble-body {
  padding: 12px 20px 16px; display: flex; flex-direction: column; gap: 10px;
}
.plot-bubble.collapsed .plot-bubble-body { display: none; }

.contact-card {
  background: #fafaf6; border-radius: 10px; padding: 16px;
  border: 1px solid #eeece6; position: relative;
  transition: box-shadow .15s;
}
.contact-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.card-actions {
  position: absolute; top: 10px; right: 10px;
  display: flex; gap: 4px;
}
.edit-btn, .delete-btn {
  background: none; border: none; cursor: pointer;
  font-size: 16px; padding: 4px 8px; border-radius: 6px;
  color: #bbb; transition: all .15s;
}
.edit-btn:hover { color: #2d5016; background: #f0f8e8; }
.delete-btn:hover { color: #c53030; background: #fef2f2; }
.contact-card .card-name { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.contact-card .card-detail {
  font-size: 14px; color: #555; display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
}

.empty-msg { text-align: center; color: #999; font-size: 15px; padding: 40px 0; }

/* ===== MODAL ===== */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.modal-content {
  position: relative; background: #fff; border-radius: 16px;
  padding: 32px; width: 100%; max-width: 480px; z-index: 1;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-small { max-width: 380px; }
.modal-content h3 { font-size: 20px; margin-bottom: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; color: #333; margin-bottom: 6px; }
.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="email"] {
  width: 100%; padding: 12px 14px; border: 2px solid #e0e0e0;
  border-radius: 8px; font-size: 16px; /* 16px forhindrer iOS auto-zoom */
}
.form-group input:focus { outline: none; border-color: #2d5016; }
.consent-group { margin-top: 20px; }
.checkbox-label {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13px; color: #555; cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0;
  accent-color: #2d5016;
}
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ===== MAP ===== */
.map-container {
  position: relative; width: 100%; max-width: 100%;
  border-radius: 12px; border: 1px solid #e5e5e0;
  background: #e8e8e0;
}
.map-container img { border-radius: 12px; }
.map-image { width: 100%; display: block; }
.map-svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.map-svg polygon, .map-svg path {
  fill: rgba(255, 255, 255, 0.15); stroke: #fff;
  stroke-width: 2.5; cursor: pointer;
  transition: all .2s ease;
  filter: drop-shadow(0 0 2px rgba(0,0,0,.4));
}
.map-svg polygon:hover, .map-svg path:hover {
  fill: rgba(45, 80, 22, 0.4); stroke: #7fff00; stroke-width: 3.5;
  filter: drop-shadow(0 0 6px rgba(127,255,0,.5));
}
.map-popup {
  position: absolute; z-index: 1000;
  background: #fff; border-radius: 10px; padding: 14px 18px;
  box-shadow: 0 6px 24px rgba(0,0,0,.15); pointer-events: none;
  max-width: 260px; font-size: 14px;
  transform: translate(-50%, -100%); margin-top: -12px;
}
.map-popup::after {
  content: ''; position: absolute; left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
}
.map-popup.above::after { top: 100%; border-top-color: #fff; }
.map-popup.below::after { bottom: 100%; border-bottom-color: #fff; }
.map-popup .popup-plot { font-size: 11px; font-weight: 700; color: #2d5016; text-transform: uppercase; letter-spacing: 0.5px; }
.map-popup .popup-name { font-size: 15px; font-weight: 600; margin: 4px 0; }
.map-popup .popup-detail { font-size: 13px; color: #555; }
.map-popup .popup-empty { color: #999; font-style: italic; }
.section-desc { color: #777; font-size: 14px; margin-bottom: 20px; }

/* ===== HELP BUTTON ===== */
.help-btn {
  position: fixed; bottom: 24px; right: 24px; z-index: 900;
  width: 44px; height: 44px; border-radius: 50%;
  background: #2d5016; color: #fff; border: none;
  font-size: 20px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  transition: all .2s;
}
.help-btn:hover { background: #3a6b1e; transform: scale(1.05); }
.help-popup {
  position: fixed; bottom: 80px; right: 24px; z-index: 900;
  background: #fff; border-radius: 12px; padding: 20px 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15); max-width: 300px;
  border: 1px solid #e5e5e0;
}
.help-popup[hidden] { display: none; }
.help-popup p { font-size: 14px; color: #555; margin-bottom: 4px; }
.help-popup p strong { color: #2d5016; }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  /* Header */
  .app-header { padding: 12px 16px; }
  .app-title { font-size: 16px; }

  /* Tabs */
  .tab-nav { padding: 0 12px; }
  .tab-btn { padding: 12px 16px; font-size: 14px; }

  /* Content */
  .tab-content { padding: 16px; }
  .contacts-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .contacts-header h2 { font-size: 20px; }

  /* Login */
  .login-card { margin: 16px; padding: 32px 24px; }

  /* Modal */
  .modal-content {
    margin: 12px; padding: 24px;
    max-height: 90vh; overflow-y: auto;
  }

  /* Kontaktkort: altid vis actions på touch */
  .contact-card .card-actions { opacity: 1; }
  .contact-card { padding: 14px; }

  /* Plot bubbles */
  .plot-bubble-header { padding: 14px 16px; }
  .plot-bubble-body { padding: 8px 12px 12px; }
  .plot-bubble-title { font-size: 15px; }

  /* Kort */
  .map-container { border-radius: 8px; }
  .map-svg text { font-size: 10px !important; }
  .map-popup {
    max-width: 200px; font-size: 13px;
    padding: 10px 14px;
  }
  .section-desc { font-size: 13px; }
}
