/* InterPACK 2026 Field Map — v1.2 */

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

:root {
  --h2w-blue: #0057a8;
  --green:    #1e7e1e;
  --yellow:   #a07800;
  --grey:     #666;
  --red:      #c00;
  --panel-w:  340px;
  --bar-h:    52px;
  --font:     -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

html, body { height: 100%; overflow: hidden; font-family: var(--font); }

/* ── password gate ───────────────────────────────────────────────────────── */

#gate {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--h2w-blue);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s;
}
.gate-card {
  background: #fff; border-radius: 12px; padding: 40px 36px;
  width: 320px; text-align: center; box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}
.gate-logo { font-size: 18px; font-weight: 800; color: var(--h2w-blue); margin-bottom: 6px; }
.gate-card p { font-size: 12px; color: #888; margin-bottom: 28px; }
.gate-card input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid #ddd; border-radius: 6px;
  font-size: 15px; font-family: var(--font);
  text-align: center; letter-spacing: 2px; outline: none;
}
.gate-card input:focus { border-color: var(--h2w-blue); }
.gate-card button {
  margin-top: 12px; width: 100%; padding: 12px;
  background: var(--h2w-blue); color: #fff;
  border: none; border-radius: 6px;
  font-size: 14px; font-weight: 700; font-family: var(--font); cursor: pointer;
}
.gate-card button:hover { background: #004490; }
.gate-error { color: #c00; font-size: 12px; margin-top: 8px; min-height: 1.2em; }

/* ── filter bar ──────────────────────────────────────────────────────────── */

#filter-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--bar-h);
  background: var(--h2w-blue); color: #fff;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; z-index: 1000;
  flex-wrap: nowrap; overflow-x: auto;
}

#bar-title {
  font-size: 14px; font-weight: 700; white-space: nowrap;
  margin-right: 4px; flex-shrink: 0;
}

.chip-group { display: flex; gap: 4px; flex-shrink: 0; }

.chip {
  padding: 3px 8px; border-radius: 12px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1.5px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.12); color: #fff;
  white-space: nowrap; transition: background 0.15s; user-select: none;
}
.chip:hover  { background: rgba(255,255,255,0.25); }
.chip.active { background: #fff; color: var(--h2w-blue); border-color: #fff; }
.chip.day-all { border-color: rgba(255,255,255,0.7); }
.chip.s-green  { background: var(--green);  border-color: var(--green);  }
.chip.s-yellow { background: var(--yellow); border-color: var(--yellow); }
.chip.s-grey   { background: var(--grey);   border-color: var(--grey);   }
.chip.s-red    { background: var(--red);    border-color: var(--red);    }
.chip.s-green.off, .chip.s-yellow.off, .chip.s-grey.off, .chip.s-red.off { opacity: 0.35; }

.bar-sep { width: 1px; height: 24px; background: rgba(255,255,255,0.25); flex-shrink: 0; }

#search-box {
  width: 120px; padding: 5px 9px;
  border: 1.5px solid rgba(255,255,255,0.45);
  border-radius: 14px; background: rgba(255,255,255,0.12);
  color: #fff; font-size: 12px; font-family: var(--font);
  outline: none; flex-shrink: 1;
}
#search-box::placeholder { color: rgba(255,255,255,0.6); }
#search-box:focus { border-color: #fff; background: rgba(255,255,255,0.22); width: 160px; transition: width 0.2s; }

#list-btn {
  padding: 4px 10px; border-radius: 4px;
  border: 1.5px solid rgba(255,255,255,0.5);
  background: transparent; color: #fff;
  font-size: 12px; cursor: pointer; flex-shrink: 0; white-space: nowrap;
}
#list-btn:hover { background: rgba(255,255,255,0.15); }

#print-btn {
  margin-left: auto; padding: 4px 10px; border-radius: 4px;
  border: 1.5px solid rgba(255,255,255,0.5);
  background: transparent; color: #fff;
  font-size: 12px; cursor: pointer; flex-shrink: 0;
}
#print-btn:hover { background: rgba(255,255,255,0.15); }

#refresh-btn {
  padding: 4px 10px; border-radius: 4px;
  border: 1.5px solid rgba(255,255,255,0.5);
  background: transparent; color: #fff;
  font-size: 12px; cursor: pointer; flex-shrink: 0;
}
#refresh-btn:hover:not(:disabled) { background: rgba(255,255,255,0.15); }
#refresh-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Heute banner ────────────────────────────────────────────────────────── */

