/* mobile.css — ClinicianCompliance responsive UI (phones & small tablets only)
   Loaded after main.css. Desktop layout (769px+) is unchanged. */

/* ── Overflow guard ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
    max-width: 100%;
  }

  html.nav-menu-open,
  body.nav-menu-open {
    overflow: hidden;
  }

  .container,
  .container-sm {
    padding-left: 20px;
    padding-right: 20px;
    max-width: 100%;
  }

  img,
  video,
  canvas,
  iframe,
  object {
    max-width: 100%;
  }

  pre,
  code {
    max-width: 100%;
    overflow-x: auto;
    word-break: break-word;
    white-space: pre-wrap;
  }

  table {
    max-width: 100%;
  }
}

/* ── Mobile navigation ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
  }

  .nav-container {
    flex-wrap: wrap;
    height: auto;
    min-height: 64px;
    padding: 8px 0;
    gap: 0;
    align-items: center;
    position: relative;
  }

  .logo {
    flex: 1;
    min-width: 0;
    font-size: 0.98rem;
    gap: 8px;
    order: 1;
  }

  .logo span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    margin-left: auto;
    order: 2;
    z-index: 1002;
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .nav-toggle span {
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  /* Panel wraps nav links + action buttons */
  .nav-menu-panel {
    display: none;
    width: 100%;
    flex-basis: 100%;
    order: 3;
    flex-direction: column;
    gap: 0;
    padding: 8px 0 12px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
    background: #fff;
    position: relative;
    z-index: 1001;
  }

  .site-header.nav-open .nav-menu-panel {
    display: flex;
    animation: mobileNavSlide 0.22s ease;
  }

  @keyframes mobileNavSlide {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .nav-menu-panel .main-nav {
    display: flex;
    flex: none;
    flex-direction: column;
    width: 100%;
    padding-left: 0;
    gap: 0;
    position: static;
    box-shadow: none;
    background: transparent;
  }

  .nav-menu-panel .main-nav a {
    width: 100%;
    padding: 14px 4px;
    min-height: 48px;
    display: flex;
    align-items: center;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--navy);
  }

  .nav-menu-panel .nav-actions {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-left: 0;
    padding: 12px 0 0;
    gap: 10px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
  }

  .nav-menu-panel .nav-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    white-space: normal;
    text-align: center;
  }

  .nav-menu-panel .nav-actions .btn-ghost {
    display: inline-flex;
  }

  /* Full-screen tap target behind menu */
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  .nav-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (min-width: 769px) {
  .nav-menu-panel {
    display: contents !important;
  }

  .site-header.nav-open .nav-menu-panel {
    display: contents !important;
  }

  .nav-backdrop {
    display: none !important;
    pointer-events: none !important;
  }
}

