/**
 * Portal shell — desktop nav + mobile drawer (no layout gap when closed).
 *
 * Company and seaman: full left sidebar (.fs-sea-sidebar) when body has fs-portal-shell.
 */

:root {
  --fs-bp-portal-mobile: 900px;
  --fs-portal-rail-w: 108px;
  --fs-portal-sidebar-w: 248px;
}

/* ——— Desktop (≥901px) ——— */
@media (min-width: 901px) {
  body.fs-portal-shell .fs-sea-app {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    min-height: calc(100vh - var(--fs-global-header-h, 80px));
  }

  body.fs-portal-shell .fs-sea-mobile-bar,
  body.fs-portal-shell .fs-sea-sidebar-backdrop {
    display: none !important;
  }

  body.fs-portal-shell .fs-sea-main {
    order: 2;
    flex: 1;
    min-width: 0;
  }

  /* Company: full sidebar */
  body.fs-portal-shell:not(.fs-portal-nav-rail) .fs-sea-sidebar {
    order: 1;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: static;
    transform: none;
    width: var(--fs-portal-sidebar-w, 248px);
    max-width: none;
    box-shadow: none;
    pointer-events: auto;
    background: #ffffff;
    border-right: 1px solid #e8eef5;
  }

  body.fs-portal-shell:not(.fs-portal-nav-rail) .fs-sea-rail {
    display: none !important;
  }

  /* Seaman: slim icon rail (matches vacancies mockup) */
  body.fs-portal-nav-rail .fs-sea-sidebar {
    display: none !important;
  }

  body.fs-portal-nav-rail .fs-sea-rail {
    order: 1;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: var(--fs-portal-rail-w);
    box-sizing: border-box;
    background: #ffffff;
    border-right: 1px solid #e8eef5;
    padding: 18px 8px 24px;
    position: static;
    transform: none;
    pointer-events: auto;
    z-index: 20;
  }

  body.fs-portal-nav-rail .fs-sea-rail-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
  }
}

/* ——— Mobile (≤900px) ——— */
@media (max-width: 900px) {
  body.fs-portal-shell .fs-sea-app {
    display: block;
    position: relative;
    min-height: 0;
  }

  body.fs-portal-shell .fs-sea-mobile-bar {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 12px 12px 0;
    background: transparent;
    border-bottom: none;
    position: static;
  }

  body.fs-portal-shell .fs-sea-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid #d9e6f4;
    background: #fff;
    color: var(--text, #0f2340);
    box-shadow: 0 1px 2px rgba(15, 35, 64, 0.06);
    cursor: pointer;
    font-family: inherit;
  }

  /* Icon-only trigger; the label stays for screen readers. */
  body.fs-portal-shell .fs-sea-nav-toggle-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  body.fs-portal-shell .fs-sea-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 85;
    margin: 0;
    padding: 0;
    border: none;
    background: rgba(3, 19, 38, 0.45);
    cursor: pointer;
  }

  body.fs-portal-shell .fs-sea-sidebar-backdrop[hidden],
  body.fs-portal-shell:not(.fs-sea-nav-open) .fs-sea-sidebar-backdrop {
    display: none !important;
    pointer-events: none !important;
  }

  body.fs-portal-shell.fs-sea-nav-open .fs-sea-sidebar-backdrop:not([hidden]) {
    display: block;
  }

  /* Drawer panel — top/height from portal-mobile-fixes.css + --fs-mobile-drawer-top (JS) */
  body.fs-portal-shell .fs-sea-sidebar,
  body.fs-portal-shell .fs-sea-rail {
    position: fixed !important;
    left: 0;
    bottom: 0;
    z-index: 95;
    width: min(288px, 88vw) !important;
    max-width: 100%;
    margin: 0 !important;
    /* top / padding-top set in portal-mobile-fixes.css (+ JS --fs-mobile-drawer-top) */
    flex: none !important;
    display: flex !important;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    border-right: 1px solid #e4edf5;
    box-shadow: 8px 0 32px rgba(16, 42, 74, 0.18);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
  }

  body.fs-portal-shell.fs-sea-nav-open .fs-sea-sidebar,
  body.fs-portal-shell.fs-sea-nav-open .fs-sea-rail {
    transform: translateX(0);
  }

  body.fs-portal-shell.fs-sea-nav-open {
    overflow: hidden;
  }

  body.fs-portal-shell:not(.fs-sea-nav-open) .fs-sea-sidebar,
  body.fs-portal-shell:not(.fs-sea-nav-open) .fs-sea-rail {
    pointer-events: none;
  }

  body.fs-portal-shell .fs-sea-sidebar-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 18px;
    width: 100%;
  }

  body.fs-portal-nav-rail .fs-sea-rail-nav {
    align-items: stretch;
    gap: 4px;
  }

  body.fs-portal-nav-rail .fs-sea-rail-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    max-width: none;
    padding: 12px 14px;
    font-size: 0.9rem;
    text-align: left;
  }

  body.fs-portal-nav-rail .fs-sea-rail-label {
    white-space: normal;
    text-overflow: unset;
  }

  body.fs-portal-shell .fs-sea-nav-group {
    flex: none;
    width: 100%;
  }

  body.fs-portal-shell .fs-sea-nav-link {
    white-space: normal;
  }

  body.fs-portal-shell .fs-sea-sidebar-card {
    flex: none;
    width: 100%;
    margin-top: 16px;
  }

  body.fs-portal-shell .fs-sea-main {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  body.fs-portal-shell .fs-dash-page-wrap,
  body.fs-portal-shell .fs-sea-main > .fs-sailor-browse,
  body.fs-portal-shell .fs-sea-main > .fs-dash-page-wrap,
  body.fs-portal-shell .fs-company-page-wrap {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}
