/* Global responsive and typography overrides for admin + return flow pages */

:root {
  --app-mobile-gap: 12px;
  --app-table-min-width: 860px;
}

html,
body {
  max-width: 100%;
}

body {
  overflow-x: hidden;
  line-height: 1.45;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.25;
  word-break: break-word;
}

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

/* Base template brand header */
body > header img {
  max-width: min(220px, 60vw);
  height: auto;
}

.nk-content {
  width: 100%;
}

.nk-block-head-content .nk-block-title {
  letter-spacing: -0.01em;
}

.card-inner {
  overflow-wrap: anywhere;
}

.btn,
.form-control,
.form-select,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="tel"],
textarea,
select {
  max-width: 100%;
}

.btn {
  white-space: normal;
}

/* Common table patterns */
.table-responsive,
.table-responsive-wrap,
.dataTables_wrapper,
.nk-tb-list {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive table,
.table-responsive-wrap table,
.dataTables_wrapper table,
.nk-tb-list table {
  min-width: var(--app-table-min-width);
}

/* Datatable control row wrap on narrow screens */
.dataTables_wrapper .row {
  row-gap: 8px;
}

/* Improve long chips/labels/text blocks */
.badge,
.btn,
.form-note,
.nk-menu-text,
.dropdown-item-custom {
  overflow-wrap: anywhere;
}

@media (max-width: 991.98px) {
  .nk-content {
    padding-left: var(--app-mobile-gap);
    padding-right: var(--app-mobile-gap);
  }

  .nk-block {
    margin-bottom: 20px;
  }

  .nk-block-head {
    margin-bottom: 12px;
  }

  .card-inner {
    padding: 14px;
  }

  .dataTables_wrapper .dataTables_filter input,
  .dataTables_wrapper .dataTables_length select {
    width: 100%;
  }
}

@media (max-width: 1199.98px) {
  /* Force no reserved sidebar width on mobile/tablet */
  .nk-sidebar + .nk-wrap,
  .nk-sidebar-overlay + .nk-wrap {
    padding-left: 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
  }

  .nk-sidebar + .nk-wrap > .nk-header-fixed,
  .nk-sidebar-overlay + .nk-wrap > .nk-header-fixed {
    left: 0 !important;
  }

  .nk-main,
  .nk-wrap,
  .nk-content {
    max-width: 100%;
  }

  /* Ensure sidebar appears as true off-canvas on mobile */
  .nk-sidebar.nk-sidebar-mobile {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 1060;
  }

  .nk-sidebar.nk-sidebar-mobile.nk-sidebar-active {
    transform: translateX(0) !important;
  }
}

@media (max-width: 767.98px) {
  :root {
    --app-table-min-width: 720px;
  }

  body {
    font-size: 14px;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.35rem;
  }

  h3 {
    font-size: 1.2rem;
  }

  h4 {
    font-size: 1.05rem;
  }

  h5,
  h6 {
    font-size: 1rem;
  }

  .nk-block-title {
    font-size: 1.1rem;
  }

  .btn,
  .form-control,
  .form-select {
    min-height: 40px;
    font-size: 14px;
  }

  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }

  .modal-body {
    padding: 0.85rem;
  }
}
