/* ================================================================
   Oostenrijk Reiskaart — Mobile-first stylesheet
   ================================================================ */

/* ── Reset / Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #111827;
    overflow: hidden; /* map fills viewport; panels scroll internally */
}

/* ── Map ───────────────────────────────────────────────────────────────────── */
#map {
    position: fixed;
    inset: 0;
    z-index: 1;
}

/* ── Add-mode indicator ────────────────────────────────────────────────────── */
#add-mode-indicator {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(220, 38, 38, 0.92);
    color: #fff;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 500;
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

/* ── Floating controls ─────────────────────────────────────────────────────── */
#controls {
    position: fixed;
    bottom: 24px;
    right: 16px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.fab {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.45);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.fab:hover  { background: #1d4ed8; }
.fab:active { transform: scale(0.94); }
.fab.active { background: #dc2626; box-shadow: 0 4px 16px rgba(220, 38, 38, 0.45); }

.btn-icon {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: #fff;
    color: #374151;
    border: 1px solid #e5e7eb;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.btn-icon:hover { background: #f3f4f6; }

/* ── Panels — mobile: bottom sheet ────────────────────────────────────────── */
.panel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    z-index: 600;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 32px rgba(0,0,0,0.16);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Detail panel: taller on mobile for a near-fullscreen feel */
#detail-panel {
    max-height: 96vh;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
}

.panel-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    flex: 1;
    margin-right: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-close {
    width: 32px; height: 32px;
    flex-shrink: 0;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.btn-close:hover { background: #e5e7eb; color: #111827; }

.panel-body {
    overflow-y: auto;
    padding: 16px 20px 32px;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.required { color: #dc2626; }

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #111827;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.form-group input[type="file"] {
    font-size: 0.875rem;
    color: #374151;
    padding: 6px 0;
}

.hint {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-bottom: 8px;
}

/* ── Photo previews ────────────────────────────────────────────────────────── */
.photo-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.photo-preview-item {
    position: relative;
    width: 80px; height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}

.photo-preview-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

.remove-photo {
    position: absolute;
    top: 3px; right: 3px;
    width: 20px; height: 20px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 0.6rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.remove-photo:hover { background: rgba(220, 38, 38, 0.9); }

/* ── Action buttons ────────────────────────────────────────────────────────── */
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    flex: 1;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s, opacity 0.15s;
}

.btn-primary:disabled,
.btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary  { background: #2563eb; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }

.btn-secondary { background: #f3f4f6; color: #374151; border: 1.5px solid #d1d5db; }
.btn-secondary:hover:not(:disabled) { background: #e5e7eb; }

.btn-danger   { background: #fff; color: #dc2626; border: 1.5px solid #fca5a5; }
.btn-danger:hover { background: #fef2f2; }

/* ── Detail panel content ──────────────────────────────────────────────────── */
.detail-category {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #f3f4f6;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 14px;
}

.detail-description {
    font-size: 0.95rem;
    line-height: 1.65;
    color: #374151;
    white-space: pre-wrap;
    margin-bottom: 16px;
}

.detail-photos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 16px;
}

.detail-photo {
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    cursor: zoom-in;
    width: 100%;
    display: block;
    transition: opacity 0.15s, transform 0.15s;
}
.detail-photo:hover { opacity: 0.88; transform: scale(1.02); }

.detail-actions {
    display: flex;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

/* ── Fullscreen photo viewer ───────────────────────────────────────────────── */
#photo-viewer {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.96);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}

#photo-viewer-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 8px;
}

#photo-viewer-close {
    position: absolute;
    top: 16px; right: 16px;
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
#photo-viewer-close:hover { background: rgba(255,255,255,0.28); }

/* ── Login overlay ─────────────────────────────────────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 800;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
.overlay.active { display: flex; }

.overlay-content {
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 32px 24px 44px;
    width: 100%;
}

.overlay-content h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #111827;
}

.overlay-content p {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.overlay-content form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.overlay-content input[type="password"] {
    padding: 12px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.overlay-content input[type="password"]:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.overlay-content button[type="submit"] {
    padding: 13px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.overlay-content button[type="submit"]:hover { background: #1d4ed8; }

.error-msg {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 8px;
}

.btn-link {
    display: block;
    background: none;
    border: none;
    color: #6b7280;
    font-size: 0.875rem;
    cursor: pointer;
    margin-top: 16px;
    text-align: center;
    text-decoration: underline;
    padding: 0;
}
.btn-link:hover { color: #374151; }

/* ── Leaflet custom marker ─────────────────────────────────────────────────── */
.map-marker {
    width: 32px; height: 32px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 2px solid rgba(0,0,0,0.18);
    box-shadow: 0 2px 8px rgba(0,0,0,0.28);
    display: flex; align-items: center; justify-content: center;
}

.map-marker i {
    transform: rotate(45deg);
    font-size: 0.85rem;
    color: #fff;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3));
}

/* ── Location dot pulse ───────────────────────────────────────────────────── */
.location-dot {
    animation: location-pulse 2s ease-in-out infinite;
}

@keyframes location-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

/* Locate button active state */
.btn-icon.active {
    color: #2563eb;
    border-color: #bfdbfe;
    background: #eff6ff;
}

/* ── Utility ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ================================================================
   Desktop overrides (≥ 768 px)
   ================================================================ */
@media (min-width: 768px) {
    /* Panels become a fixed sidebar on the right */
    .panel {
        left: auto;
        right: 20px;
        bottom: auto;
        top: 50%;
        transform: translateY(-50%);
        width: 380px;
        border-radius: 14px;
        max-height: 82vh;
        box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    }

    /* Reset detail-panel mobile override */
    #detail-panel {
        max-height: 82vh;
        top: 50%;
        transform: translateY(-50%);
    }

    .detail-photos {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Login overlay centered */
    .overlay {
        align-items: center;
        justify-content: center;
    }
    .overlay-content {
        border-radius: 14px;
        width: 420px;
        padding: 40px 36px;
    }
}
