*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  max-width: 100%;
  overflow-x: clip;
}

img,
picture,
video,
canvas,
iframe {
  max-width: 100%;
}

input,
select,
textarea,
button {
  max-width: 100%;
}

main,
.main-content,
.page-body,
.section {
  min-width: 0;
}

.student-preview-card,
.student-preview-card .exercise-header,
.student-preview-card .instruction-card,
.student-preview-card .mock-q-card,
.student-preview-card .q-header-row,
.student-preview-card .q-header-right {
  min-width: 0;
}

.student-preview-card .prev-tajuk,
.student-preview-card .instruction-text,
.student-preview-card .q-title,
.student-preview-card .q-question-text,
.student-preview-card .question-text {
  overflow-wrap: anywhere;
}

.table-wrap,
.table-responsive,
.setting-table-wrap,
.history-table-wrap,
.results-table-wrapper {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

pre,
code {
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .grid,
  .tables-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row,
  .form-grid,
  .form-grid-2,
  .setting-form-grid,
  .filter-grid,
  .filters,
  .fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .grid,
  .tables-grid,
  .form-row,
  .form-grid,
  .form-grid-2,
  .setting-form-grid,
  .filter-grid,
  .filters,
  .fields {
    grid-template-columns: minmax(0, 1fr);
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .modal {
    width: min(100%, 640px);
    max-height: calc(100vh - 1.5rem);
    overflow-y: auto;
  }
}

@supports (height: 100dvh) {
  @media (max-width: 640px) {
    .modal {
      max-height: calc(100dvh - 1.5rem);
    }
  }
}

.btn-logout,
.logout {
  display: inline-flex !important;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: auto !important;
  min-width: 0;
  height: 38px !important;
  padding: 0.45rem 0.65rem !important;
  border: 1px solid #fecaca !important;
  border-radius: 0.75rem !important;
  background: #e53935 !important;
  color: #fff !important;
  font-family: 'Quicksand', sans-serif !important;
  font-size: 0.75rem !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  letter-spacing: 0;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.25s ease;
}

.btn-logout::before,
.logout::before {
  content: "";
  display: block;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23ffffff' stroke-width='6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M50 20H32a10 10 0 0 0-10 10v40a10 10 0 0 0 10 10h18M78 50H38m14-14L38 50l14 14'/%3E%3C/svg%3E");
}

.btn-logout:hover,
.logout:hover {
  background: #c62828 !important;
  color: #fff !important;
  transform: scale(1.04);
}

.btn-logout:focus-visible,
.logout:focus-visible {
  outline: 3px solid #1d4ed8;
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .btn-logout,
  .logout {
    flex-basis: auto;
    height: 36px !important;
    padding: 0.4rem 0.55rem !important;
    font-size: 0.68rem !important;
  }

  .btn-logout::before,
  .logout::before {
    flex-basis: 16px;
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 380px) {
  .btn-logout,
  .logout {
    gap: 0.25rem;
    padding-right: 0.45rem !important;
    padding-left: 0.45rem !important;
    font-size: 0.64rem !important;
  }

  .btn-logout::before,
  .logout::before {
    flex-basis: 16px;
    width: 16px;
    height: 16px;
  }
}

@media print {
  body {
    min-width: 0;
    max-width: none;
    overflow: visible;
  }
}
