/* Boekenkastjes Amsterdam — Mobile-first */
:root {
    --bka-primary: #2563eb;
    --bka-danger: #dc2626;
    --bka-success: #059669;
    --bka-text: #1e293b;
    --bka-muted: #64748b;
    --bka-border: #e2e8f0;
    --bka-surface: #ffffff;
    --bka-bg: #f8fafc;
    --bka-radius: 12px;
}

.bka-app { position: relative; width: 100%; min-height: 100vh; }

/* Top bar */
.bka-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: var(--bka-surface);
    border-bottom: 1px solid var(--bka-border); z-index: 1000;
    position: relative; flex-wrap: wrap; gap: 8px;
}
.bka-logo { font-size: 1rem; font-weight: 700; color: var(--bka-text); margin: 0; white-space: nowrap; }
.bka-topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Map */
.bka-map { width: 100%; height: calc(100vh - 60px); z-index: 1; }

/* Buttons */
.bka-btn {
    padding: 8px 16px; border-radius: 8px; font-size: 0.85rem; font-weight: 600;
    cursor: pointer; border: none; text-decoration: none; display: inline-flex;
    align-items: center; gap: 4px; white-space: nowrap; transition: all 0.15s;
}
.bka-btn-primary { background: var(--bka-primary); color: #fff; }
.bka-btn-primary:hover { opacity: 0.9; }
.bka-btn-outline { background: transparent; color: var(--bka-text); border: 1px solid var(--bka-border); }
.bka-btn-outline:hover { background: var(--bka-bg); }
.bka-btn-danger { background: var(--bka-danger); color: #fff; }
.bka-btn-danger-outline { background: transparent; color: var(--bka-danger); border: 1px solid var(--bka-danger); }
.bka-btn-block { display: block; width: 100%; justify-content: center; padding: 12px; }
.bka-btn-link { color: var(--bka-muted); text-decoration: none; font-size: 0.8rem; }
.bka-select {
    padding: 8px 12px; border: 1px solid var(--bka-border); border-radius: 8px;
    font-size: 0.85rem; background: var(--bka-surface); color: var(--bka-text);
}

/* Panels */
.bka-panel {
    position: fixed; bottom: 0; left: 0; right: 0; max-height: 70vh; overflow-y: auto;
    background: var(--bka-surface); border-radius: var(--bka-radius) var(--bka-radius) 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15); z-index: 1001; padding: 0 20px 20px;
}
.bka-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 0 12px; position: sticky; top: 0; background: var(--bka-surface);
    border-bottom: 1px solid var(--bka-border); margin-bottom: 16px;
}
.bka-panel-header h2 { font-size: 1.1rem; font-weight: 700; color: var(--bka-text); margin: 0; }
.bka-panel-close {
    width: 32px; height: 32px; border-radius: 50%; border: none;
    background: var(--bka-bg); font-size: 18px; cursor: pointer; color: var(--bka-muted);
}

