/* Tee Time Social v170.5
   Mobile-only corrections for original /admin:
   - compact drawer header
   - left-aligned page title
   - touch-scrollable booking diary
*/

/* Keep all earlier v170 mobile rules. */
/* Tee Time Social v170.2 - isolated mobile navigation for the live original /admin */

.admin-live-mobile-toggle,
.admin-live-mobile-shade,
.admin-live-mobile-close {
  display: none;
}

@media (max-width: 1024px) {
  html:has(.dashboard-shell),
  body:has(.dashboard-shell) {
    overflow-x: hidden !important;
  }

  /* Remove the desktop/tablet sidebar from document flow. This fixes the large blank area. */
  .dashboard-shell,
  .dashboard-shell.app-layout {
    display: block !important;
    grid-template-columns: none !important;
    min-height: 100vh !important;
  }

  .dashboard-shell .sidebar,
  .dashboard-shell .app-sidebar,
  .dashboard-shell aside.sidebar {
    display: flex !important;
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    z-index: 2147483001 !important;
    width: min(320px, 88vw) !important;
    max-width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    margin: 0 !important;
    padding: max(22px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom)) !important;
    overflow-y: auto !important;
    border: 0 !important;
    background: #073b32 !important;
    color: #fef9ec !important;
    transform: translate3d(-105%, 0, 0) !important;
    transition: transform .24s ease !important;
    box-shadow: 18px 0 50px rgba(7, 59, 50, .24) !important;
  }

  .dashboard-shell .sidebar.admin-live-open,
  .dashboard-shell .app-sidebar.admin-live-open {
    transform: translate3d(0, 0, 0) !important;
  }

  .dashboard-shell .sidebar-nav,
  .dashboard-shell .app-nav {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .dashboard-shell .sidebar-nav button,
  .dashboard-shell .app-nav button {
    display: block !important;
    width: 100% !important;
    min-height: 48px !important;
    padding: 0 16px !important;
    text-align: left !important;
    color: #fef9ec !important;
  }

  .dashboard-shell .sidebar-footer,
  .dashboard-shell .app-sidebar-footer {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    margin-top: auto !important;
  }

  .dashboard-shell .dashboard-main,
  .dashboard-shell .app-main {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: calc(76px + env(safe-area-inset-top)) 16px 36px !important;
  }

  .dashboard-shell .app-content {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .admin-live-mobile-toggle {
    display: flex !important;
    position: fixed !important;
    top: max(14px, env(safe-area-inset-top)) !important;
    right: max(14px, env(safe-area-inset-right)) !important;
    z-index: 2147483003 !important;
    width: 50px !important;
    height: 50px !important;
    align-items: center !important;
    justify-content: center !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #ef4c52 !important;
    color: #fff !important;
    box-shadow: 0 10px 28px rgba(7, 59, 50, .24) !important;
    cursor: pointer !important;
  }

  .admin-live-mobile-toggle span,
  .admin-live-mobile-toggle::before,
  .admin-live-mobile-toggle::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
  }

  .admin-live-mobile-toggle::before { transform: translateY(-7px); }
  .admin-live-mobile-toggle::after { transform: translateY(7px); }

  .admin-live-mobile-shade {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483000 !important;
    background: rgba(0, 35, 30, .58) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity .22s ease, visibility .22s ease !important;
  }

  .admin-live-mobile-shade.admin-live-open {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  .admin-live-mobile-close {
    display: flex !important;
    position: absolute !important;
    top: max(10px, env(safe-area-inset-top)) !important;
    right: 10px !important;
    z-index: 2 !important;
    width: 44px !important;
    height: 44px !important;
    align-items: center !important;
    justify-content: center !important;
    border: 0 !important;
    background: transparent !important;
    color: #fff !important;
    font: 400 36px/1 Arial, sans-serif !important;
    cursor: pointer !important;
  }

  body.admin-live-menu-open {
    overflow: hidden !important;
    touch-action: none !important;
  }
}

@media (min-width: 1025px) {
  .admin-live-mobile-toggle,
  .admin-live-mobile-shade,
  .admin-live-mobile-close {
    display: none !important;
  }
}

/* v170.3: force the existing live admin navigation into a vertical mobile list. */
@media (max-width: 1024px) {
  .dashboard-shell .sidebar nav,
  .dashboard-shell .app-sidebar nav,
  .dashboard-shell .sidebar .sidebar-nav,
  .dashboard-shell .app-sidebar .app-nav {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: none !important;
    gap: 8px !important;
    margin: 72px 0 20px !important;
    padding: 0 !important;
  }

  .dashboard-shell .sidebar nav > *,
  .dashboard-shell .app-sidebar nav > *,
  .dashboard-shell .sidebar .sidebar-nav > *,
  .dashboard-shell .app-sidebar .app-nav > * {
    display: flex !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 50px !important;
    box-sizing: border-box !important;
    align-items: center !important;
    justify-content: flex-start !important;
    margin: 0 !important;
    padding: 12px 18px !important;
    text-align: left !important;
    white-space: normal !important;
  }

  .dashboard-shell .sidebar nav > *.active,
  .dashboard-shell .app-sidebar nav > *.active,
  .dashboard-shell .sidebar .sidebar-nav > *.active,
  .dashboard-shell .app-sidebar .app-nav > *.active {
    border-radius: 999px !important;
  }
}

/* v170.4: compact mobile drawer and left-align admin page titles. */
@media (max-width: 1024px) {
  /* The desktop logo was still reserving a large block above the links. */
  .dashboard-shell .sidebar .side-logo,
  .dashboard-shell .app-sidebar .side-logo,
  .dashboard-shell .sidebar > img,
  .dashboard-shell .app-sidebar > img {
    display: none !important;
  }

  .dashboard-shell .sidebar,
  .dashboard-shell .app-sidebar,
  .dashboard-shell aside.sidebar {
    justify-content: flex-start !important;
    padding-top: max(12px, env(safe-area-inset-top)) !important;
  }

  .dashboard-shell .sidebar nav,
  .dashboard-shell .app-sidebar nav,
  .dashboard-shell .sidebar .sidebar-nav,
  .dashboard-shell .app-sidebar .app-nav,
  .dashboard-shell .sidebar .side-nav,
  .dashboard-shell .app-sidebar .side-nav {
    margin: 52px 0 10px !important;
    gap: 4px !important;
  }

  .dashboard-shell .sidebar nav > *,
  .dashboard-shell .app-sidebar nav > *,
  .dashboard-shell .sidebar .sidebar-nav > *,
  .dashboard-shell .app-sidebar .app-nav > *,
  .dashboard-shell .sidebar .side-nav > *,
  .dashboard-shell .app-sidebar .side-nav > * {
    min-height: 44px !important;
    padding: 9px 18px !important;
  }

  .dashboard-shell .sidebar-footer,
  .dashboard-shell .app-sidebar-footer {
    margin-top: auto !important;
    padding-top: 10px !important;
  }

  /* Match the left-aligned Home/Good Morning treatment on every admin page. */
  .dashboard-shell .section-header,
  .dashboard-shell .page-header,
  .dashboard-shell .admin-header,
  .dashboard-shell .dashboard-page-header,
  .dashboard-shell .tts-crm-title {
    justify-content: flex-start !important;
    align-items: flex-start !important;
    text-align: left !important;
    width: 100% !important;
  }

  .dashboard-shell .section-header > *,
  .dashboard-shell .page-header > *,
  .dashboard-shell .admin-header > *,
  .dashboard-shell .dashboard-page-header > *,
  .dashboard-shell .tts-crm-title > * {
    margin-left: 0 !important;
    margin-right: auto !important;
    text-align: left !important;
  }

  .dashboard-shell .section-header h1,
  .dashboard-shell .page-header h1,
  .dashboard-shell .admin-header h1,
  .dashboard-shell .dashboard-page-header h1,
  .dashboard-shell .tts-crm-title h1,
  .dashboard-shell .section-header .eyebrow,
  .dashboard-shell .page-header .eyebrow,
  .dashboard-shell .admin-header .eyebrow,
  .dashboard-shell .dashboard-page-header .eyebrow,
  .dashboard-shell .tts-crm-title .eyebrow {
    text-align: left !important;
  }
}

@media (max-width: 1024px) {
  /* The real live logo uses app-logo/admin-brand, so remove it from the drawer. */
  .dashboard-shell .sidebar .app-logo,
  .dashboard-shell .app-sidebar .app-logo,
  .dashboard-shell .sidebar .admin-brand,
  .dashboard-shell .app-sidebar .admin-brand,
  .dashboard-shell .sidebar > a.brand,
  .dashboard-shell .app-sidebar > a.brand {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  /* Start navigation immediately below the close button. */
  .dashboard-shell .sidebar nav,
  .dashboard-shell .app-sidebar nav,
  .dashboard-shell .sidebar .sidebar-nav,
  .dashboard-shell .app-sidebar .app-nav {
    margin-top: 48px !important;
    margin-bottom: 8px !important;
  }

  /* The actual title wrapper is dashboard-header app-page-header. */
  .dashboard-shell .dashboard-header.app-page-header,
  .dashboard-shell header.dashboard-header,
  .dashboard-shell header.app-page-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    text-align: left !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-right: 72px !important;
    box-sizing: border-box !important;
  }

  .dashboard-shell .dashboard-header.app-page-header > div,
  .dashboard-shell header.dashboard-header > div,
  .dashboard-shell header.app-page-header > div {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    text-align: left !important;
  }

  .dashboard-shell .dashboard-header.app-page-header h1,
  .dashboard-shell .dashboard-header.app-page-header .eyebrow,
  .dashboard-shell header.dashboard-header h1,
  .dashboard-shell header.dashboard-header .eyebrow,
  .dashboard-shell header.app-page-header h1,
  .dashboard-shell header.app-page-header .eyebrow {
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-align: left !important;
  }

  /* Allow the full diary to be moved horizontally with a finger. */
  .dashboard-shell .premium-calendar-panel {
    overflow: visible !important;
    min-width: 0 !important;
  }

  .dashboard-shell .timeline-calendar,
  .dashboard-shell .timeline-calendar.half-hour-calendar,
  .dashboard-shell .half-hour-calendar {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: scroll !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-x: contain !important;
    touch-action: pan-x pan-y !important;
    scrollbar-width: auto !important;
  }

  .dashboard-shell .half-hour-calendar .timeline-header,
  .dashboard-shell .half-hour-calendar .timeline-row {
    width: 1180px !important;
    min-width: 1180px !important;
    grid-template-columns: 112px 1068px !important;
  }

  .dashboard-shell .half-hour-calendar .time-header,
  .dashboard-shell .half-hour-calendar .timeline-track,
  .dashboard-shell .half-hour-calendar button {
    touch-action: pan-x pan-y !important;
  }

  .dashboard-shell .timeline-calendar::-webkit-scrollbar {
    height: 8px !important;
  }

  .dashboard-shell .timeline-calendar::-webkit-scrollbar-thumb {
    background: rgba(7, 59, 50, .35) !important;
    border-radius: 999px !important;
  }
}
