/* ── Akquise Custom CSS (Bootstrap 5 ergänzend) ───────────────────────── */

/* Farbschema an wunde24.de angeglichen (dortiges Signal-Rot #CC0000 als durchgängige Markenfarbe) */
:root {
  --bs-primary: #CC0000;
  --bs-primary-rgb: 204, 0, 0;
  --bs-link-color: #CC0000;
  --bs-link-color-rgb: 204, 0, 0;
  --bs-link-hover-color: #a30000;
  --bs-link-hover-color-rgb: 163, 0, 0;
}

.navbar.bg-primary { background-color: #E06060 !important; }
.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus { color: #FFD9D9; }
.navbar-dark .navbar-nav .nav-link.active { color: #fff; }

.btn-primary {
  --bs-btn-bg: #CC0000;
  --bs-btn-border-color: #CC0000;
  --bs-btn-hover-bg: #a30000;
  --bs-btn-hover-border-color: #8c0000;
  --bs-btn-active-bg: #8c0000;
  --bs-btn-active-border-color: #750000;
  --bs-btn-disabled-bg: #CC0000;
  --bs-btn-disabled-border-color: #CC0000;
  --bs-btn-focus-shadow-rgb: 217, 51, 51;
}

.btn-outline-primary {
  --bs-btn-color: #CC0000;
  --bs-btn-border-color: #CC0000;
  --bs-btn-hover-bg: #CC0000;
  --bs-btn-hover-border-color: #CC0000;
  --bs-btn-active-bg: #8c0000;
  --bs-btn-active-border-color: #8c0000;
  --bs-btn-focus-shadow-rgb: 217, 51, 51;
}

.text-primary { color: #CC0000 !important; }
.border-primary { border-color: #CC0000 !important; }
.form-check-input:checked { background-color: #CC0000; border-color: #CC0000; }
.form-control:focus, .form-select:focus { border-color: #e07a7a; box-shadow: 0 0 0 .25rem rgba(204,0,0,.25); }

/* Status-Badges */
.badge-geplant      { background: #dbeafe !important; color: #1d4ed8 !important; }
.badge-durchgefuhrt { background: #dcfce7 !important; color: #15803d !important; }
.badge-nachfassen   { background: #ffedd5 !important; color: #c2410c !important; }
.badge-heim         { background: #f3e8ff !important; color: #6d28d9 !important; }
.badge-arzt         { background: #fef9c3 !important; color: #854d0e !important; }
.badge-pflegedienst { background: #dbeafe !important; color: #1d4ed8 !important; }
.badge-krankenhaus  { background: #fee2e2 !important; color: #b91c1c !important; }
.badge-sonstige     { background: #e5e7eb !important; color: #374151 !important; }
.badge-pot-a        { background: #dcfce7 !important; color: #15803d !important; }
.badge-pot-b        { background: #fef3c7 !important; color: #92400e !important; }
.badge-pot-c        { background: #fee2e2 !important; color: #b91c1c !important; }
.badge-pot-none     { background: #f1f5f9 !important; color: #64748b !important; }

/* Potenzial-Punkt (z.B. in Filterlisten) */
.pot-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; margin-right: 6px; flex-shrink: 0; vertical-align: middle; }
.pot-dot.pot-a { background: #16a34a; }
.pot-dot.pot-b { background: #d97706; }
.pot-dot.pot-c { background: #dc2626; }
.pot-dot.pot-none { background: #9ca3af; }

/* Nav: blinkende Warnung bei bald fälligen Aufgaben */
@keyframes nav-warn-blink { 50% { opacity: .15; } }
.nav-warn-blink { display: inline-block; margin-left: 2px; animation: nav-warn-blink 1s step-start infinite; }

/* Potenzial A/B/C (Besuchszettel) */
.potenzial-option { border: 2px solid transparent; border-radius: .5rem; padding: .75rem; text-align: center; cursor: pointer; transition: border-color .15s; }
.potenzial-option.pot-a { background: #dcfce7; }
.potenzial-option.pot-b { background: #fef3c7; }
.potenzial-option.pot-c { background: #fee2e2; }
.potenzial-option input:checked ~ .potenzial-option,
.potenzial-option:has(input:checked) { border-color: var(--bs-primary); }
.potenzial-option .pot-label { font-weight: 700; font-size: 1.1rem; }

/* Besuchszettel-Sektionskopf mit nummeriertem Kreis */
.bz-section-header { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.bz-section-num { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--bs-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; }
.bz-section-title { font-weight: 700; letter-spacing: .02em; }
.bz-card { margin-bottom: 1rem; }

/* KPI-Karten */
.kpi-card { border-left: 4px solid var(--bs-primary) !important; }
.kpi-card .kpi-zahl { font-size: 2rem; font-weight: 700; color: var(--bs-primary); line-height: 1; }
.kpi-card.kpi-green { border-color: #16a34a !important; }
.kpi-card.kpi-green .kpi-zahl { color: #16a34a; }
.kpi-card.kpi-orange { border-color: #ea580c !important; }
.kpi-card.kpi-orange .kpi-zahl { color: #ea580c; }
.kpi-card.kpi-red { border-color: #dc2626 !important; }
.kpi-card.kpi-red .kpi-zahl { color: #dc2626; }

/* Tabelle hover */
.table-hover tbody tr:hover { background: #f0f7ff; }

/* Duplikat-Item */
.duplikat-item {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 10px; padding: 10px 14px; background: #fff;
    border: 1px solid #e5e7eb; border-radius: 6px; margin-bottom: 6px; font-size: 14px;
}
.duplikat-item:last-child { margin-bottom: 0; }
#duplikat-box { display: none; }

/* Detail-Grid */
.detail-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; margin-bottom: 2px; }
.detail-value { font-size: 15px; }

/* ── Karte ──────────────────────────────────────────────────────────────── */
#map-wrap { position: relative; overflow: hidden; }
#map { width: 100%; height: 100%; }

#geocode-status {
    position: absolute; top: 10px; right: 10px; z-index: 900;
    background: rgba(255,255,255,.95); border-radius: 8px;
    padding: 8px 12px; font-size: 13px; color: #6b7280;
    display: none; align-items: center; gap: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.spinner { width: 14px; height: 14px; border: 2px solid #d1d5db; border-top-color: #2563eb; border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

#legende {
    position: absolute; bottom: 90px; left: 10px; z-index: 900;
    background: rgba(255,255,255,.95); border-radius: 8px;
    padding: 8px 12px; font-size: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.15);
    display: flex; flex-direction: column; gap: 5px;
}
.legende-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); flex-shrink: 0; }

/* GPS-Button */
#btn-gps {
    position: absolute; top: 10px; left: 10px; z-index: 900;
    background: #fff; border: 2px solid #2563eb; border-radius: 8px;
    padding: 8px 14px; font-size: 13px; font-weight: 600; color: #2563eb;
    cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.15);
    display: flex; align-items: center; gap: 6px; transition: background .15s, color .15s;
}
#btn-gps:hover, #btn-gps.aktiv { background: #2563eb; color: #fff; }

/* Nähe-Panel */
#naehe-panel {
    position: absolute; top: 10px; left: 10px; z-index: 950;
    width: 320px; max-height: calc(100% - 120px);
    background: rgba(255,255,255,.97); border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,.2); display: none; flex-direction: column; overflow: hidden;
}
@media (max-width: 480px) {
    #naehe-panel { width: calc(100vw - 20px); left: 10px; right: 10px; max-height: 60vh; }
}
#naehe-header { padding: 12px 16px; background: #2563eb; color: #fff; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
#naehe-header h3 { margin: 0; font-size: 14px; font-weight: 600; }
#naehe-close { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; line-height: 1; padding: 0 4px; }
#naehe-filter { padding: 8px 12px; border-bottom: 1px solid #e5e7eb; flex-shrink: 0; display: flex; align-items: center; gap: 8px; font-size: 12px; }
#naehe-radius { flex: 1; }
#naehe-liste { overflow-y: auto; flex: 1; }
.naehe-item { padding: 10px 14px; border-bottom: 1px solid #f3f4f6; cursor: pointer; transition: background .12s; display: flex; align-items: flex-start; gap: 10px; }
.naehe-item:hover { background: #eff6ff; }
.naehe-item:last-child { border: none; }
.naehe-dist { font-size: 12px; font-weight: 700; color: #fff; background: #2563eb; border-radius: 6px; padding: 2px 7px; white-space: nowrap; flex-shrink: 0; margin-top: 2px; }
.naehe-dist.nah  { background: #16a34a; }
.naehe-dist.mitte { background: #ea580c; }
.naehe-item-info { flex: 1; min-width: 0; }
.naehe-item-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.naehe-item-sub  { font-size: 12px; color: #6b7280; margin-top: 2px; }
#naehe-leer { padding: 20px; text-align: center; color: #6b7280; font-size: 13px; }

/* Player-Bar */
#player {
    position: absolute; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: rgba(17,24,39,.9); backdrop-filter: blur(6px);
    color: #fff; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px;
}
#player-row1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#player-row2 { display: flex; align-items: center; gap: 8px; }

.pbtn {
    background: rgba(255,255,255,.15); border: none; border-radius: 6px;
    color: #fff; cursor: pointer; padding: 5px 10px; font-size: 15px;
    transition: background .15s; flex-shrink: 0; line-height: 1;
}
.pbtn:hover { background: rgba(255,255,255,.28); }
.pbtn.primary { background: #2563eb; padding: 6px 12px; font-size: 17px; }
.pbtn.primary:hover { background: #1d4ed8; }

#timeline {
    flex: 1; -webkit-appearance: none; appearance: none; height: 4px;
    border-radius: 2px; outline: none; cursor: pointer;
    background: linear-gradient(to right, #2563eb 0%, #2563eb var(--pct,0%), rgba(255,255,255,.25) var(--pct,0%), rgba(255,255,255,.25) 100%);
    min-width: 80px;
}
#timeline::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; cursor: pointer; }
#player-counter { font-size: 11px; color: rgba(255,255,255,.6); flex-shrink: 0; }
#player-date { font-size: 12px; font-weight: 600; flex-shrink: 0; }
#speed-select { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 6px; padding: 3px 6px; font-size: 12px; cursor: pointer; }
#speed-select option { color: #111; background: #fff; }
#player-info-row { font-size: 12px; color: rgba(255,255,255,.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }

/* Info-Card Playback */
#info-card {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    z-index: 950; background: rgba(255,255,255,.97); border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,.2); padding: 14px 18px;
    min-width: 240px; max-width: min(380px, calc(100vw - 20px));
    display: none; border-top: 4px solid #2563eb;
    animation: slideDown .25s ease;
}
@keyframes slideDown { from { opacity:0; transform: translateX(-50%) translateY(-8px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }
.ic-date { font-size: 18px; font-weight: 700; color: #2563eb; line-height: 1.1; }
.ic-uhrzeit { font-size: 12px; color: #6b7280; }
.ic-name { font-size: 14px; font-weight: 600; margin-top: 5px; }
.ic-adresse { font-size: 11px; color: #6b7280; }
.ic-text { font-size: 12px; margin-top: 7px; color: #374151; border-top: 1px solid #e5e7eb; padding-top: 7px; max-height: 70px; overflow-y: auto; white-space: pre-line; }
.ic-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; }

/* Puls-Marker */
@keyframes pulse-ring { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(3.5); opacity: 0; } }
.pulse-ring { width: 16px; height: 16px; border-radius: 50%; animation: pulse-ring 1.2s ease-out infinite; position: absolute; top: -1px; left: -1px; }
.pulse-wrap { position: relative; width: 14px; height: 14px; }

/* Pagination */
.pagination { flex-wrap: wrap; }

/* Suchfeld */
.search-wrap { position: relative; }
.search-wrap .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #9ca3af; pointer-events: none; }
.search-wrap input { padding-left: 32px !important; }
.search-wrap .search-clear { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 15px; color: #9ca3af; display: none; }

/* Mobile Anpassungen */
@media (max-width: 576px) {
    .kpi-zahl { font-size: 1.6rem !important; }
    .table-sm td, .table-sm th { padding: 6px 8px; }
    #player-row1 { gap: 5px; }
    .pbtn { padding: 4px 7px; font-size: 13px; }
    #info-card { padding: 10px 12px; }
    #legende { bottom: 110px; }
}