/* Form fields */
.bka-field { margin-bottom: 14px; }
.bka-field label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--bka-text); margin-bottom: 4px; }
.bka-field input[type="text"],
.bka-field input[type="email"],
.bka-field input[type="password"],
.bka-field textarea,
.bka-field select {
    width: 100%; padding: 10px 12px; border: 1px solid var(--bka-border); border-radius: 8px;
    font-size: 16px; color: var(--bka-text); background: var(--bka-surface);
    font-family: inherit; -webkit-appearance: none;
}
.bka-field input:focus, .bka-field textarea:focus, .bka-field select:focus {
    outline: none; border-color: var(--bka-primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.bka-field-hint { font-size: 0.75rem; color: var(--bka-muted); margin-top: 4px; }
.bka-hint { font-size: 0.85rem; color: var(--bka-muted); margin-bottom: 12px; }

/* Status messages */
.bka-status { margin-top: 8px; font-size: 0.85rem; text-align: center; }
.bka-status-success { color: var(--bka-success); }
.bka-status-error { color: var(--bka-danger); }
.bka-error { background: #fef2f2; color: #991b1b; padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 0.85rem; }

/* Detail panel */
.bka-detail-photo { width: 100%; border-radius: 8px; margin-bottom: 12px; }
.bka-detail-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.bka-badge { background: var(--bka-primary); color: #fff; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.bka-date { font-size: 0.8rem; color: var(--bka-muted); }
.bka-detail-desc { font-size: 0.9rem; color: var(--bka-text); line-height: 1.6; margin-bottom: 16px; }
.bka-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Auth */
.bka-auth { max-width: 400px; margin: 40px auto; padding: 0 20px; }
.bka-auth-tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid var(--bka-border); }
.bka-auth-tab {
    flex: 1; padding: 10px; text-align: center; font-weight: 600; font-size: 0.9rem;
    border: none; background: none; cursor: pointer; color: var(--bka-muted);
    border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.bka-auth-tab.active { color: var(--bka-primary); border-bottom-color: var(--bka-primary); }
.bka-auth-panel { display: none; }
.bka-auth-panel.active { display: block; }
.bka-disclaimer { font-size: 0.75rem; color: var(--bka-muted); margin-top: 16px; line-height: 1.5; }

/* My kastjes */
.bka-my-kastjes { max-width: 700px; margin: 40px auto; padding: 0 20px; }
.bka-my-kastjes h2 { font-size: 1.3rem; margin-bottom: 20px; }
.bka-kastjes-list { display: flex; flex-direction: column; gap: 12px; }
.bka-kastje-item {
    display: flex; align-items: center; gap: 14px; padding: 14px;
    background: var(--bka-surface); border: 1px solid var(--bka-border);
    border-radius: var(--bka-radius); transition: all 0.15s;
}
.bka-kastje-item.bka-inactive { opacity: 0.5; }
.bka-kastje-thumb { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.bka-kastje-info { flex: 1; min-width: 0; }
.bka-kastje-info h3 { font-size: 0.95rem; margin: 0 0 4px; }
.bka-kastje-info h3 a { color: var(--bka-text); text-decoration: none; }
.bka-kastje-info p { font-size: 0.8rem; color: var(--bka-muted); margin: 4px 0 0; }
.bka-status-badge { font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.bka-status-actief { background: #ecfdf5; color: var(--bka-success); }
.bka-status-verwijderd { background: #fef2f2; color: var(--bka-danger); }

/* Leaflet popup override */
.leaflet-popup-content { min-width: 180px; }
.leaflet-popup-content img { width: 100%; border-radius: 6px; margin-bottom: 6px; }

/* Desktop */
@media (min-width: 768px) {
    .bka-panel {
        position: fixed; top: 70px; right: 16px; bottom: auto; left: auto;
        width: 380px; max-height: calc(100vh - 90px); border-radius: var(--bka-radius);
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    }
    .bka-map { height: calc(100vh - 60px); }
}

/* Mobile */
@media (max-width: 767px) {
    .bka-topbar { flex-direction: column; align-items: stretch; }
    .bka-topbar-right { justify-content: center; }
    .bka-logo { text-align: center; font-size: 0.9rem; }
    .bka-map { height: calc(100vh - 110px); }
}

/* === Custom boek-marker === */
.bka-book-marker { background: none !important; border: none !important; }
.bka-book-pin {
    width: 40px; height: 48px;
    background: #8B5A2B;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    border: 2px solid #FBF8F1;
}
.bka-book-emoji {
    transform: rotate(45deg);
    font-size: 18px; line-height: 1;
}
.bka-book-marker-add .bka-book-pin {
    background: #f97316;
    animation: bkaAddPulse 1.4s ease-in-out infinite;
}
@keyframes bkaAddPulse {
    0%, 100% { transform: rotate(-45deg) scale(1); }
    50%      { transform: rotate(-45deg) scale(1.12); }
}

/* "Jij bent hier" marker */
.bka-locate-marker { background: none !important; border: none !important; }
.bka-locate-dot {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 14px; height: 14px; background: #1d4e89; border: 3px solid #fff;
    border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,0.4); z-index: 2;
}
.bka-locate-pulse {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 24px; height: 24px; background: rgba(29,78,137,0.4);
    border-radius: 50%; animation: bkaLocatePulse 1.6s ease-out infinite;
}
@keyframes bkaLocatePulse {
    0%   { transform: translate(-50%,-50%) scale(0.4); opacity: 1; }
    100% { transform: translate(-50%,-50%) scale(2.5); opacity: 0; }
}

/* === Search-control === */
.bka-search-control {
    margin: 10px !important;
    background: #fff; border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
    width: 320px; max-width: calc(100vw - 100px);
    overflow: hidden;
}
.bka-search-wrap { display: flex; align-items: center; background: #fff; }
.bka-search-input {
    flex: 1; padding: 10px 14px; border: none; outline: none;
    font-size: 14px; font-family: 'Lora', Georgia, serif; background: transparent;
}
.bka-search-input::placeholder { color: #999; }
.bka-search-clear {
    width: 32px; height: 32px; margin-right: 4px;
    background: #f0f0f0; border: none; border-radius: 50%;
    cursor: pointer; font-size: 18px; line-height: 1; color: #666;
}
.bka-search-clear:hover { background: #e0e0e0; color: #000; }

.bka-search-results {
    display: none; max-height: 320px; overflow-y: auto;
    border-top: 1px solid #eee; background: #fff;
}
.bka-search-result {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f3f3f3;
    font-size: 13px; line-height: 1.4;
}
.bka-search-result:last-child { border-bottom: none; }
.bka-search-result:hover { background: #fafafa; }
.bka-result-icon { font-size: 16px; flex-shrink: 0; }
.bka-result-text { flex: 1; color: #333; }
.bka-result-text strong { display: block; color: #111; }
.bka-result-text small { color: #777; }

/* === Locate-control === */
.bka-locate-control { margin-top: 10px !important; margin-right: 10px !important; }
.bka-locate-btn {
    width: 38px; height: 38px; background: #fff; border: none;
    border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    font-size: 18px; cursor: pointer; transition: background 0.2s;
}
.bka-locate-btn:hover { background: #f5f5f5; }
.bka-locate-btn:disabled { opacity: 0.6; cursor: wait; }