/* ── Buttons & touch targets ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .btn {
    min-height: 48px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .btn-lg {
    min-height: 48px;
    padding: 14px 20px;
    font-size: 0.95rem;
  }

  .btn-sm {
    min-height: 44px;
    padding: 10px 14px;
  }

  .faq-q {
    min-height: 48px;
    padding: 16px 0;
  }

  .cookie-actions {
    width: 100%;
    flex-direction: column;
  }

  .cookie-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero {
    padding: 16px 0 28px;
    overflow: hidden;
  }

  .hero--landing {
    padding: 6px 0 14px;
  }

  .site-header:has(+ .hero--landing) .nav-container {
    height: 48px;
    min-height: 48px;
    padding: 4px 0;
  }

  .hero--landing .hero-badge {
    margin-bottom: 4px;
    padding: 3px 10px;
    font-size: 0.6rem;
  }

  .hero--landing h1 {
    margin-bottom: 4px;
    font-size: clamp(1.42rem, 6.8vw, 1.95rem);
    line-height: 1.12;
  }

  .hero--landing .hero-grid > div > p.hero-lede {
    font-size: 0.84rem;
    line-height: 1.38;
    margin-bottom: 2px;
  }

  .hero--landing .hero-sub-note {
    font-size: 0.74rem;
    margin-bottom: 8px;
    line-height: 1.35;
  }

  .hero--landing .hero-actions {
    gap: 6px;
    margin-bottom: 0;
  }

  .hero--landing .hero-actions .btn {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .hero--landing .hero-trial-note {
    margin-top: 2px;
    font-size: 0.72rem;
  }

  .hero--landing .hero-launch-offer {
    margin-top: 8px;
    padding: 10px 12px;
  }

  .hero--landing .hero-launch-offer .launch-offer-title {
    margin-bottom: 6px;
    font-size: 0.86rem;
  }

  .hero--landing .launch-offer-body {
    gap: 8px;
  }

  .hero--landing .hero-launch-offer .launch-offer-text {
    font-size: 0.78rem;
    margin-bottom: 4px;
    line-height: 1.35;
  }

  .hero--landing .hero-launch-offer .launch-offer-sub {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .hero--landing .launch-offer-countdown {
    padding: 8px 10px;
  }

  .hero--landing .launch-countdown-value {
    min-height: 32px;
    font-size: 0.88rem;
    padding: 4px 2px;
  }

  .hero--landing .launch-countdown-name {
    margin-top: 2px;
    font-size: 0.44rem;
  }

  .hero--landing .hero-visual {
    display: none;
  }

  .hero--landing .hero-grid {
    gap: 0;
  }

  .hero--page {
    padding: 48px 0 56px;
  }

  .hero-content {
    max-width: none;
  }

  .hero h1 {
    font-size: clamp(1.75rem, 8vw, 2.25rem);
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  .hero-grid > div > p.hero-lede,
  .hero-grid > div > p:not([class]) {
    font-size: 1rem;
    line-height: 1.65;
  }

  .hero-sub-note {
    font-size: 0.82rem;
    margin-bottom: 16px;
  }

  .hero-actions {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px;
    margin-bottom: 0;
  }

  .hero-actions .mobile-hide {
    display: none !important;
  }

  .hero-actions .btn,
  .hero-cta-trial {
    flex: none !important;
    width: 100% !important;
    max-width: 100%;
  }

  .hero-cta-trial {
    align-items: center;
  }

  .hero-cta-trial .btn {
    width: 100%;
    justify-content: center;
  }

  /* Launch offer — stacked layout + aligned countdown */
  .hero-launch-offer {
    max-width: 100%;
    overflow: hidden;
  }

  .launch-offer-body {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .launch-offer-countdown {
    width: 100%;
    max-width: 100%;
    align-self: stretch;
    padding: 10px 12px;
    box-sizing: border-box;
    overflow: hidden;
  }

  .launch-countdown-digits {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .launch-countdown-unit {
    flex: none;
    width: auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
  }

  .launch-countdown-value {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    padding: 6px 2px;
    box-sizing: border-box;
    line-height: 1;
  }

  .launch-countdown-name {
    width: 100%;
    text-align: center;
    margin-top: 4px;
    line-height: 1.2;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 16px;
    margin-top: 32px;
    padding-top: 24px;
  }

  .hero-stats .stat-item:last-child {
    grid-column: 1 / -1;
  }

  .hero-stats .stat-item .stat-num {
    font-size: 1.5rem;
    word-break: break-word;
  }

  .hero-stats .stat-item .stat-label {
    font-size: 0.78rem;
    line-height: 1.4;
  }

  .hero-visual {
    min-height: 260px;
    max-width: 100%;
    overflow: hidden;
  }

  .mock-stack {
    max-width: 100%;
  }

  .mock-panel-1,
  .mock-panel-2,
  .mock-panel-3 {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    margin-bottom: 12px;
  }

  .mock-panel-2,
  .mock-panel-3 {
    margin-left: 0;
  }
}

@media (min-width: 375px) and (max-width: 768px) {
  .hero-actions {
    flex-direction: column !important;
  }

  .hero-actions .btn {
    flex: none !important;
    width: 100% !important;
    min-width: 0;
  }
}

@media (max-width: 374px) {
  .hero-actions {
    flex-direction: column !important;
  }

  .hero-actions .btn {
    width: 100%;
  }
}

/* ── Sections, cards, grids ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .section {
    padding: 56px 0;
  }

  .section-sm {
    padding: 48px 0;
  }

  .section-title {
    font-size: clamp(1.35rem, 5.5vw, 1.75rem);
    padding: 0 4px;
  }

  .section-sub {
    font-size: 0.95rem;
    margin-bottom: 40px;
    padding: 0 4px;
  }

  .section-eyebrow {
    font-size: 0.68rem;
  }

  .card,
  .form-card,
  .pricing-card {
    padding: 22px 18px;
  }

  .card-sm {
    padding: 16px;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .pricing-grid,
  .form-grid-2,
  .steps-grid,
  .callout-grid,
  .feature-row,
  .footer-grid {
    grid-template-columns: 1fr !important;
  }

  .pricing-grid[style] {
    grid-template-columns: 1fr !important;
  }

  .feature-row {
    gap: 32px;
  }

  .feature-row-visual {
    padding: 20px 16px;
    max-width: 100%;
    overflow: hidden;
  }

  .feature-row-list li {
    font-size: 0.88rem;
  }

  .callout-band {
    padding: 48px 0;
  }

  .callout-item h3 {
    font-size: 1rem;
  }

  .trust-items,
  .usecase-items,
  .regulator-inner {
    gap: 10px;
    justify-content: flex-start;
  }

  .trust-item {
    font-size: 0.78rem;
    flex: 1 1 100%;
    justify-content: center;
  }

  .usecase-pill,
  .regulator-tag,
  .category-pill {
    font-size: 0.72rem;
    max-width: 100%;
  }

  .regulator-label,
  .usecase-label {
    flex: 0 0 100%;
    text-align: center;
    margin-right: 0;
    margin-bottom: 4px;
  }
}

/* ── CTA button rows (landing pages) ─────────────────────────────────────── */
@media (max-width: 768px) {
  .mobile-cta-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .mobile-cta-row .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (min-width: 375px) and (max-width: 768px) {
  .mobile-cta-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .mobile-cta-row .btn {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }
}

/* ── Forms & auth ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .form-control,
  select.form-control,
  textarea.form-control {
    width: 100%;
    max-width: 100%;
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  .form-label {
    font-size: 0.875rem;
  }

  .auth-page {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 16px 16px 32px;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .auth-back {
    width: 100%;
    max-width: 440px;
    text-align: left;
    margin: 0 0 12px;
    flex: 0 0 auto;
    order: -1;
  }

  .auth-card {
    padding: 28px 20px;
    width: calc(100% - 0px);
    max-width: 440px;
    box-sizing: border-box;
    flex: 0 0 auto;
  }

  .auth-title {
    font-size: 1.35rem;
  }
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .site-footer {
    padding-top: 48px;
  }

  .footer-grid {
    gap: 28px;
    padding-bottom: 36px;
  }

  .footer-brand p {
    max-width: 100%;
  }

  .footer-bottom {
    padding: 20px 0;
    text-align: center;
  }

  .footer-bottom p {
    font-size: 0.75rem;
    line-height: 1.65;
    word-break: break-word;
  }
}

/* ── Dashboard (shared dashboard.css supplement) ─────────────────────────── */
@media (max-width: 768px) {
  .dash-content {
    padding: 14px 16px;
  }

  .dash-topbar {
    padding: 0 16px;
    height: 56px;
  }

  .topbar-title,
  .db-topbar-title {
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-toggle {
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .dash-stats {
    grid-template-columns: 1fr 1fr;
  }

  .stat-card-value {
    font-size: 1.5rem;
  }

  .doc-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .search-input {
    width: 100%;
    max-width: 100%;
  }

  .limit-bar {
    flex-wrap: wrap;
    font-size: 0.82rem;
  }

  .upload-zone {
    padding: 28px 16px;
  }
}

@media (max-width: 480px) {
  .dash-stats {
    grid-template-columns: 1fr;
  }

  .stat-card-compliance {
    grid-column: auto;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .dash-score-hero { grid-template-columns: minmax(200px, 240px) 1fr; }
  .cd-summary { grid-template-columns: repeat(2, 1fr); }
  .cd-quick { grid-template-columns: repeat(2, 1fr); }
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid[style] { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (min-width: 901px) {
  .dash-sidebar-backdrop { display: none !important; pointer-events: none !important; }
}

/* ── Dashboard pages: overflow + touch targets ───────────────────────────── */
@media (max-width: 900px) {
  html,
  body,
  .dash-body,
  .db-page {
    overflow-x: hidden;
    max-width: 100vw;
  }
  .form-card { max-width: 100%; overflow: hidden; }
  .card { max-width: 100%; }
}

/* ── Clinician dashboard supplement ───────────────────────────────────────── */
@media (max-width: 768px) {
  .cd-page {
    padding: 16px;
  }

  .cd-welcome h2 {
    font-size: 1.3rem;
  }

  .cd-summary {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .cd-quick {
    grid-template-columns: 1fr 1fr;
  }

  .cd-action-btns .btn {
    min-height: 48px;
  }
}

@media (max-width: 374px) {
  .cd-summary,
  .cd-quick {
    grid-template-columns: 1fr;
  }
}

/* ── Smart upload / review cards ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .review-card__fields {
    grid-template-columns: 1fr;
  }

  .module-list {
    columns: 1;
  }

  .review-card__pdf-frame {
    height: min(420px, 55vh);
  }

  .review-card__actions .btn,
  .review-card__preview-actions .btn {
    min-height: 48px;
    flex: 1 1 auto;
  }
}

/* ── Vault / legacy db layout ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .db-page {
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
  }

  .db-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  .db-page:has(.db-sidebar.open)::before {
    opacity: 1;
    pointer-events: auto;
  }

  .db-page:has(.db-sidebar.open) {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
  }

  .db-sidebar {
    width: min(320px, 85vw) !important;
    max-width: 320px !important;
    transform: translateX(-100%);
  }

  .db-sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.25);
  }

  .db-sidebar-logo {
    padding: 14px 12px 12px;
  }

  .db-sidebar-logo .logo {
    font-size: 0.78rem;
    gap: 7px;
    min-width: 0;
    line-height: 1.25;
    align-items: center;
  }

  .db-sidebar-logo .logo span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  .db-main,
  .vt-main {
    margin-left: 0 !important;
    max-width: 100%;
    overflow-x: hidden;
  }

  .vt-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .db-menu-btn {
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .db-topbar,
  .vt-toolbar {
    min-width: 0;
  }

  .db-content {
    padding: 14px;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .vt-wrap,
  .vt-cards {
    max-width: 100%;
    overflow-x: hidden;
  }
}

@media (max-width: 768px) {
  .db-nav {
    transform: none !important;
  }
}

/* ── Smart Upload review cards ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  #bulk-form .card > div {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
  }

  #bulk-form .card > div > div:last-child {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    gap: 8px !important;
  }

  #bulk-form .card > div > div:last-child .btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    justify-content: center;
  }

  #bulk-form > div[style*="flex-wrap"] {
    gap: 10px !important;
  }

  #bulk-form > div[style*="flex-wrap"] .btn {
    flex: 1 1 auto;
  }

  #bulk-form > div[style*="flex-wrap"] a.btn {
    margin-left: 0 !important;
    width: 100%;
    justify-content: center;
  }
}

/* ── Pricing cards on small screens ───────────────────────────────────────── */
@media (max-width: 768px) {
  .price-amount {
    font-size: 2.2rem;
  }

  .pricing-card {
    transform: none !important;
  }

  .pricing-card:hover {
    transform: none !important;
  }
}

/* ── Utility: stack any 2-column inline grid on marketing pages ───────────── */
@media (max-width: 768px) {
  .mobile-stack-2 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
}
