/*
  ASSADA responsive layer
  Keeps the current desktop design, while making pages easier to use on
  phones, tablets, iPad, and small laptop screens.
*/

html {
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

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

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

.table,
table.dataTable {
  max-width: 100%;
}

.modal {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.modal-body {
  overflow-x: auto;
}

.btn,
.form-control,
.form-select {
  min-height: 42px;
}

textarea.form-control {
  min-height: 86px;
}

.form-control,
.form-select,
.btn,
.dropdown-menu {
  font-size: 1rem;
}

.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  float: none;
  text-align: left;
}

.dataTables_wrapper .dataTables_filter input {
  width: min(100%, 340px);
  margin-left: 0.35rem;
}

/* FullCalendar / Calendar page */
.fc {
  max-width: 100%;
}

.fc .fc-toolbar {
  gap: 0.75rem;
  flex-wrap: wrap;
}

.fc .fc-toolbar-title {
  font-size: clamp(1.35rem, 4vw, 2rem);
}

.fc .fc-button {
  min-height: 40px;
}

/* Dashboard shell */
.sidebar {
  transition: none;
}

#logo,
#logo0 {
  object-fit: contain;
}

@media (max-width: 1199.98px) {
  .container,
  .container-fluid {
    max-width: 100%;
  }

  body.p-4 {
    padding: 1.25rem !important;
  }

  .content-wrapper {
    padding: 1.25rem;
  }

  .card {
    border-radius: 0.65rem;
  }
}

@media (max-width: 991.98px) {
  body.p-4 {
    padding: 1rem !important;
  }

  h1,
  .h1 {
    font-size: 1.75rem;
  }

  h2,
  .h2 {
    font-size: 1.55rem;
  }

  h3,
  .h3 {
    font-size: 1.35rem;
  }

  .d-flex.justify-content-between,
  .d-flex.align-items-center.justify-content-between,
  .d-flex.justify-content-between.align-items-center {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .d-flex.justify-content-between > *,
  .d-flex.align-items-center.justify-content-between > *,
  .d-flex.justify-content-between.align-items-center > * {
    min-width: 0;
  }

  .btn {
    white-space: normal;
  }

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

  .modal-content {
    max-height: calc(100vh - 1rem);
  }

  .modal-body {
    max-height: calc(100vh - 9rem);
    overflow-y: auto;
  }

  .table th,
  .table td,
  table.dataTable thead th,
  table.dataTable tbody td {
    white-space: nowrap;
    font-size: 0.92rem;
  }

  .dataTables_wrapper .dataTables_filter input,
  .dataTables_wrapper .dataTables_length select {
    margin-top: 0.35rem;
  }
}

@media (max-width: 767.98px) {
  body.p-4 {
    padding: 0.75rem !important;
  }

  .content-wrapper {
    padding: 1rem 0.75rem;
  }

  .card-body,
  .card-header,
  .card-footer {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .row {
    --bs-gutter-x: 0.75rem;
  }

  .form-control,
  .form-select {
    width: 100%;
  }

  .btn {
    width: auto;
    max-width: 100%;
  }

  .card > .card-body > .btn,
  form > .btn,
  .modal-footer .btn {
    min-width: 112px;
  }

  .d-flex.gap-2,
  .d-flex.gap-3,
  .btn-toolbar,
  .input-group {
    flex-wrap: wrap;
  }

  .input-group > .form-control,
  .input-group > .form-select,
  .input-group > .btn {
    flex: 1 1 100%;
    width: 100%;
    border-radius: 0.375rem !important;
  }

  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    width: 100%;
    margin-top: 0.5rem;
  }

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

  .dataTables_wrapper .dataTables_filter input,
  .dataTables_wrapper .dataTables_length select {
    width: 100%;
    margin-left: 0;
  }

  .dataTables_wrapper .dataTables_paginate .paginate_button {
    margin-top: 0.25rem;
  }

  .fc .fc-toolbar {
    align-items: stretch;
  }

  .fc .fc-toolbar-chunk {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    flex-wrap: wrap;
  }

  .fc .fc-daygrid-day-number {
    font-size: 0.9rem;
    padding: 0.25rem;
  }

  .fc .fc-daygrid-day-frame {
    min-height: 76px;
  }

  /* Dashboard sidebar becomes a top horizontal menu on mobile/tablet. */
  .dashboard-shell,
  body > .d-flex:has(.sidebar) {
    display: block !important;
  }

  .sidebar {
    min-height: auto;
    width: 100% !important;
    padding: 0.75rem !important;
    border-radius: 0 0 0.8rem 0.8rem;
    overflow: hidden;
  }

  .sidebar .brand {
    display: inline-block;
    padding: 0.25rem 0.5rem 0.6rem;
    border-bottom: 0;
    vertical-align: middle;
  }

  .sidebar #logo0 {
    width: 96px;
    max-height: 46px;
    margin-right: 0.35rem;
  }

  .sidebar .nav {
    flex-direction: row !important;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0.35rem 0 0.2rem;
    margin-top: 0.25rem !important;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar .nav-link {
    flex: 0 0 auto;
    margin: 0.15rem;
    padding: 0.55rem 0.75rem;
  }

  .sidebar .nav-link span {
    white-space: nowrap;
  }

  .sidebar .sidebar-footer {
    display: none;
  }

  #logo {
    width: min(100%, 320px);
    padding-right: 0;
  }
}

@media (max-width: 575.98px) {
  body.p-4 {
    padding: 0.55rem !important;
  }

  .card,
  .modal-content,
  .alert {
    border-radius: 0.55rem;
  }

  .table th,
  .table td,
  table.dataTable thead th,
  table.dataTable tbody td {
    font-size: 0.86rem;
    padding: 0.45rem;
  }

  .table .btn,
  table.dataTable .btn,
  .dt-container .btn,
  .table-responsive .btn {
    min-height: 34px;
    padding: 0.28rem 0.5rem;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .table .form-select,
  table.dataTable .form-select {
    min-height: 34px;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    font-size: 0.84rem;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .fc .fc-daygrid-day-frame {
    min-height: 64px;
  }
}

.assada-scroll-x {
  overflow-x: scroll;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  border-bottom: 1px solid rgba(0,0,0,.08);
}

.assada-scroll-x::-webkit-scrollbar {
  height: 12px;
}

.assada-scroll-x::-webkit-scrollbar-track {
  background: #eef2f7;
}

.assada-scroll-x::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 999px;
}

.assada-link {
  color: #0d6efd;
  text-decoration: none;
  font-weight: 600;
}

.assada-link:hover {
  text-decoration: underline;
}
