/* 13-responsive.css — All @media Queries: Mobile Sidebar, Hamburger Menu, Responsive Adjustments (900px, 480px) */

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */

/* Mobile menu button — hidden on desktop */
.mobile-menu-btn {
  display: none; background: none; border: none; cursor: pointer;
  padding: 10px; min-width: 44px; min-height: 44px;
  flex-direction: column; gap: 5px; flex-shrink: 0;
  align-items: center; justify-content: center;
}
.mobile-menu-btn span {
  display: block; width: 22px; height: 2px; background: var(--cobalt);
  transition: all 0.3s;
}

/* Sidebar backdrop — hidden by default */
.sidebar-close-btn {
  display: none; position: absolute; top: 12px; right: 12px;
  background: none; border: none; color: rgba(255,255,255,0.6);
  font-size: 20px; cursor: pointer; z-index: 10;
  width: 44px; height: 44px; line-height: 44px; text-align: center;
  border-radius: var(--radius-md); padding: 0;
}
.sidebar-close-btn:hover { color: white; background: rgba(255,255,255,0.1); }

.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 99;
}

@media (max-width: 900px) {
  .portal-shell { grid-template-columns: 1fr; }

  /* Sidebar becomes slide-in overlay */
  .sidebar {
    display: flex;
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-backdrop.active { display: block; }

  /* Show hamburger */
  .mobile-menu-btn { display: flex; }
  .sidebar-close-btn { display: block; }

  .phase-body { grid-template-columns: 1fr; padding: 20px; padding-bottom: 40px; }

  /* Task card grid: 2 columns on tablet, hide connector */
  .task-list { grid-template-columns: repeat(2, 1fr); }
  /* Mobile: simplify hero — solid dark band at bottom for text */
  .phase-header .phase-header-sub { display: none; }
  .phase-header .phase-meta { display: none; }
  .phase-header {
    padding: 0 20px 20px;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
  }
  /* Ensure pathway accent stripe doesn't create layout shift on mobile */
  .phase-header.pathway-erv::after,
  .phase-header.pathway-nomad::after,
  .phase-header.pathway-js::after,
  .phase-header.pathway-student::after,
  .phase-header.pathway-family::after {
    position: absolute;
    z-index: 3;
    height: 3px;
  }
  /* Mobile: solid dark brown band behind text at the bottom of the header */
  .phase-header::before {
    content: '';
    display: block;
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 90px;
    z-index: 1;
    background: var(--text);
  }
  .phase-header-overlay {
    display: none !important;
  }
  .phase-header-phase-num {
    text-shadow: none;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    border-radius: 0;
    font-size: 9px;
    letter-spacing: 0.25em;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--gold-light);
  }
  .phase-header h1 {
    text-shadow: none;
    margin-bottom: 0;
    word-break: break-word;
  }

  .phase-mobile-details {
    display: block;
    background: #fff;
    border-bottom: 1px solid #e8e2d8;
    padding: 20px;
  }
  .phase-mobile-sub {
    font-family: 'Spectral', serif;
    font-size: 14px;
    font-style: italic;
    color: #555;
    line-height: 1.65;
    margin: 0 0 16px;
  }
  .phase-mobile-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .phase-mobile-meta-item {
    padding: 10px 12px;
    background: #f8f5ef;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--terracotta);
  }
  .phase-mobile-meta-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #8C7A68;
    margin-bottom: 3px;
  }
  .phase-mobile-meta-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--cobalt);
    line-height: 1.3;
  }
  .topbar { padding: 0 16px; gap: 8px; }
  /* Hide topbar text badges on tablet — too tight */
  .topbar-designation { display: none; }
  .topbar-pathway { display: none; }
  .topbar-user-email { display: none; }
  .pathway-selector { grid-template-columns: repeat(3, 1fr); }

  /* Callout boxes — reduce bleed on narrower padding */
  .insight-box { margin-left: -20px; margin-right: -20px; padding: 20px; }
  .warning-box { margin-left: -20px; margin-right: -20px; padding: 20px; }
  .tk-glossary-table td:first-child { width: 130px; min-width: 110px; font-size: 12px; }
  .tk-glossary-table td:last-child { font-size: 12px; }
  #tk-glossary .wb-scroll { padding: 20px; }
  #tk-visa .wb-scroll { padding: 20px; }
  .tk-visa-label { white-space: normal !important; }
  .tk-visa-table { min-width: 700px; }
  .tk-visa-table td { font-size: 11px; padding: 7px 8px; }
  .tk-visa-table thead th { font-size: 10px; padding: 8px 8px; }
  #tk-consulate .wb-scroll { padding: 20px; }
  #tk-consulate .wb-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  #tk-consulate .wb-tab { white-space: nowrap; flex-shrink: 0; }
  .tk-con-label { white-space: normal !important; }
  #tk-tracker .wb-scroll { padding: 20px; }
  /* Wrap tracker tables in a scrollable container */
  .tk-trk-table { min-width: 700px; }
  .tk-trk-doc { min-width: 120px !important; }
  .tk-trk-phase { white-space: normal !important; }
  /* Make the scroll area for tracker horizontally scrollable */
  #tk-tracker .wb-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #tk-resources .wb-scroll { padding: 20px; }
  .tk-res-name { white-space: normal !important; min-width: 100px !important; }
  .tk-res-url { min-width: 100px !important; }

  /* Breadcrumb truncation on mobile */
  .topbar-breadcrumb { min-width: 0; overflow: hidden; }
  .topbar-breadcrumb-current {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 50vw; display: inline-block;
  }

  /* Onboarding steps — ensure all 4 visible */
  .ob-steps-preview { flex-wrap: wrap; }
  .ob-step-prev { flex: 1 1 22%; min-width: 100px; }

  /* Workbook rating rows — responsive grid */
  .wb-rating-row { grid-template-columns: 160px 1fr auto; gap: 10px; }
  .wb-rating-label { font-size: 12px; }

  /* Timeline builder — narrower first columns */
  .tl-row { grid-template-columns: 130px 90px 1fr; }
  .tl-cell { padding: 10px 12px; }

  /* Workbook topbar — tighter */
  .wb-topbar { padding: 0 16px; }
  .wb-nav-bar { padding: 18px 16px; }

  /* Calculator — ensure single column on tablet portrait */
  .calc-grid { grid-template-columns: 1fr !important; }

  /* Tables in workbooks — horizontal scroll */
  .wb-section { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Phone-specific */
@media (max-width: 480px) {
  .topbar { padding: 0 12px; height: 50px; }
  .topbar-breadcrumb { font-size: 13px; }
  .topbar-breadcrumb-current { max-width: 40vw; }
  .phase-header { padding: 0 16px 16px; min-height: 190px; }
  .phase-header h1 { font-size: 22px; line-height: 1.15; }
  /* Show back-to-top on mobile only */
  .back-to-top-btn { display: block; }
  .phase-header-phase-num { font-size: 10px; letter-spacing: 0.3em; margin-bottom: 8px; }
  .phase-body { padding: 16px; padding-bottom: 48px; }
  .overview-card { padding: 20px; }
  .task-list { grid-template-columns: 1fr; }
  .pathway-selector { grid-template-columns: repeat(2, 1fr); }
  .insight-box { margin-left: -20px; margin-right: -20px; padding: 18px 20px; }
  .warning-box { margin-left: -20px; margin-right: -20px; padding: 18px 20px; }
  .wb-two-col-row { grid-template-columns: 1fr; }
  .wb-two-col-label { border-right: none; border-bottom: 1px solid var(--rule); }

  /* Onboarding steps preview — allow wrapping */
  .ob-steps-preview { flex-wrap: wrap; }
  .ob-step-prev { flex: 1 1 45%; min-width: 120px; }
  .ob-step-prev-n { font-size: 26px; min-height: 32px; }
  .ob-step-prev-label { font-size: 11px; }

  /* Workbook rating rows — stack vertically */
  .wb-rating-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 8px 12px;
  }
  .wb-rating-row > div:first-child { grid-column: 1 / -1; }
  .wb-rating-pips { gap: 6px; }
  .wb-pip { width: 34px; height: 34px; font-size: 12px; }
  .wb-rating-score { text-align: left; }

  /* Workbook topbar — tighter */
  .wb-topbar { padding: 0 14px; height: 50px; gap: 10px; }
  .wb-topbar-title { font-size: 14px; }
  .wb-topbar-title span { font-size: 9px; letter-spacing: 0.1em; }
  .wb-close-btn { padding: 6px 10px; font-size: 9px; letter-spacing: 0.08em; white-space: nowrap; }
  .wb-save-status { font-size: 10px; }

  /* Workbook tabs — tighter padding */
  .wb-tabs { padding: 0 12px; }
  .wb-tab { padding: 10px 12px; font-size: 10px; }

  /* Workbook scroll content */
  .wb-scroll { padding: 16px !important; }
  #workbookOverlay .wb-scroll { padding: 0 !important; }

  /* Workbook nav bar — compact */
  .wb-nav-bar { padding: 14px 12px; gap: 6px; flex-wrap: wrap; justify-content: center; }
  .wb-nav-prev, .wb-nav-next { padding: 10px 16px; font-size: 10px; letter-spacing: 0.1em; }
  .wb-progress-label { width: 100%; text-align: center; order: -1; margin-bottom: 6px; }
  .wb-blocked-msg { margin: 0 12px; font-size: 10px; }

  /* Workbook nav buttons */
  .wb-nav-btn { padding: 10px 14px; font-size: 10px; }

  /* Timeline builder — stack date/type, show label full width */
  .tl-row { grid-template-columns: 1fr; gap: 0; }
  .tl-row.tl-header { grid-template-columns: 1fr; }
  .tl-row.tl-header .tl-cell:nth-child(2),
  .tl-row.tl-header .tl-cell:nth-child(3) { display: none; }
  .tl-row:not(.tl-header) { padding: 10px 12px; display: block; }
  .tl-row:not(.tl-header) .tl-cell {
    display: inline; padding: 0; border-right: none; font-size: 12px;
  }
  .tl-row:not(.tl-header) .tl-cell:nth-child(2) {
    font-size: 9px; margin-left: 8px;
  }
  .tl-row:not(.tl-header) .tl-cell:nth-child(3) {
    display: block; margin-top: 4px;
  }
  .tl-cell { border-right: none; }

  /* Calculator — single column */
  .calc-grid { grid-template-columns: 1fr !important; }

  /* Phase meta handled by mobile detail card */

  /* Toolkit viewer content */
  #tk-glossary .wb-scroll,
  #tk-visa .wb-scroll,
  #tk-consulate .wb-scroll,
  #tk-tracker .wb-scroll,
  #tk-resources .wb-scroll { padding: 16px !important; }

  /* Document Tracker — reduce min-width and hide Notes column on phone */
  .tk-trk-table { min-width: 560px; }
  .tk-trk-table.tk-trk-6col thead th:nth-child(1) { width: 26%; }
  .tk-trk-table.tk-trk-6col thead th:nth-child(6) { width: 30%; }
  .tk-trk-table td { font-size: 11px; padding: 6px 8px; }
  .tk-trk-table thead th { font-size: 10px; padding: 7px 8px; }
  .tk-trk-status select { font-size: 10px; padding: 3px 4px; }
  .tk-trk-date input[type="date"] { font-size: 10px; padding: 3px 4px; }
}
