/* ============================================
   Spatial-Sandbox Responsive — responsive.css
   ============================================ */

/* Tablet (900px and below) */
@media (max-width: 900px) {
    :root {
        --sidebar-w: 270px;
    }
}

/* Mobile (768px and below) */
@media (max-width: 768px) {
    .app-header {
        padding: 0 var(--sp-4);
    }

    .main-nav {
        display: none;
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        background-color: var(--surface);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        align-items: flex-start;
        padding: var(--sp-3);
        gap: var(--sp-1);
        box-shadow: var(--shadow-md);
        z-index: 999;
    }

    .main-nav.open {
        display: flex;
    }

    .main-nav a {
        width: 100%;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .app-container {
        flex-direction: column-reverse;
        height: calc(100vh - var(--header-h) - var(--ad-h));
        height: calc(100dvh - var(--header-h) - var(--ad-h));
        min-height: 480px;
    }

    .sidebar {
        width: 100%;
        height: 45%;
        border-right: none;
        border-top: 1px solid var(--border);
    }

    .map-container {
        height: 55%;
        flex: none;
    }

    .doc-section {
        padding: 10px var(--sp-4) 10px;
        gap: var(--sp-4);
    }

    .doc-title {
        font-size: 1.5rem;
    }

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

    .app-footer {
        gap: var(--sp-3);
        flex-wrap: wrap;
        height: auto;
        padding: var(--sp-2) var(--sp-4);
    }

    .footer-links {
        gap: var(--sp-3);
    }

    .toast-container {
        bottom: var(--sp-4);
        right: var(--sp-4);
        left: var(--sp-4);
    }

    .toast {
        max-width: 100%;
    }

    .modal-box {
        border-radius: var(--radius-lg);
    }

    .modal-head,
    .modal-body,
    .modal-foot {
        padding-left: var(--sp-4);
        padding-right: var(--sp-4);
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .geometry-card-actions {
        flex-wrap: wrap;
    }

    .ad-banner {
        height: 60px;
    }
}

/* ── Print ── */
@media print {
    .app-header, .ad-banner, .modal-overlay, .sidebar,
    .leaflet-control-container, .footer-bar, .menu-toggle,
    .header-actions, .drawing-toolbar { display: none !important; }
    .app-container { height: auto !important; }
    #map { height: 600px !important; width: 100% !important; }
}