/* Saldin Fitness v50.1 responsive patch.
   The student menu is one drawer (the sidebar); its inner nav must not become a second fixed drawer. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-width: 320px; overflow-x: clip; }
img, video, canvas, iframe { max-width: 100%; }

/* Student portal: use a single, properly sized off-canvas drawer through phone and tablet widths. */
@media (max-width: 900px) {
  .student-dashboard-layout {
    display: block !important;
    width: 100%;
    max-width: 1520px;
    min-width: 0;
    padding: 10px 14px 34px;
    margin-inline: auto;
  }

  .student-dashboard-sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    z-index: 1102 !important;
    display: flex !important;
    flex-direction: column;
    width: min(88vw, 340px) !important;
    max-width: calc(100vw - 40px) !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    min-width: 0;
    margin: 0;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    border: 0;
    border-right: 1px solid #dce9ef;
    border-radius: 0 20px 20px 0;
    overflow: hidden;
    background: #fff;
    box-shadow: 18px 0 50px rgba(10, 31, 46, .22);
    transform: translateX(-105%);
    transition: transform .24s cubic-bezier(.2,.8,.2,1);
    overscroll-behavior: contain;
    will-change: transform;
  }
  .student-dashboard-sidebar.is-open { transform: translateX(0); }

  /* Critical fix: the nav is a normal flex child inside the drawer, never a second fixed panel. */
  .student-dashboard-sidebar .student-dashboard-subnav {
    position: static !important;
    inset: auto !important;
    z-index: auto !important;
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    width: 100% !important;
    min-width: 0;
    min-height: 0;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0;
    padding: 0 2px 8px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
    transition: none !important;
    pointer-events: auto !important;
    visibility: visible !important;
  }
  .student-dashboard-sidebar .student-dashboard-subnav[aria-hidden="true"] {
    visibility: hidden !important;
    pointer-events: none !important;
  }
  .student-dashboard-sidebar .student-dashboard-subnav[aria-hidden="false"] {
    visibility: visible !important;
    pointer-events: auto !important;
  }
  .student-dashboard-sidebar .student-nav-mobile-head {
    display: flex !important;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 7px 7px 13px;
    margin: 0 0 8px;
    border-bottom: 1px solid #e9f0f4;
    color: #1d3f55;
  }
  .student-nav-mobile-head strong { font-size: 1rem; line-height: 1.3; }
  .student-nav-mobile-head button {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #dce9ef;
    border-radius: 12px;
    background: #f5f9fb;
    color: #1d3f55;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
  }
  .student-sidebar-brand { flex: 0 0 auto; min-width: 0; padding: 4px 7px 15px; gap: 10px; }
  .student-sidebar-brand > div { min-width: 0; }
  .student-sidebar-brand strong { font-size: .92rem; }
  .student-sidebar-brand small { font-size: .74rem; }
  .student-sidebar-label { flex: 0 0 auto; padding: 15px 9px 7px; }

  .student-dashboard-sidebar .student-dashboard-subnav > a {
    display: flex !important;
    position: relative;
    align-items: center !important;
    justify-content: flex-start !important;
    flex: 0 0 auto;
    gap: 11px !important;
    width: 100% !important;
    min-width: 0;
    min-height: 46px;
    height: auto;
    padding: 9px 10px !important;
    border-radius: 11px;
    font-size: .92rem !important;
    line-height: 1.35;
    text-align: left;
    white-space: normal !important;
    overflow-wrap: anywhere;
    touch-action: manipulation;
  }
  .student-dashboard-sidebar .student-dashboard-subnav > a > .student-nav-icon {
    flex: 0 0 29px;
    width: 29px;
    height: 29px;
    margin: 0;
  }
  .student-dashboard-sidebar .student-dashboard-subnav > a > span:nth-child(2) {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: left;
  }
  .student-dashboard-sidebar .student-dashboard-subnav .dashboard-update-count {
    flex: 0 0 auto;
    margin-left: auto;
  }
  .student-sidebar-bottom {
    flex: 0 0 auto;
    min-width: 0;
    margin-top: 8px;
    padding: 12px 4px 2px;
  }
  .student-sidebar-bottom > div { min-width: 0; }
  .student-sidebar-bottom strong { max-width: 190px; }

  .student-dashboard-nav-toggle {
    position: sticky;
    top: calc(78px + env(safe-area-inset-top, 0px));
    z-index: 12;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    margin: 0 0 12px;
    padding: 11px 13px;
    border: 1px solid #dce9ef;
    border-radius: 13px;
    background: rgba(255,255,255,.98);
    color: #1c475f;
    font: inherit;
    font-weight: 750;
    box-shadow: 0 8px 22px rgba(21,58,80,.09);
    cursor: pointer;
    touch-action: manipulation;
  }
  .student-dashboard-nav-toggle > span:first-child { display: flex; align-items: center; gap: 9px; min-width: 0; }
  .student-dashboard-nav-toggle svg { display: block; flex: 0 0 20px; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
  .student-nav-toggle-meta { min-width: 0; color: #638294; font-size: .74rem; text-align: right; }
  .student-dashboard-nav-backdrop:not([hidden]) {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1101 !important;
    display: block;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    background: rgba(13,35,51,.56);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    touch-action: manipulation;
  }
  .student-dashboard-nav-backdrop[hidden] { display: none !important; }
  body.student-nav-open { overflow: hidden !important; overscroll-behavior: none; }
  body.student-nav-open .social-chat-rail { display: none !important; }

  .student-dashboard-main { width: 100%; max-width: 100%; min-width: 0; }
  .student-dashboard-main > * { min-width: 0; max-width: 100%; }
  .student-dashboard-main > .student-dashboard-hero { margin: 0 0 15px; min-height: 0; padding: clamp(23px, 5vw, 34px) clamp(14px, 4vw, 22px); border-radius: 20px; }
  .student-dashboard-main .student-dashboard-hero h1 { font-size: clamp(2rem, 8.6vw, 2.8rem); line-height: 1.05; overflow-wrap: anywhere; }
  .student-dashboard-main .student-dashboard-hero-copy { width: 100%; min-width: 0; }
  .student-dashboard-main .student-dashboard-hero-copy > p:not(.kicker) { overflow-wrap: anywhere; }
  .student-dashboard-main .student-dashboard-hero-actions { display: flex; flex-direction: column; align-items: stretch; gap: 9px; margin-top: 16px; }
  .student-dashboard-main .student-dashboard-hero-actions > a { display: flex; align-items: center; justify-content: center; width: 100%; min-width: 0; margin: 0; white-space: normal; text-align: center; }
  .student-dashboard-main > .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; margin: 0 0 15px; }
  .student-dashboard-main .stats .stat { min-width: 0; padding: 13px 12px; overflow-wrap: anywhere; }
  .student-dashboard-main .stats .stat b { overflow-wrap: anywhere; }
  .student-dashboard-main > .dashboard-quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; margin: 0 0 16px; }
  .student-dashboard-main .dashboard-quick-card { min-width: 0; padding: 14px 12px; border-radius: 16px; overflow-wrap: anywhere; }
  .student-dashboard-main .dashboard-quick-card strong,
  .student-dashboard-main .dashboard-quick-card small { overflow-wrap: anywhere; }
  .student-dashboard-main > .panel { width: 100%; max-width: 100%; min-width: 0; margin: 0 0 15px; padding: clamp(14px, 3.8vw, 22px); border-radius: 18px; }
  .student-dashboard-main .panel h2,
  .student-dashboard-main .panel h3,
  .student-dashboard-main .panel p { overflow-wrap: anywhere; }
  .student-dashboard-main table { display: block; width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .student-dashboard-main input,
  .student-dashboard-main select,
  .student-dashboard-main textarea { width: 100%; max-width: 100%; min-width: 0; font-size: 16px; }
  .student-dashboard-main button,
  .student-dashboard-main .btn { max-width: 100%; overflow-wrap: anywhere; }
  .student-dashboard-main .chat,
  .student-dashboard-main .chatform { min-width: 0; max-width: 100%; }
}

