/* Shared responsive refinements for portal pages and standalone sign-in pages. */
html {
  width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  overflow-x: hidden;
}

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

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

@media screen and (max-width: 991.98px) {
  #accordionSidebar {
    display: none !important;
  }

  #content-wrapper {
    width: 100%;
    min-width: 0;
  }

  #content-wrapper,
  #content,
  .container-fluid,
  .card,
  .card-body,
  .modal-body {
    min-width: 0;
  }

  .container-fluid {
    padding-right: 12px;
    padding-left: 12px;
  }

  .topbar {
    min-height: 3.75rem;
    height: auto;
    padding: 0.35rem 0.5rem;
  }

  .topbar .navbar-nav {
    flex-direction: row;
    align-items: center;
  }

  .topbar .nav-item .nav-link {
    padding-right: 0.4rem;
    padding-left: 0.4rem;
  }

  .topbar .text-gray-700.small {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar .dropdown-menu {
    max-height: calc(100vh - 5rem);
    max-width: calc(100vw - 1rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .h1, h1 { font-size: 1.6rem; }
  .h2, h2 { font-size: 1.35rem; }
  .h3, h3 { font-size: 1.15rem; }

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

  .row {
    margin-right: -8px;
    margin-left: -8px;
  }

  .row > [class*="col-"] {
    padding-right: 8px;
    padding-left: 8px;
  }

  /* Keep wide schedules, grade sheets, and account ledgers usable by scrolling. */
  .table-responsive,
  .dataTables_wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .responsive-table-scroll {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .responsive-data-table {
    display: table;
    width: max-content;
    min-width: 760px;
    table-layout: auto;
  }

  .responsive-data-table th,
  .responsive-data-table td {
    white-space: nowrap;
  }

  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    white-space: normal;
  }

  .table th,
  .table td {
    padding: 0.45rem;
    vertical-align: top;
  }

  .form-control,
  .form-control-ver,
  select.form-control,
  textarea.form-control {
    width: 100%;
    height: auto;
    min-height: 2.5rem;
    line-height: 1.35;
  }

  textarea.form-control {
    min-height: 5rem;
  }

  .btn {
    white-space: normal;
  }

  .footer,
  footer.sticky-footer {
    line-height: 1.55;
  }

  .login100-form {
    padding-right: 1.25rem;
    padding-left: 1.25rem;
  }

  .wrap-login100 {
    width: min(100%, 560px);
  }
}

@media screen and (max-width: 480px) {
  .dropdown-menu {
    max-height: calc(100vh - 5rem);
    max-width: calc(100vw - 1rem);
    overflow-y: auto;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .dataTables_filter input,
  .dataTables_length select {
    max-width: 65vw;
  }

  .login100-form {
    padding-right: 1rem;
    padding-left: 1rem;
  }
}

@media screen and (max-width: 991.98px) {
  .announcements-empty {
    min-height: 480px;
  }
}

/* Shared mobile portal polish */
:root {
  --portal-blue: #315fa8;
  --portal-light-blue: #5d8fd2;
  --portal-cyan: #39b8cf;
  --portal-ink: #26364a;
  --portal-muted: #718096;
  --portal-border: #e3eaf2;
}

@media screen and (max-width: 991.98px) {
  body {
    color: var(--portal-ink);
    background: #f4f7fb;
    font-size: 0.94rem;
    line-height: 1.55;
  }

  #content {
    background: #f4f7fb;
  }

  .container-fluid {
    padding-right: 14px;
    padding-left: 14px;
  }

  .topbar {
    position: relative;
    z-index: 20;
    min-height: 3.75rem;
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid rgba(49, 95, 168, .08);
    background: linear-gradient(110deg, #fff 0%, #f7fbff 72%, #effbfc 100%) !important;
    box-shadow: 0 3px 14px rgba(31, 57, 91, .07) !important;
  }

  .mobile-nav-toggle {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 0.65rem;
    padding: 0.3rem 0.55rem;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--portal-blue);
    font-weight: 600;
  }

  .mobile-nav-toggle::after { display: none; }
  .mobile-nav-toggle .logo { width: 36px; height: 36px; object-fit: contain; }
  .mobile-nav-toggle .fa-bars { margin-left: 0.15rem; font-size: 1.1rem; }
  .mobile-nav-label { color: var(--portal-ink); font-size: 0.88rem; }

  .mobile-nav .dropdown-menu {
    left: 0 !important;
    right: auto !important;
    width: min(19rem, calc(100vw - 1.5rem));
    padding: 0.45rem;
    border: 1px solid var(--portal-border);
    border-radius: 14px;
    box-shadow: 0 16px 36px rgba(31, 57, 91, .18) !important;
  }

  .mobile-nav .dropdown-item {
    display: flex;
    min-height: 44px;
    align-items: center;
    border-radius: 9px;
    color: #42536a;
    white-space: normal;
  }

  .mobile-nav .dropdown-item:active,
  .mobile-nav .dropdown-item:focus { background: #edf5ff; color: var(--portal-blue); }
  .mobile-nav .dropdown-divider { margin: 0.2rem 0; }

  .topbar .navbar-nav { gap: 0.15rem; }
  .topbar .nav-item .nav-link { min-height: 44px; display: flex; align-items: center; }
  .topbar .img-profile { width: 34px; height: 34px; }

  .h1, h1 { font-size: clamp(1.25rem, 5vw, 1.55rem); line-height: 1.25; }
  .h2, h2 { font-size: 1.25rem; line-height: 1.3; }
  .h3, h3 { font-size: 1.08rem; line-height: 1.35; }
  .h6, h6 { line-height: 1.4; }

  .d-sm-flex.align-items-center.justify-content-between {
    align-items: flex-start !important;
    gap: 0.5rem;
  }

  .card {
    border: 1px solid rgba(218, 228, 240, .9);
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(40, 61, 89, .07) !important;
    overflow: hidden;
  }

  .card-header {
    border-bottom-color: var(--portal-border);
    background: linear-gradient(110deg, #fff 0%, #f4f9ff 76%, #effbfd 100%);
    color: var(--portal-blue);
    line-height: 1.45;
  }

  .card-body { line-height: 1.55; }

  /* Cards laid out in thirds on desktop become readable, full-width items. */
  .row > .col-4,
  .row > .col-sm-4 { flex: 0 0 100%; max-width: 100%; }

  .btn,
  .dropdown-item,
  .nav-link,
  .page-link { touch-action: manipulation; }

  .btn {
    min-height: 42px;
    padding: 0.55rem 0.85rem;
    border-radius: 9px;
    font-weight: 600;
    line-height: 1.35;
  }

  .btn-primary {
    border-color: transparent;
    background: linear-gradient(110deg, var(--portal-blue), var(--portal-light-blue) 68%, var(--portal-cyan));
    box-shadow: 0 4px 10px rgba(49, 95, 168, .17);
  }

  .btn-primary:focus,
  .btn-primary:active { box-shadow: 0 0 0 3px rgba(57, 184, 207, .22); }

  .form-control,
  .form-control-ver,
  select.form-control,
  textarea.form-control {
    min-height: 44px;
    padding: 0.55rem 0.75rem;
    border: 1px solid #d8e1ec;
    border-radius: 9px;
    background-color: #fff;
    color: var(--portal-ink);
    font-size: 16px; /* prevents unwanted zoom on iOS */
    line-height: 1.4;
  }

  .form-control:focus,
  .form-control-ver:focus {
    border-color: var(--portal-light-blue);
    box-shadow: 0 0 0 3px rgba(93, 143, 210, .16);
  }

  label { margin-bottom: 0.35rem; color: #43536a !important; font-size: 0.84rem; }

  .responsive-table-scroll,
  .table-responsive,
  .dataTables_wrapper,
  .dataTables_scrollBody {
    max-width: 100%;
    border-radius: 8px;
    overscroll-behavior-x: contain;
  }

  .responsive-data-table { min-width: 680px; }
  .table th, .table td { padding: 0.55rem 0.6rem; }

  .modal-dialog {
    width: auto;
    max-width: none;
    margin: 0.65rem;
  }

  .modal-content {
    max-height: calc(100vh - 1.3rem);
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 14px 40px rgba(24, 43, 68, .22);
  }

  @supports (height: 100dvh) {
    .modal-content { max-height: calc(100dvh - 1.3rem); }
  }

  .modal-header,
  .modal-footer { padding: 0.85rem 1rem; }
  .modal-body { overflow-y: auto; padding: 1rem; -webkit-overflow-scrolling: touch; }

  .swal2-popup {
    width: min(26rem, calc(100vw - 2rem)) !important;
    padding: 1.1rem !important;
    border-radius: 16px !important;
  }

  .swal2-actions button { min-height: 44px; border-radius: 9px !important; }

  .footer,
  footer.sticky-footer { padding: 0.9rem 0.65rem; font-size: 0.78rem; }

  .mobile-nav-toggle:focus-visible,
  .dropdown-item:focus-visible,
  .btn:focus-visible,
  .form-control:focus-visible,
  .page-link:focus-visible {
    outline: 3px solid rgba(57, 184, 207, .52);
    outline-offset: 2px;
  }
}

@media screen and (max-width: 380px) {
  .container-fluid { padding-right: 10px; padding-left: 10px; }
  .topbar { padding-right: 0.45rem; padding-left: 0.45rem; }
  .mobile-nav-toggle { gap: 0.4rem; padding-right: 0.35rem; padding-left: 0.35rem; }
  .mobile-nav-label { font-size: 0.8rem; }
  .topbar .text-gray-700.small { max-width: 20vw; }
  .card-header, .card-body { padding: 0.7rem; }
  .modal-dialog { margin: 0.4rem; }
}

@media screen and (max-width: 991.98px) and (orientation: landscape) {
  .modal-content { max-height: calc(100dvh - 0.8rem); }
  .modal-dialog { margin: 0.4rem auto; }
}

/* SweetAlert2 dialogs follow the PNG red, gold, black, and white palette. */
.swal2-popup {
  color: #242424 !important;
  background: #FFFFFF !important;
  border: 1px solid #D8D8D8 !important;
  border-top: 5px solid #CE1126 !important;
  border-radius: 14px !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .24) !important;
}
.swal2-title { color: #000000 !important; }
.swal2-html-container, .swal2-validation-message { color: #3A3A3A !important; }
.swal2-validation-message { background: #FFF7D4 !important; }
.swal2-close { color: #555555 !important; }
.swal2-close:hover { color: #CE1126 !important; }
.swal2-actions button {
  min-height: 42px;
  padding: .65rem 1.15rem !important;
  border-radius: 9px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}
.swal2-actions .swal2-confirm { color: #FFFFFF !important; background: #CE1126 !important; }
.swal2-actions .swal2-confirm:hover { background: #A80D20 !important; }
.swal2-actions .swal2-cancel { color: #FFFFFF !important; background: #171717 !important; }
.swal2-actions .swal2-cancel:hover { background: #333333 !important; }
.swal2-actions .swal2-deny { color: #000000 !important; background: #FCD116 !important; }
.swal2-actions .swal2-deny:hover { background: #E5BB00 !important; }
.swal2-actions button:focus-visible {
  outline: 3px solid rgba(252, 209, 22, .8) !important;
  outline-offset: 2px;
}
.swal2-input:focus, .swal2-textarea:focus, .swal2-select:focus {
  border-color: #CE1126 !important;
  box-shadow: 0 0 0 .2rem rgba(206, 17, 38, .2) !important;
}
.swal2-icon.swal2-success { border-color: #FCD116 !important; color: #CE1126 !important; }
.swal2-icon.swal2-success .swal2-success-ring { border-color: #FCD116 !important; }
.swal2-icon.swal2-success [class^="swal2-success-line"] { background-color: #CE1126 !important; }
.swal2-icon.swal2-warning { border-color: #FCD116 !important; color: #6C5700 !important; }
.swal2-icon.swal2-error { border-color: #CE1126 !important; color: #CE1126 !important; }
.swal2-icon.swal2-error [class^="swal2-x-mark-line"] { background-color: #CE1126 !important; }
.swal2-icon.swal2-info { border-color: #CE1126 !important; color: #CE1126 !important; }
.swal2-icon.swal2-question { border-color: #171717 !important; color: #171717 !important; }
.swal2-timer-progress-bar { background: #CE1126 !important; }

/* Shared Bootstrap modals use the same institutional palette. */
.modal-content {
  color: #292929;
  background: #FFFFFF;
  border: 1px solid #D8D8D8;
  border-top: 4px solid #CE1126;
  border-radius: 14px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, .22);
}
.modal-header.bg-light {
  color: #FFFFFF;
  background: #000000 !important;
  border-bottom: 3px solid #FCD116;
}
.modal-header.bg-light .modal-title,
.modal-header.bg-light .modal-title i { color: #FFFFFF; }
.modal-header.bg-light .modal-title i { color: #FCD116; }
.modal-header.alert-danger {
  color: #FFFFFF;
  background: #CE1126 !important;
  border-bottom: 3px solid #FCD116;
}
.modal-header.alert-danger .modal-title,
.modal-header.alert-danger .modal-title i { color: #FFFFFF; }
.modal-header .close { color: #FFFFFF; opacity: .9; text-shadow: none; }
.modal-header .close:hover,
.modal-header .close:focus { color: #FCD116; opacity: 1; }
.modal-body { color: #343434; }
.modal-body a { color: #CE1126; }
.modal-footer { color: #4A4A4A; background: #F8F8F8; border-top: 1px solid #E8D98B; }
.modal-footer > i { color: #CE1126; }
.modal .btn:focus-visible,
.modal a:focus-visible { outline: 3px solid rgba(252, 209, 22, .85); outline-offset: 2px; }
.modal-backdrop.show { opacity: .58; }
