/*
 * responsive-standard.css
 * Shared lightweight responsive helpers used across portal pages.
 * Complements design-system.css without redefining components.
 */

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

img,
video {
  height: auto;
}

canvas,
svg {
  display: block;
}

.app-shell,
.main,
.page-body,
.dashboard-shell,
.glass-card,
.card-body,
.table-wrap,
.table-responsive,
.modal-content,
.modal-dialog,
.container,
.container-fluid,
.row,
[class*="col-"] {
  min-width: 0;
}

.stack-mobile > *,
.mobile-stack > * {
  min-width: 0;
}

body {
  overflow-wrap: anywhere;
}

input,
select,
textarea,
button {
  max-width: 100%;
}

.page-body,
.container,
.container-fluid {
  width: 100%;
}

.modal-dialog {
  width: min(100% - 24px, var(--modal-max-width, 100%));
  margin: 1rem auto;
}

.modal-content,
.glass-card,
.card,
.session-panel,
.planner-hero,
.hero-panel,
.form-panel {
  max-width: 100%;
}

table {
  width: 100%;
}

.table-wrap,
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table,
.table-responsive table {
  border-collapse: collapse;
}

.responsive-grid-2,
.responsive-grid-3,
.responsive-grid-4 {
  display: grid;
  gap: 16px;
}

.responsive-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.responsive-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.responsive-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1024px) {
  .hide-tablet {
    display: none !important;
  }

  .responsive-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  html {
    font-size: 15px;
  }

  body {
    overflow-x: hidden;
  }

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

  .stack-mobile,
  .mobile-stack {
    display: flex !important;
    flex-direction: column !important;
  }

  .stack-mobile > *,
  .mobile-stack > * {
    width: 100% !important;
  }

  .page-body,
  .container,
  .container-fluid {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .planner-hero,
  .hero-panel,
  .form-panel,
  .session-panel,
  .glass-card,
  .card-body {
    padding-left: clamp(14px, 3vw, 20px);
    padding-right: clamp(14px, 3vw, 20px);
  }

  .responsive-grid-2,
  .responsive-grid-3,
  .responsive-grid-4 {
    grid-template-columns: 1fr;
  }

  .modal-dialog {
    width: calc(100% - 20px);
    margin: 10px auto;
  }

  .table-responsive table,
  .table-wrap table {
    min-width: 640px;
  }
}

@media (max-width: 640px) {
  html {
    font-size: 14px;
  }

  .full-mobile {
    width: 100% !important;
  }

  .page-body,
  .container,
  .container-fluid {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .planner-hero,
  .hero-panel,
  .form-panel,
  .session-panel,
  .glass-card,
  .card-body {
    border-radius: 16px;
  }

  .table-responsive table,
  .table-wrap table {
    min-width: 560px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .modal-dialog {
    width: calc(100% - 14px);
    margin: 7px auto;
  }

  .table-responsive table,
  .table-wrap table {
    min-width: 520px;
  }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
