/* SAMS shared UI baseline */
:root {
  --sams-bg: #f5f7fb;
  --sams-surface: #ffffff;
  --sams-border: #dfe5ee;
  --sams-muted: #667085;
  --sams-heading: #1f2937;
  --sams-primary: #0d6efd;
  --sams-footer-height: 58px;
  --sams-navbar-height: 64px;
  --sams-radius: 8px;
}

body.sams-page {
  min-height: 100vh;
  padding: var(--sams-navbar-height) 0 calc(var(--sams-footer-height) + 1rem) !important;
  background: var(--sams-bg);
  color: #212529;
}

body.sams-page:not(:has(.navbar.fixed-top)) {
  padding-top: 0 !important;
}

body.sams-auth {
  background: var(--sams-bg);
}

.navbar.fixed-top {
  min-height: 56px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.14);
}

.navbar .navbar-brand,
.navbar .nav-link {
  letter-spacing: 0;
}

.navbar .nav-link {
  border-radius: 6px;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

.navbar .nav-link.active {
  background: rgba(255, 255, 255, 0.16);
}

body.sams-page > .container-fluid {
  padding: 1.25rem 1.5rem;
  margin-top: 0 !important;
}

body.sams-page > .container-fluid > .d-flex:first-child {
  gap: 0.75rem;
  margin-bottom: 1rem !important;
}

body.sams-page h1,
body.sams-page h2 {
  color: var(--sams-heading);
  letter-spacing: 0;
}

body.sams-page h1.h3,
body.sams-page .h3 {
  font-weight: 700;
}

.card,
.modal-content {
  border-radius: var(--sams-radius);
}

body.sams-page .card {
  border-color: var(--sams-border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.07);
}

body.sams-page .card.border-0 {
  border: 1px solid var(--sams-border) !important;
}

.card.bg-light,
.filter-section {
  background: var(--sams-surface) !important;
}

.table-responsive {
  background: var(--sams-surface);
  border: 1px solid var(--sams-border);
  border-radius: var(--sams-radius);
  overflow-x: auto;
}

.card .table-responsive {
  border: 0;
  border-radius: 0;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  color: #344054;
  font-size: 0.86rem;
  font-weight: 700;
  vertical-align: middle;
}

.table tbody td {
  vertical-align: middle;
}

.dataTables_wrapper {
  width: 100%;
}

.dataTables_length,
.dataTables_filter,
.dataTables_info,
.dataTables_paginate {
  margin-top: 0.5rem;
}

.form-label,
label {
  color: #344054;
  font-weight: 600;
}

.btn {
  border-radius: 6px;
}

.btn-sm {
  min-height: 31px;
}

.modal-footer {
  gap: 0.5rem;
}

#quickDailyCheckModal input:disabled,
#quickDailyCheckModal input[readonly],
#addDailyModal input:disabled,
#addDailyModal input[readonly] {
  background-color: #e9ecef;
}

.sams-password-field .form-control {
  min-width: 0;
}

.sams-password-toggle {
  width: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sams-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.sams-filterable-select {
  position: relative;
  width: 100%;
}

.sams-filterable-select .sams-filterable-input {
  min-height: 38px;
  padding-right: 2.25rem;
  background-image:
    linear-gradient(45deg, transparent 50%, #6c757d 50%),
    linear-gradient(135deg, #6c757d 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.sams-filterable-select.is-disabled .sams-filterable-input {
  background-color: #e9ecef;
  cursor: not-allowed;
}

.sams-filterable-menu {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  left: 0;
  z-index: 1065;
  display: none;
  max-height: 240px;
  overflow-y: auto;
  padding: 0.25rem;
  background: var(--sams-surface);
  border: 1px solid var(--sams-border);
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.sams-filterable-select.is-open .sams-filterable-menu {
  display: block;
}

.sams-filterable-option {
  width: 100%;
  min-height: 34px;
  padding: 0.4rem 0.55rem;
  color: #212529;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 4px;
}

.sams-filterable-option:hover,
.sams-filterable-option:focus,
.sams-filterable-option[aria-selected="true"] {
  background: #e9f2ff;
  color: #0b5ed7;
}

.sams-filterable-option:disabled {
  color: var(--sams-muted);
  cursor: not-allowed;
}

.sams-filterable-empty {
  padding: 0.5rem 0.55rem;
  color: var(--sams-muted);
  font-size: 0.9rem;
}

.sams-filterable-feedback {
  margin-top: 0.25rem;
}

.sams-filterable-select.is-invalid .sams-filterable-feedback,
.was-validated .sams-filterable-input:invalid ~ .sams-filterable-feedback {
  display: block;
}

.sams-footer,
body.sams-page > footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1020;
  min-height: var(--sams-footer-height);
  display: flex;
  align-items: center;
  background: var(--sams-surface) !important;
  border-top: 1px solid var(--sams-border) !important;
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06);
}

.sams-footer .container,
body.sams-page > footer .container {
  max-width: none;
}

body.sams-page > footer small {
  color: var(--sams-muted) !important;
}

@media (max-width: 991.98px) {
  .navbar-collapse {
    padding-top: 0.75rem;
  }

  .navbar .d-flex.align-items-center {
    align-items: flex-start !important;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.75rem;
  }
}

@media (max-width: 767.98px) {
  :root {
    --sams-footer-height: 74px;
  }

  body.sams-page {
    padding-top: var(--sams-navbar-height) !important;
    padding-bottom: calc(var(--sams-footer-height) + 1rem) !important;
  }

  body.sams-page > .container-fluid {
    padding: 1rem;
  }

  body.sams-page > .container-fluid > .d-flex:first-child {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  body.sams-page > .container-fluid > .d-flex:first-child > div:last-child {
    display: grid !important;
    grid-template-columns: 1fr;
    width: 100%;
  }

  body.sams-page > .container-fluid > .d-flex:first-child .btn,
  body.sams-page > .container-fluid > .d-flex:first-child a.btn {
    width: 100%;
    min-width: 0;
  }

  .card-body {
    padding: 1rem;
  }

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

  .modal-footer {
    align-items: stretch;
  }

  .modal-footer .btn {
    flex: 1 1 auto;
    min-width: 0;
  }

  .input-group[style] {
    width: 100% !important;
  }

  body.sams-page > footer small {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    line-height: 1.3;
  }
}

@media print {
  body.sams-page {
    padding: 0 !important;
    background: #fff;
  }

  .navbar.fixed-top,
  body.sams-page > footer {
    display: none !important;
  }

  body.sams-page > .container-fluid {
    padding: 0 !important;
  }
}
