/* ============================================================================================
   AWWA online program - responsive layer (WSI26 review, 2026-10-15).
   Loaded AFTER style.css. Desktop keeps the page as it was (sidebar + sessions); below 768px
   the sidebar filters move into a drawer behind a floating "Filters" button, the day chips
   scroll sideways, the session blocks stack, speaker photos shrink and the modal fills the
   screen. Nothing here applies to print (print.css is untouched; the drawer is hidden there).
   ============================================================================================ */

/* ───────── layout (all sizes) ───────── */
.tpni-shell { width: 100%; max-width: 1170px; padding-left: 15px; padding-right: 15px; }
.tpni-page { width: 100%; }
.tpni-layout { display: flex; align-items: flex-start; gap: 24px; width: 100%; }
.tpni-sidebar { flex: 0 0 30%; max-width: 30%; padding: 30px; box-sizing: border-box; }
.tpni-content { flex: 1 1 auto; min-width: 0; padding-top: 30px; }
.tpni-logo { display: block; max-width: 100%; height: auto; }
#leftnav table { width: 100%; }
#sessions table { max-width: 100%; }
#sessions img, #speakerdetails img, #modal-body img { max-width: 100%; height: auto; }

/* Day chips: an active state (the page never showed which day was on). */
.dayFilter { cursor: pointer; }
.dayFilter.active { font-weight: 700; text-decoration: underline; }
.tpni-day-all { white-space: nowrap; }

/* The floating button and the drawer exist only on phones. */
.tpni-fab, .tpni-backdrop, .tpni-drawer { display: none; }

/* ───────── tablet: narrower sidebar ───────── */
@media (max-width: 991px) and (min-width: 768px) {
  .tpni-sidebar { flex-basis: 240px; max-width: 240px; padding: 20px 16px; }
  .tpni-layout { gap: 16px; }
}

