/* ============================================
   Spatial-Sandbox Layout — layout.css
   ============================================ */

/* ---- Base Shell ---- */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: var(--bg);
    color: var(--text);
}

/* ---- Header ---- */
.app-header {
    height: var(--header-h);
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-6);
    flex-shrink: 0;
    z-index: 1000;
    gap: var(--sp-4);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    white-space: nowrap;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.logo-mark {
    color: var(--accent);
    font-size: 1.3rem;
    line-height: 1;
}

.logo-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 6px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    flex: 1;
    justify-content: center;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    padding: var(--sp-1) var(--sp-3);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--t-base), background-color var(--t-base);
}

.main-nav a:hover {
    color: var(--text);
    background-color: var(--bg-alt);
    text-decoration: none;
}

.main-nav a.active {
    color: var(--accent);
    background-color: var(--accent-light);
}

/* Header right actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-shrink: 0;
}

.icon-btn-header {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--t-base), background-color var(--t-base), border-color var(--t-base);
    font-size: 1rem;
}

.icon-btn-header:hover {
    color: var(--text);
    background-color: var(--bg-alt);
    border-color: var(--border-strong);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: var(--sp-2);
    border-radius: var(--radius-md);
}

/* ---- App Container ---- */
.app-container {
    display: flex;
    height: calc(100vh - var(--header-h) - var(--ad-h));
    height: calc(100dvh - var(--header-h) - var(--ad-h));
    min-height: 400px;
    flex-shrink: 0;
    overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    z-index: 10;
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-section {
    padding: var(--sp-4);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-subtle);
    margin-bottom: var(--sp-3);
}

.sidebar-footer {
    padding: var(--sp-3) var(--sp-4);
    border-top: 1px solid var(--border);
    background-color: var(--bg-alt);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    flex-shrink: 0;
}

/* ---- Map Container ---- */
.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ---- Ad Banner ---- */
.ad-banner {
    height: var(--ad-h);
    background-color: var(--ad-bg);
    border-top: 1px solid var(--ad-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.ad-banner::before {
    content: 'Advertisement';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ad-text);
}

/* ---- Footer ---- */
.app-footer {
    height: var(--footer-h);
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-6);
    flex-shrink: 0;
    z-index: 1000;
}

.app-footer span {
    font-size: 0.75rem;
    color: var(--text-subtle);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}

.footer-links a {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--t-base);
}

.footer-links a:hover {
    color: var(--accent);
    text-decoration: none;
}

/* ---- Geometry Info Panel ---- */