#mapContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: row;
    transition: none !important;
    visibility: hidden;
}

#mapContainer * {
    transition: none !important;
}

#map {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    flex-grow: 1;
    background: #FFF;
    transition: transform 0.3s ease;
}

arcgis-map:focus-visible {
    outline: 2px solid transparent;
}

/* Sidebar Header with Back Button */
.sidebar-header {
    background: #ffffff;
    border-bottom: 1px solid #e1e8ed;
    padding: 1rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #1976d2;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
    margin-bottom: 0;
}

.back-button:hover {
    background: #1565c0;
    transform: translateX(-2px);
}

.back-button:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

.back-button svg {
    flex-shrink: 0;
}

.sidebar-logo {
    height: 40px;
    width: auto;
    margin-left: auto;
    display: block;
}

/* Request ID Badge */
.request-id-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    margin: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.badge-label {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Sidebar Sections */
.sidebar-section {
    margin: 0 1rem 1rem;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    background: #ffffff;
}

.sidebar-section summary {
    padding: 0.5rem;
    font-weight: 600;
    color: #263238;
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    transition: background 0.2s ease;
}

.sidebar-section summary::-webkit-details-marker {
    display: none;
}

lojic-sidebar {
    --sidebar-content-padding: 0;
}

/* CSS Arrow for closed state */
.sidebar-section summary::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid #546e7a;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    margin-right: 0.75rem;
    transition: transform 0.2s ease;
}

/* Sidebar Loading Overlay */
.sidebar-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.sidebar-loading-content {
    text-align: center;
}

.sidebar-loading-content .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e1e8ed;
    border-top: 4px solid #1976d2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

.sidebar-loading-content .loading-text {
    font-weight: 500;
    color: #546e7a;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Rotate arrow when open */
.sidebar-section[open] summary::before {
    transform: rotate(90deg);
}

.sidebar-section summary:hover {
    background: #f8f9fa;
}

.sidebar-section summary:focus {
    outline: 2px solid #1976d2;
    outline-offset: -2px;
}

.section-content {
    padding: 1rem;
    border-top: 1px solid #f0f3f7;
}

/* Info Rows */
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.info-row:not(:last-child) {
    border-bottom: 1px solid #f0f3f7;
}

.info-label {
    font-weight: 600;
    color: #546e7a;
    flex-shrink: 0;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: #37474f;
    margin-bottom: 0.5rem;
}

.help-text {
    display: block;
    font-size: 0.8rem;
    font-weight: 400;
    color: #767676;
    font-style: italic;
    margin-top: 0.25rem;
    margin-bottom: 0;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.form-input:disabled {
    background: #f5f7fa;
    color: #90a4ae;
    cursor: not-allowed;
}

.form-input.validationTextBoxError,
.form-select.validationTextBoxError {
    border-color: #d32f2f;
    background: #ffebee;
}

/* Zone Buttons */
.zone-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.zone-button {
    padding: 0.75rem;
    border: 2px solid #cfd8dc;
    border-radius: 6px;
    background: #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.zone-button.inactive {
    color: #546e7a;
}

.zone-button.active {
    background: #1976d2;
    border-color: #1976d2;
    color: #ffffff;
}

.zone-button:hover:not(.active) {
    border-color: #1976d2;
    color: #1976d2;
    background: #e3f2fd;
}

.zone-button.validationTextBoxError {
    border-color: #d32f2f;
    background: #ffebee;
}

/* Elevations Section */
.elevations-section {
    padding-top: 0.5rem;
    border-top: 2px solid #e1e8ed;
}

.section-heading {
    font-size: 1rem;
    font-weight: 600;
    color: #263238;
    margin-bottom: 1rem;
}

.elevation-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.elevation-toggle {
    min-width: 100px;
    padding: 0.75rem 1rem;
    border: 2px solid #cfd8dc;
    border-radius: 6px;
    background: #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.elevation-toggle.inactive {
    color: #546e7a;
}

.elevation-toggle.active {
    background: #4caf50;
    border-color: #4caf50;
    color: #ffffff;
}

.elevation-toggle:hover:not(.active) {
    border-color: #4caf50;
    color: #4caf50;
    background: #e8f5e9;
}

.elevation-input {
    flex: 1;
}

/* Firm Panel */
.firm-panel-widget {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    padding: 12px 16px;
    min-width: 220px;
    font-family: "Avenir Next", "Helvetica Neue", sans-serif;
    font-size: 13px;
}

.firm-panel-widget input:disabled {
    color: #333;
}

/* Submit Button */
.submit-button {
    width: 100%;
    padding: 1rem;
    color: #ffffff;
    background: #1976d2;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 0.5rem;
}

.submit-button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.submit-button:hover {
    background: #1565c0;
}

/* Basemap Button */
#basemapButton, #legendButton {
    --calcite-button-background-color: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    #mapContainer {
        flex-direction: column;
        height: 100dvh;
    }

    #map {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
    }

    lojic-sidebar {
        flex: 0 0 var(--mobile-size, 50dvh);
        width: 100%;
        height: var(--mobile-size, 50dvh);
        position: static;
        transform: none;
    }

    lojic-sidebar.collapsed {
        flex: 0 0 0;
        height: 0;
        overflow: hidden;
    }

    lojic-sidebar.mobile-open {
        transform: translateY(0);
    }

    .sidebar-header {
        top: -1px;
    }

    /* Firm Panel */
    .firm-panel-widget {
        width: 200px;
        max-width: calc(100vw - 32px);
    }

    .firm-panel-widget .form-input {
        padding: 4px 8px;
        font-size: 13px;
    }

    .firm-panel-widget .form-group {
        margin-bottom: 6px;
    }

    .firm-panel-widget .form-label {
        font-size: 13px;
        margin-bottom: 2px;
    }

    .firm-panel-widget.populated #firm-panel-hint {
        display: none;
    }

    .firm-panel-widget:not(.populated) {
        width: auto;
        padding: 6px 10px;
    }

    .firm-panel-widget:not(.populated) .form-group {
        display: none;
    }

    .firm-panel-widget:not(.populated) legend::after {
        content: " (tap map)";
    }
}

@media (max-width: 1860px) {
    .zone-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}