/* ───────── phone ───────── */
@media (max-width: 767px) {
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }
  .tpni-shell { padding-left: 12px; padding-right: 12px; }
  .tpni-layout { display: flex; flex-direction: column; gap: 0; }
  /* The filter panel is in the drawer on phones (script.js moves it); the sidebar keeps only
     the statement, and goes under the sessions. */
  .tpni-sidebar { order: 2; flex: none; max-width: none; padding: 0; }
  .tpni-content { order: 1; width: 100%; padding-top: 12px; }
  #printer { display: none; }
  .statement { font-size: 12px; margin: 16px 0 72px; }
  .backtoprogram { font-size: 12px; }
  #backtoprogram .text { display: inline; }

  /* Day chips: one scrolling row of pills. */
  .filters table, .filters tbody { display: block; width: 100%; }
  .filters tr { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 4px 0 10px; }
  .filters tr::-webkit-scrollbar { display: none; }
  .filters td.dayFilter {
    display: inline-block; flex: 0 0 auto; white-space: nowrap;
    padding: 8px 14px; border-radius: 999px; border: 1px solid #093553; color: #093553;
    background: #fff; font-size: 13px; line-height: 1.2; width: auto;
  }
  .filters td.dayFilter.active { background: #093553; color: #fff; text-decoration: none; font-weight: 600; }
  .filters td.dayFilter .arrow-right { display: none; }

  /* Search row and the Show-all button: full width, stacked. */
  .searchFields .row, .searchFields .col, .searchFields .col-sm-10, .searchFields .col-sm-4,
  .show-all-details .col-sm-4, .downloadall .col-sm-4 { width: 100%; margin: 0; padding: 0; }
  .searchFields #Searchfield { margin-bottom: 8px; font-size: 16px; }   /* 16px: no zoom on focus in iOS */
  .searchFields .btn-search, #show-all-details { width: 100%; }

  /* Session blocks: the colour tab stays, the content wraps. */
  #sessions > table, #sessions .session-data-table { width: 100% !important; table-layout: auto; }
  #sessions .session-tab { width: 8px; min-width: 8px; }
  #sessions .session-data, #sessions .session-title { word-break: break-word; }
  #sessions .session-date-header { display: block; margin: 8px 0; font-size: 18px; }
  .btn-sessionoverview { display: inline-block; margin-top: 6px; }
  .tpni-atc-btn { margin-top: 6px; }

  /* Speaker profiles (a 4-column table of photos + text) stack one under the other. */
  .speakerImageFilter, .speakerImageFilter tbody, .speakerImageFilter tr, .speakerImageFilter td { display: block; width: 100% !important; text-align: left !important; }
  .speakerImageFilter td { padding: 4px 0; }
  .speakerImageFilter img { width: 110px !important; height: auto; padding: 0 0 6px 0 !important; }
  #speakerdetails table, #speakerdetails tbody, #speakerdetails tr, #speakerdetails td { display: block; width: 100% !important; }
  #speakerdetails img { width: 140px !important; height: auto; }

  /* Session detail modal: fills the screen. */
  #myModal .modal-content { width: 100% !important; max-width: 100%; margin: 0; min-height: 100vh; padding: 16px 14px 32px; box-sizing: border-box; border-radius: 0; }
  #myModal .close { position: fixed; top: 8px; right: 14px; font-size: 34px; z-index: 2; }

  /* ── Floating "Filters" button ── */
  .tpni-fab {
    display: inline-flex; align-items: center; gap: 8px;
    position: fixed; right: 16px; bottom: 18px; z-index: 1040;
    padding: 12px 18px; border: 0; border-radius: 999px;
    background: #093553; color: #fff; font-size: 15px; font-weight: 600; line-height: 1;
    box-shadow: 0 6px 18px rgba(9, 53, 83, 0.35); cursor: pointer;
    font-family: inherit;
  }
  .tpni-fab:active { transform: scale(0.98); }
  .tpni-speaker-open .tpni-fab { display: none; }
  .tpni-fab .glyphicon { top: 0; font-size: 14px; }
  .tpni-fab-count {
    display: inline-block; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    background: #FFC000; color: #093553; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
  }

  /* ── Drawer ── */
  .tpni-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 1050; }
  .tpni-drawer {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1060;
    max-height: 86vh; display: flex; flex-direction: column;
    background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
    transform: translateY(105%); transition: transform 0.25s ease-out;
  }
  .tpni-drawer-open .tpni-backdrop { display: block; }
  .tpni-drawer-open .tpni-drawer { display: flex; transform: translateY(0); }
  .tpni-drawer-open { overflow: hidden; }
  .tpni-drawer-head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-bottom: 1px solid #e5e7eb; font-size: 17px;
  }
  .tpni-drawer-head strong { flex: 1; }
  .tpni-drawer-clear { border: 0; background: none; color: #093553; font-size: 14px; text-decoration: underline; padding: 4px 6px; font-family: inherit; }
  .tpni-drawer-close { border: 0; background: none; font-size: 30px; line-height: 1; color: #555; padding: 0 4px; }
  .tpni-drawer-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px 8px; }
  .tpni-drawer-body #leftnav table { width: 100%; }
  .tpni-drawer-body #leftnav p { margin: 0; }
  .tpni-drawer-body #leftnav p.tpni-spacer { display: none; }
  .tpni-drawer-body #leftnav b { display: block; margin: 14px 0 8px; font-size: 15px; }
  .tpni-drawer-body #leftnav .categoryFilter td { padding: 6px 4px; font-size: 15px; }
  .tpni-drawer-body #leftnav .categoryFilter td:last-child { padding: 10px 8px; }   /* the tap target is the text cell */
  .tpni-drawer-body #leftnav .box-size { width: 18px; height: 18px; }
  .tpni-drawer-body #leftnav select { font-size: 16px; }
  .tpni-drawer-body #leftnav #btn-clearsearch { display: none; }   /* the drawer has its own Clear all */
  .tpni-drawer-foot { padding: 10px 16px 14px; border-top: 1px solid #e5e7eb; }
  .tpni-drawer-done { background: #093553; color: #fff; border: 0; border-radius: 10px; padding: 12px; font-size: 16px; font-weight: 600; }
  .tpni-drawer-done:hover, .tpni-drawer-done:focus { background: #0c4a75; color: #fff; }
}

@media print {
  .tpni-fab, .tpni-backdrop, .tpni-drawer { display: none !important; }
}