#heute-banner {
  position: fixed;
  top: var(--bar-h); left: 0; right: 0;
  height: 28px;
  background: #004d96;
  color: rgba(255,255,255,0.92);
  font-size: 12px; font-weight: 600;
  display: none;
  align-items: center; justify-content: center;
  z-index: 999;
  cursor: pointer;
  letter-spacing: 0.02em;
}
#heute-banner:hover { background: #003e7a; }

/* ── search results dropdown ──────────────────────────────────────────────── */

#search-results {
  position: fixed;
  top: var(--bar-h);
  left: 200px; /* approx right of chips area */
  min-width: 280px; max-width: 400px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  z-index: 1500;
  display: none;
  overflow: hidden;
}
.search-item {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
  display: flex; align-items: center; gap: 8px;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #edf2fb; }
.search-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.search-sub { color: #888; font-size: 11px; }

/* ── main content ────────────────────────────────────────────────────────── */

#content {
  position: fixed;
  top: var(--bar-h);
  left: 0; right: 0; bottom: 0;
  display: flex;
}

#map { flex: 1; z-index: 1; }

/* ── side panel ──────────────────────────────────────────────────────────── */

#side-panel {
  width: var(--panel-w);
  background: #fff; border-left: 1px solid #ddd;
  overflow-y: auto; z-index: 2;
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
#side-panel.hidden { display: none; }

#panel-header {
  background: var(--h2w-blue); color: #fff;
  padding: 12px 14px 10px; position: relative;
}
.panel-header-row {
  display: flex; align-items: center; gap: 10px;
  padding-right: 28px; /* room for close btn */
}
#panel-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: #444; color: #fff;
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; letter-spacing: 0.03em;
  border: 2px solid rgba(255,255,255,0.4);
}
.panel-header-text { flex: 1; min-width: 0; }
#panel-company { font-size: 15px; font-weight: 700; line-height: 1.25; }
#panel-hall    { font-size: 12px; opacity: 0.82; margin-top: 2px; }

#panel-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none;
  color: #fff; font-size: 20px; cursor: pointer; opacity: 0.7;
}
#panel-close:hover { opacity: 1; }

#panel-body { padding: 10px 14px; flex: 1; }

.panel-row { margin-bottom: 10px; }
.panel-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #999; margin-bottom: 3px;
}
.panel-value { font-size: 13px; color: #222; line-height: 1.4; }

.status-badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 4px; font-size: 11px; font-weight: 700; color: #fff;
}
.status-badge.green  { background: var(--green);  }
.status-badge.yellow { background: var(--yellow); }
.status-badge.grey   { background: var(--grey);   }
.status-badge.red    { background: var(--red);     }

.days-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.day-pill {
  font-size: 11px; background: #edf2fb; color: var(--h2w-blue);
  border-radius: 10px; padding: 2px 7px; font-weight: 600;
}

