/* MPAS Configuration Studio V2-M9f.3b, Atmosphere sidebar architecture parity.
   Ocean-only presentation. The existing Ocean mode selector and model APIs are unchanged.
   Reference: Atmosphere 40px icon rail, 40px #0074d9 header, and scrolling content. */

#v2-module-home:has(#v2-ocean-workspace:not([hidden])) #v2-ocean-workspace {
    display: flex;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: clamp(305px, 22.5vw, 460px);
    max-width: 100vw;
    min-width: 0;
    height: 100dvh;
    padding: 0;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-right: 1px solid #bdc8d3;
    border-radius: 0;
    background: #fff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, .17);
    font-size: 14px;
    line-height: 1.5;
}

/* Match Atmosphere's leaflet-sidebar 40px icon-only navigation rail. */
#v2-ocean-workspace #v2-ocean-mode-rail {
    position: relative;
    inset: auto;
    z-index: 2;
    display: flex;
    flex: 0 0 40px;
    flex-direction: column;
    gap: 0;
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #fff;
    border: 0;
    border-right: 1px solid #e3e7eb;
    box-shadow: none;
}
#v2-ocean-workspace #v2-ocean-mode-rail .v2-ocean-mode-rail-title {
    display: none;
}
#v2-ocean-workspace #v2-ocean-mode-rail button,
#v2-ocean-workspace #v2-ocean-mode-rail #v2-ocean-mode-home,
#v2-ocean-workspace #v2-ocean-mode-rail #v2-ocean-sidebar-expand {
    display: block;
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    height: 40px;
    min-height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: #333;
    background: transparent;
    box-shadow: none;
    font-size: 16px;
    font-weight: 400;
    line-height: 40px;
    text-align: center;
}
#v2-ocean-workspace #v2-ocean-mode-rail button i {
    display: inline-block;
    margin: 0;
    font-size: 16px;
    line-height: 40px;
}
#v2-ocean-workspace #v2-ocean-mode-rail button span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
#v2-ocean-workspace #v2-ocean-mode-rail button[aria-selected="true"] {
    color: #fff;
    background: #0074d9;
    border: 0;
    box-shadow: none;
}
#v2-ocean-workspace #v2-ocean-mode-rail button:hover:not(:disabled) {
    color: #000;
    background: #eee;
    border: 0;
}
#v2-ocean-workspace #v2-ocean-mode-rail button[aria-selected="true"]:hover:not(:disabled) {
    color: #fff;
    background: #0074d9;
}
#v2-ocean-workspace #v2-ocean-mode-rail #v2-ocean-mode-home {
    flex: 0 0 40px;
    margin-top: auto;
    border-top: 1px solid #e2e6eb;
}
#v2-ocean-workspace #v2-ocean-mode-rail #v2-ocean-sidebar-expand {
    display: none;
    margin-bottom: 0;
    color: #0074d9;
}

/* Header and scrolling content are separate, as in Atmosphere. */
#v2-ocean-workspace #v2-ocean-sidebar-column {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background: #fff;
}
#v2-ocean-workspace #v2-ocean-sidebar-header {
    position: relative;
    display: flex;
    flex: 0 0 40px;
    align-items: center;
    gap: 7px;
    width: 100%;
    height: 40px;
    min-height: 40px;
    margin: 0;
    padding: 0 40px 0 20px;
    color: #fff;
    background: #0074d9;
    border: 0;
    border-radius: 0;
}
#v2-ocean-workspace #v2-ocean-sidebar-header h2 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: #fff;
    font-size: 19.2px;
    font-weight: 400;
    line-height: 40px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#v2-ocean-workspace #v2-ocean-sidebar-header .v2-ocean-version-badge {
    flex: 0 0 auto;
    padding: 2px 4px;
    border-radius: 3px;
    color: #343a40;
    background: #f8f9fa;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}