@media (max-width: 600px) {
  .student-dashboard-layout { padding: 8px 10px 28px; }
  .student-dashboard-main .student-dashboard-hero { padding: 24px 14px; border-radius: 18px; }
  .student-dashboard-main .student-dashboard-hero .kicker { letter-spacing: .14em; font-size: .68rem; }
  .student-dashboard-main > .stats { gap: 8px; }
  .student-dashboard-main .stats .stat { padding: 12px 10px; border-radius: 14px; font-size: .82rem; line-height: 1.45; }
  .student-dashboard-main .stats .stat b { display: block; margin-top: 5px; font-size: 1.35rem; }
  .student-dashboard-main .dashboard-quick-card { min-height: 0; padding: 13px 11px; }
  .student-dashboard-main .dashboard-quick-card .quick-icon { width: 36px; height: 36px; margin-bottom: 8px; }
}

@media (max-width: 380px) {
  .student-dashboard-layout { padding-inline: 8px; }
  .student-dashboard-sidebar { width: min(90vw, 320px) !important; max-width: calc(100vw - 28px) !important; }
  .student-dashboard-nav-toggle { padding-inline: 10px; }
  .student-nav-toggle-meta { font-size: .68rem; }
  .student-dashboard-main > .dashboard-quick-actions { grid-template-columns: minmax(0, 1fr); }
  .student-dashboard-main .dashboard-quick-card { display: grid; grid-template-columns: 38px minmax(0,1fr); column-gap: 11px; align-items: center; }
  .student-dashboard-main .dashboard-quick-card .quick-icon { grid-row: span 2; margin: 0; }
  .student-dashboard-main .dashboard-quick-card strong,
  .student-dashboard-main .dashboard-quick-card small { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .student-dashboard-sidebar,
  .student-dashboard-nav-toggle,
  .student-dashboard-nav-backdrop { transition: none !important; scroll-behavior: auto !important; }
}