/* opportunity badge */
.opp-badge {
  display: block; margin-top: 3px;
  padding: 5px 8px; border-radius: 5px;
  background: #edf2fb; color: var(--h2w-blue);
  font-size: 12px; font-weight: 600;
  text-decoration: none; line-height: 1.35;
  border: 1px solid #c5d9f0;
}
.opp-badge:hover { background: #dce8f8; }

/* activity list */
.activity-list { display: flex; flex-direction: column; gap: 5px; margin-top: 3px; }
.activity-item {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 12px; color: #333; line-height: 1.35;
}
.act-icon { flex-shrink: 0; color: #888; font-size: 13px; width: 16px; text-align: center; }
.act-body { flex: 1; }
.act-date { color: #aaa; font-size: 11px; white-space: nowrap; }
.activity-toggle {
  margin-top: 4px; padding: 0;
  background: none; border: none;
  color: var(--h2w-blue); font-size: 11px;
  cursor: pointer; text-decoration: underline;
}

#panel-actions {
  padding: 10px 14px; border-top: 1px solid #eee;
  display: flex; flex-direction: column; gap: 6px;
}

/* one-tap quick action row */
.quick-actions {
  display: flex; gap: 6px; margin-bottom: 2px;
}
.quick-btn {
  flex: 1; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; border: 1.5px solid #ddd;
  background: #f7f7f7; color: #333;
  font-size: 18px; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.quick-btn:hover  { background: #edf2fb; border-color: var(--h2w-blue); color: var(--h2w-blue); }
.quick-btn-wa     { background: #e8f7ee; border-color: #25d366; color: #1a8f44; font-size: 12px; }
.quick-btn-wa:hover { background: #d1f0de; }
.quick-btn-mail   { background: #fff5e6; border-color: #e67e22; color: #c0620d; }
.quick-btn-mail:hover { background: #fde8cc; }
.quick-btn-li     { background: #e8eef7; border-color: #0077b5; color: #0077b5; font-size: 12px; font-style: italic; }
.quick-btn-li:hover { background: #d4e5f5; }

.action-btn {
  display: block; width: 100%; padding: 9px 12px;
  border-radius: 5px; border: 1.5px solid #ddd;
  background: #f7f7f7; font-size: 12px; font-weight: 600;
  cursor: pointer; text-align: center; text-decoration: none; color: #333;
  min-height: 40px;
}
.action-btn:hover   { background: #edf2fb; border-color: var(--h2w-blue); color: var(--h2w-blue); }
.action-btn.primary { background: var(--h2w-blue); color: #fff; border-color: var(--h2w-blue); }
.action-btn.primary:hover { background: #004490; }
.action-btn.visited { background: var(--green); color: #fff; border-color: var(--green); }

/* ── visit counter badge ─────────────────────────────────────────────────── */

#visit-count {
  position: fixed; bottom: 12px; right: 12px;
  background: rgba(0,0,0,0.7); color: #fff;
  font-size: 12px; padding: 5px 10px;
  border-radius: 12px; z-index: 900; pointer-events: none;
}

/* ── full list panel ─────────────────────────────────────────────────────── */

#list-panel {
  position: fixed;
  top: var(--bar-h); right: 0; bottom: 0;
  width: var(--panel-w);
  background: #fff; border-left: 1px solid #ddd;
  z-index: 990;
  display: flex; flex-direction: column;
  overflow: hidden;
}
#list-panel.hidden { display: none; }

.list-header {
  background: var(--h2w-blue); color: #fff;
  padding: 12px 14px;
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-shrink: 0;
}
.list-title { font-size: 15px; font-weight: 700; }
#list-progress { font-size: 11px; opacity: 0.8; margin-top: 2px; }
#list-close {
  background: none; border: none; color: #fff;
  font-size: 20px; cursor: pointer; opacity: 0.7; padding: 0;
}
#list-close:hover { opacity: 1; }

#list-body { flex: 1; overflow-y: auto; }

.list-empty { padding: 16px; color: #888; font-size: 13px; }

.list-item {
  display: flex; align-items: center;
  padding: 10px 12px; gap: 8px;
  border-bottom: 1px solid #f2f2f2;
  min-height: 52px;
}
.list-item-visited { background: #f4fbf4; }
.list-item-left {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0; cursor: pointer;
}
.list-item-left:hover .list-company { color: var(--h2w-blue); }
.list-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.list-item-text { min-width: 0; flex: 1; }
.list-company { font-size: 13px; font-weight: 600; color: #222; line-height: 1.2; }
.list-meta { font-size: 11px; color: #888; margin-top: 2px; }

.list-visit-btn {
  padding: 5px 8px; border-radius: 4px;
  border: 1.5px solid #ddd; background: #f7f7f7;
  font-size: 11px; font-weight: 600; color: #555;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  min-height: 36px;
}
.list-visit-btn:hover   { background: #edf2fb; border-color: var(--h2w-blue); color: var(--h2w-blue); }
.list-visit-btn.visited { background: var(--green); color: #fff; border-color: var(--green); }

/* ── Leaflet marker overrides ────────────────────────────────────────────── */

.leaflet-container { font-family: var(--font); }
.hall-label {
  background: none; border: none;
  font-size: 11px; font-weight: 700;
  color: rgba(0, 60, 136, 0.7);
  text-shadow: 0 0 3px #fff, 0 0 3px #fff;
  white-space: nowrap;
}

/* ── print view ──────────────────────────────────────────────────────────── */

#print-view { display: none; }

@media print {
  #filter-bar, #map, #side-panel, #list-panel, #heute-banner,
  #search-results, #visit-count { display: none !important; }
  #content { position: static; }
  #print-view {
    display: block; font-family: var(--font);
    font-size: 11px; color: #000;
  }
  #print-view h1 { font-size: 16px; margin-bottom: 8px; }
  #print-view h2 { font-size: 13px; margin: 12px 0 4px; border-bottom: 1px solid #ccc; padding-bottom: 2px; }
  .print-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
  .print-table th { background: #eee; font-size: 10px; text-align: left; padding: 3px 5px; }
  .print-table td { padding: 3px 5px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
  .print-table tr.red-row td { color: #999; text-decoration: line-through; }
}

/* ── mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  :root { --panel-w: 100vw; }

  #side-panel {
    position: fixed;
    top: var(--bar-h); left: 0; right: 0; bottom: 0;
    border-left: none;
  }
  #list-panel {
    top: var(--bar-h); left: 0; right: 0; bottom: 0;
    width: 100vw; border-left: none;
  }
  #search-results { left: 0; right: 0; max-width: 100%; border-radius: 0; }
  #search-box { width: 80px; }
  #search-box:focus { width: 110px; }
  #visit-count { right: 12px !important; }
}

/* ── v1.2 additions ──────────────────────────────────────────────────────── */

/* Avatar photo */
.panel-avatar-photo {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; display: block;
}

/* Company logo in panel header (inline before name) */
.company-logo-sm {
  width: 20px; height: 20px; border-radius: 3px;
  object-fit: contain; vertical-align: middle;
  margin-right: 5px; background: rgba(255,255,255,0.15);
  flex-shrink: 0;
}
#panel-company { display: flex; align-items: center; }

/* Panel link (website) */
.panel-link {
  color: var(--h2w-blue); text-decoration: none; font-size: 13px;
}
.panel-link:hover { text-decoration: underline; }

/* Company description */
.panel-description {
  font-size: 12px; color: #555; line-height: 1.5;
  max-height: 72px; overflow: hidden;
}

/* All-contacts collapsible block */
.allcontacts-toggle {
  cursor: pointer; color: var(--h2w-blue) !important;
  text-decoration: underline dotted;
}
.allcontacts-toggle:hover { opacity: 0.75; }
.allcontacts-list { margin-top: 6px; display: flex; flex-direction: column; gap: 8px; }
.allcontacts-item { padding: 6px 0; border-top: 1px solid #f0f0f0; }
.allcontacts-name { font-size: 13px; font-weight: 600; color: #222; }
.allcontacts-title { font-weight: 400; color: #888; font-size: 12px; }
.allcontacts-actions { display: flex; gap: 6px; margin-top: 4px; }

/* Mini action buttons for secondary contacts */
.qc-btn {
  min-width: 36px; min-height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 5px; border: 1.5px solid #ddd;
  background: #f7f7f7; color: #333;
  font-size: 16px; font-weight: 700; text-decoration: none;
}
.qc-btn:hover { background: #edf2fb; border-color: var(--h2w-blue); color: var(--h2w-blue); }
.qc-btn-li { font-size: 11px; font-style: italic; background: #e8eef7; border-color: #0077b5; color: #0077b5; }
.qc-btn-li:hover { background: #d4e5f5; }

/* News block */
.news-list { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.news-item { font-size: 12px; line-height: 1.4; }
.news-title {
  display: block; color: #1a3fa3; text-decoration: none;
  font-weight: 600; line-height: 1.35;
}
.news-title:hover { text-decoration: underline; }
.news-meta { color: #999; font-size: 11px; margin-top: 1px; }
.news-empty { font-size: 12px; color: #aaa; }
.news-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; gap: 6px;
}
.news-ts { font-size: 10px; color: #bbb; }
.news-refresh-btn {
  padding: 3px 8px; border-radius: 4px;
  border: 1px solid #d0d0d0; background: #f7f7f7;
  font-size: 11px; color: #555; cursor: pointer; white-space: nowrap;
}
.news-refresh-btn:hover:not(:disabled) { background: #edf2fb; border-color: var(--h2w-blue); color: var(--h2w-blue); }
.news-refresh-btn:disabled { opacity: 0.5; cursor: default; }

/* List panel — logo column */
.list-logo-wrap {
  width: 28px; height: 28px; border-radius: 4px;
  border: 2px solid #ddd; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #f9f9f9;
}
.list-logo {
  width: 24px; height: 24px; object-fit: contain;
}

/* List panel — footer close button */
#list-close-footer {
  display: block; width: calc(100% - 24px); margin: 10px 12px;
  padding: 10px; border-radius: 5px;
  border: 1.5px solid #ddd; background: #f7f7f7;
  font-size: 13px; font-weight: 600; color: #333;
  cursor: pointer; text-align: center; flex-shrink: 0;
}
#list-close-footer:hover { background: #edf2fb; border-color: var(--h2w-blue); color: var(--h2w-blue); }