#v2-ocean-workspace #v2-ocean-sidebar-header #v2-ocean-sidebar-collapse {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: #fff;
    background: transparent;
    box-shadow: none;
    font-size: 16px;
    font-weight: 400;
    line-height: 40px;
    text-align: center;
}
#v2-ocean-workspace #v2-ocean-sidebar-header #v2-ocean-sidebar-collapse:hover {
    background: rgba(255,255,255,.15);
}
#v2-ocean-workspace #v2-ocean-sidebar-scroll {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    width: 100%;
    margin: 0;
    padding: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    color: #212529;
    background: #fff;
    font-size: 14px;
    line-height: 1.5;
    scrollbar-width: thin;
}
#v2-ocean-workspace #v2-ocean-sidebar-intro {
    margin: 0 0 9px;
    padding: 0 0 9px;
    border-bottom: 1px solid #dee2e6;
}
#v2-ocean-workspace #v2-ocean-sidebar-intro h3 {
    margin: 0 0 4px;
    color: #243548;
    font-size: 15px;
    font-weight: 650;
    line-height: 1.35;
}
#v2-ocean-workspace #v2-ocean-sidebar-intro p {
    margin: 4px 0;
    color: #6c757d;
    font-size: 12px;
    line-height: 1.45;
}
#v2-ocean-workspace #v2-ocean-sidebar-intro #v2-ocean-workspace-status {
    margin-top: 8px;
    padding: 7px 8px;
    font-size: 12px;
    font-weight: 600;
}
#v2-ocean-workspace #v2-ocean-sidebar-intro #v2-ocean-map-note {
    margin: 4px 0;
    padding: 0 0 0 8px;
    font-size: 11px;
}
#v2-ocean-workspace #v2-ocean-workspace-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    margin: 0 0 9px;
    padding: 0 0 9px;
    background: transparent;
    border-bottom: 1px solid #dee2e6;
}
#v2-ocean-workspace #v2-ocean-workspace-controls label {
    color: #343a40;
    font-size: 13px;
    font-weight: 600;
}
#v2-ocean-workspace #v2-ocean-workspace-controls input[type="search"] {
    width: 100%;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 13px;
}
#v2-ocean-workspace #v2-ocean-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0 0 8px;
    padding: 0;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}
#v2-ocean-workspace #v2-ocean-tabs button {
    flex: 0 1 auto;
    margin: 0;
    padding: 7px 6px;
    border-radius: 3px 3px 0 0;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.25;
}
#v2-ocean-workspace [data-ocean-pane] {
    min-height: 0;
    margin: 0 0 10px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
#v2-ocean-workspace #v2-ocean-editor-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 5px;
    margin: 0 0 9px;
}
#v2-ocean-workspace #v2-ocean-editor-actions button {
    margin: 0;
    padding: 5px 8px;
    font-size: 11px;
}
#v2-ocean-workspace #v2-ocean-records { gap: 6px; }
#v2-ocean-workspace .v2-ocean-record > summary {
    padding: 8px 9px;
    font-size: 12px;
    line-height: 1.4;
}
#v2-ocean-workspace .v2-ocean-option {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 9px;
    font-size: 12px;
}
#v2-ocean-workspace .v2-ocean-option :is(
    .v2-ocean-option-name, .v2-ocean-option-value, .v2-ocean-option-editor,
    .v2-ocean-option-include, .v2-ocean-option-reset,
    .v2-ocean-option-metadata, .v2-ocean-option-description) {
    grid-column: 1 / -1;
}
#v2-ocean-workspace .v2-ocean-option-editor { width: 100%; }
#v2-ocean-workspace .v2-ocean-option-reset { justify-self: start; }
#v2-ocean-workspace .v2-ocean-option-description { font-size: 12px; }
#v2-ocean-workspace #v2-ocean-back {
    padding: 6px 8px;
    font-size: 12px;
}

/* Collapse only the Ocean sidebar pane, leaving the rail and underlying map. */
#v2-module-home:has(#v2-ocean-workspace:not([hidden])) #v2-ocean-workspace.is-collapsed {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
}
#v2-ocean-workspace.is-collapsed #v2-ocean-sidebar-column { display: none; }
#v2-ocean-workspace.is-collapsed #v2-ocean-mode-rail #v2-ocean-sidebar-expand {
    display: block;
}
@media (max-width: 660px) {
    #v2-module-home:has(#v2-ocean-workspace:not([hidden])) #v2-ocean-workspace {
        width: min(390px, 100vw);
    }
    #v2-ocean-workspace #v2-ocean-mode-rail { flex-basis: 40px; width: 40px; }
}
@media (prefers-reduced-motion: reduce) {
    #v2-ocean-workspace #v2-ocean-mode-rail button,
    #v2-ocean-workspace #v2-ocean-sidebar-header button { transition: none; }
}
