* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }

:root {
    --primary: #2563eb; /* default blue */
}

.theme-einsatz {
    --primary: #b91c1c; /* Feuerwehr-Rot */
}

.app { display: flex; height: 100vh; }
.sidebar { width: 380px; background: #1a1d29; color: #e8eaed; overflow-y: auto; box-shadow: 2px 0 8px rgba(0,0,0,0.3); z-index: 1000; }
#map { flex: 1; }

/* hide mobile controls on desktop by default */
.menu-btn { display: none; }
.info-panel { display: none; }

.info-panel { width: 360px; background: #0b1220; color: #e6eef8; overflow-y: auto; box-shadow: -2px 0 8px rgba(0,0,0,0.3); z-index: 1000; padding: 12px 14px; }
.info-header { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; padding-bottom:10px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.info-header h3 { margin:0; font-size:16px; color:#e8eaed; }
.info-controls { display:flex; gap:8px; align-items:center; }
.btn-icon { background:rgba(255,255,255,0.05); border:none; border-radius:6px; padding:6px; cursor:pointer; color:#e8eaed; display:flex; align-items:center; justify-content:center; transition:all 0.2s; }
.btn-icon:hover { background:rgba(255,255,255,0.1); }
.results-list { display:block; max-height: calc(100vh - 200px); overflow-y:auto; }
.result-entry { padding:10px; border-radius:8px; margin-bottom:8px; background: rgba(255,255,255,0.02); cursor:pointer; transition:all 0.2s; }
.result-entry:hover { background: rgba(37,99,235,0.12); transform: translateX(2px); }
.result-entry .r-label { font-weight:600; color:#e8eaed; }
.result-entry .r-sub { font-size:12px; color:#9ca3af; margin-top:4px; }
.poi-details { padding:16px; background: rgba(255,255,255,0.02); border-radius:8px; max-height: calc(100vh - 140px); overflow-y:auto; display:block; }
.poi-details.hidden { display: none !important; }
.poi-details .poi-title { font-size:18px; font-weight:600; margin-bottom:12px; color:#e8eaed; }
.poi-details .poi-sub { font-size:13px; color:#9ca3af; margin-bottom:12px; }
.poi-details .poi-desc { margin-top:12px; color:#d1d5db; line-height:1.6; }
.poi-details a { color:#60a5fa; text-decoration:none; }
.poi-details a:hover { text-decoration:underline; }
.poi-actions { display:flex; gap:10px; margin-top:16px; padding-top:16px; border-top:1px solid rgba(255,255,255,0.08); }
.poi-actions .btn { flex:1; justify-content:center; font-size:14px; padding:10px 16px; }
.btn-back { background:rgba(255,255,255,0.05); color:#e8eaed; border:1px solid rgba(255,255,255,0.1); }
.btn-back:hover { background:rgba(255,255,255,0.08); }


.header { padding: 20px; background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 80%, black 20%) 100%); border-bottom: 1px solid rgba(255,255,255,0.1); }
.header .logo { display: flex; align-items: center; gap: 10px; }
.header .logo img { width: 36px; height: 36px; border-radius: 8px; }
.header h1 { font-size: 24px; margin-bottom: 4px; }
.header .tag { font-size: 13px; color: rgba(255,255,255,0.8); }

.card { margin: 16px; padding: 20px; background: #252836; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); }
.card h2 { font-size: 18px; margin-bottom: 16px; color: #e8eaed; }

.input-group { margin-bottom: 16px; }
.input-group label { display: block; margin-bottom: 6px; font-size: 13px; color: #9ca3af; font-weight: 500; }
.input-group input { width: 100%; padding: 10px 12px; background: #1a1d29; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; color: #e8eaed; font-size: 14px; }
.input-group input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.suggestions { position: relative; }
.suggestions-list { position: absolute; top: 100%; left: 0; right: 0; background: #1a1d29; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; margin-top: 4px; max-height: 300px; overflow-y: auto; z-index: 1000; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.suggestion-item { padding: 12px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.05); transition: background 0.2s; }
.suggestion-item:hover { background: rgba(37,99,235,0.2); }
.suggestion-item:last-child { border-bottom: none; }
.suggestion-label { font-size: 14px; font-weight: 500; color: #e8eaed; margin-bottom: 2px; }
.suggestion-tags { font-size: 12px; color: #9ca3af; }
.suggestion-coords { font-size: 11px; color: #6b7280; margin-top: 2px; }

.actions { display: flex; gap: 8px; margin-top: 16px; }
.btn { flex: 1; padding: 12px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { filter: brightness(0.9); }
.btn-secondary { background: #374151; color: #e8eaed; }
.btn-secondary:hover { background: #4b5563; }
.btn-tertiary { background: #1f2937; color: #e8eaed; }
.btn-tertiary:hover { background: #374151; }

.map-mode-switcher { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-btn { padding: 12px; border: 2px solid rgba(255,255,255,0.1); border-radius: 8px; background: #1a1d29; color: #9ca3af; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.mode-btn:hover { background: #252836; border-color: rgba(255,255,255,0.2); }
.mode-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.toggle-list { display: grid; gap: 10px; }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #e8eaed; }
.toggle input { width: 16px; height: 16px; accent-color: #2563eb; }
.toggle small { color: #9ca3af; }

.follow-row { display: none; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.follow-status { font-size: 12px; color: #9ca3af; padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,0.06); }
.follow-status.active { color: #d1fae5; background: rgba(16,185,129,0.2); }

.result { margin-top: 16px; padding: 12px; background: #1a1d29; border-radius: 8px; border-left: 3px solid #2563eb; }
.result-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: #e8eaed; }
.result-stats { font-size: 13px; color: #9ca3af; line-height: 1.6; }
.result-stats strong { color: #e8eaed; }

.error { background: #3f1a1a; border-left-color: #dc2626; color: #fca5a5; }

.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 1s linear infinite; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 768px) {
    .sidebar { width: 100%; max-width: 380px; position: absolute; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.open { transform: translateX(0); }
    .menu-btn { display: block; position: fixed; top: 16px; right: 16px; left: auto; z-index: 1001; background: white; border: none; padding: 12px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); cursor: pointer; }
    .info-panel { display: block; position: absolute; right: 0; top: 0; bottom: 0; width: 360px; }
}

@media (max-width: 520px) {
    .app { position: relative; height: 100vh; }
    .sidebar {
        width: 100%;
        max-width: none;
        border-radius: 0;
        box-shadow: none;
    }
    .header { padding: 16px; }
    .header h1 { font-size: 20px; }
    .header .tag { font-size: 12px; }

    .card { margin: 12px; padding: 16px; }
    .card h2 { font-size: 16px; margin-bottom: 12px; }

    .input-group input { font-size: 16px; padding: 12px; }
    .actions { flex-direction: column; gap: 10px; }
    .btn { width: 100%; font-size: 16px; padding: 14px; }

    .toggle { font-size: 14px; }
    .toggle input { width: 18px; height: 18px; }
    .follow-row { flex-direction: column; align-items: flex-start; gap: 6px; }

    .suggestions-list { max-height: 240px; }
    .suggestion-item { padding: 14px; }
    .suggestion-label { font-size: 15px; }
    .suggestion-tags { font-size: 12px; }

    .menu-btn { top: 12px; right: 12px; padding: 14px; border-radius: 10px; }
}

@media (max-height: 700px) {
    .sidebar { overflow-y: auto; }
    .card { margin: 10px; }
}

/* Maplibre popup styling */
.maplibregl-popup-content { background: #252836; color: #e8eaed; border-radius: 8px; padding: 12px; }
.maplibregl-popup-tip { border-top-color: #252836; }
.maplibregl-popup-close-button { color: #e8eaed; }

/* Move top-right controls slightly down so they don't overlap header/sidebar */
.maplibregl-ctrl-top-right {
    top: 72px !important;
    right: 12px !important;
}

/*
@media (max-width: 768px) {
    .maplibregl-ctrl-top-right { top: 110px !important; }
}*/

/* only on mobile */
@media (max-width: 520px) {
    #infoPanel { display: none; }
}
