/* ═══════════════════════════════════════════════════════════════
   MOBILE STYLES — Responsive, touch-optimized
   ═══════════════════════════════════════════════════════════════ */

/* ─── Tablet and below ─── */
@media (max-width: 1024px) {
    .sidebar {
        width: 340px;
    }
}

/* ─── Mobile ─── */
@media (max-width: 768px) {
    /* Header */
    .header {
        padding: 10px 16px;
    }

    .brand-title {
        font-size: 1.1rem;
    }

    .brand-subtitle {
        font-size: 0.7rem;
    }

    .header-stats {
        gap: 6px;
    }

    .stat-badge {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    /* Sidebar becomes overlay */
    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        max-width: 400px;
        height: 100vh;
        z-index: var(--z-modal);
        box-shadow: -4px 0 24px rgba(0,0,0,0.5);
        transform: translateX(100%);
        transition: transform var(--transition-normal);
    }

    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }

    .sidebar-close {
        display: flex;
    }

    /* Footer */
    .footer {
        padding: 8px 12px;
    }

    .footer-info {
        display: none;
    }

    .footer-actions {
        margin-left: auto;
    }

    /* Popup adjustments */
    .popup-content {
        min-width: 260px;
        max-width: calc(100vw - 60px);
    }

    .popup-header {
        padding: 16px 16px 12px;
    }

    .popup-title {
        font-size: 1.1rem;
    }

    .popup-body {
        padding: 12px 16px;
    }

    .popup-actions {
        padding: 0 16px 16px;
        flex-direction: column;
    }

    .btn-popup {
        width: 100%;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        border-radius: var(--radius-md);
    }

    .modal-body {
        padding: 16px;
    }

    .info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    /* Results list */
    .result-card {
        padding: 12px 14px;
    }

    .result-name {
        font-size: 0.85rem;
    }

    /* Custom marker smaller on mobile */
    .marker-inner {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .marker-price {
        font-size: 8px;
        padding: 1px 4px;
    }
}

/* ─── Small mobile ─── */
@media (max-width: 480px) {
    .sidebar {
        max-width: 100%;
    }

    .header-stats {
        display: none;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .price-presets {
        flex-direction: column;
    }

    .price-presets .chip {
        width: 100%;
        text-align: center;
    }
}

/* ─── Touch optimizations ─── */
@media (hover: none) and (pointer: coarse) {
    .layer-toggle,
    .result-card,
    .chip,
    .facility-tag {
        min-height: 44px;
    }

    .btn-icon {
        width: 44px;
        height: 44px;
    }

    .leaflet-control-zoom a {
        width: 44px !important;
        height: 44px !important;
        line-height: 44px !important;
    }
}

/* ─── Safe area for notched phones ─── */
@supports (padding: max(0px)) {
    .header {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .footer {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .sidebar {
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

/* ─── Landscape mobile ─── */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        padding: 6px 12px;
    }

    .brand-title {
        font-size: 1rem;
    }

    .footer {
        padding: 4px 8px;
    }

    .popup-content {
        max-height: 80vh;
    }
}
