:root {
  --primary: #ed726f;
  --danger: #e2211c;
  --success: #28B067;
  --success-light: #6FED83;
  --font-family: "Heebo", sans-serif;
  --primary-shadow: 0px 0px 14px -1px #ba1616c7;
  --danger-shadow: 0px 0px 14px -1px #ba1616c7;
  --success-shadow: 0px 0px 14px -1px #28B067;
  --select-shadow: 0px 0px 11px 3px #00000040 inset;
}

body.theme-beds {
  --primary: #ed726f;
  --primary-shadow: 0px 0px 14px -1px #ba1616c7;
}

/* Water theme: hue-rotated blue brand color */
body.theme-water {
  --primary: #6eb8ed;
  --primary-shadow: 0px 0px 14px -1px #1676bac7;
}

/* Header */

.app-header__inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* TODO: this 3-column centering + mobile reflow could use Bootstrap's grid
   (row/col-*) with responsive classes instead of custom flex CSS below. */
/* Three equal columns so the center logo sits at the true page center */
.app-header__brand,
.app-header__city,
.app-header__action {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  min-width: 0;
}

.app-header__brand {
  justify-content: flex-start;
}

.app-header__city {
  justify-content: center;
}

.app-header__action {
  justify-content: flex-end;
}

.app-header__logo {
  width: 150px;
  max-width: 100%;
  height: auto;
}

/* Oasis Coalition badge source is only 78x78 - cap its display width close to
   native size instead of upscaling it to the standard 150px logo width. */
body.theme-water .app-header__city .app-header__logo {
  width: 80px;
}

/* Tablet: shrink logos so all three items keep fitting */
@media (max-width: 767.98px) {
  .app-header__logo {
    width: 120px;
  }

  .app-header .btn-large {
    padding: 0.65rem 1.25rem;
    font-size: 1rem;
  }
}

/* Phone: the two logos hug the edges, action drops to a full-width row */
@media (max-width: 575.98px) {
  .app-header.container {
    padding: 1rem !important;
  }

  .app-header__inner {
    gap: 0.75rem;
  }

  .app-header__city {
    justify-content: flex-end;
  }

  .app-header__logo {
    width: clamp(90px, 38vw, 130px);
  }

  .app-header__action {
    order: 3;
    flex-basis: 100%;
    justify-content: center;
  }

  .app-header__action .btn {
    width: 100%;
    justify-content: center;
  }
}

.alert-debug {
  color: black;
  background-color: white;
  border-color: #d6e9c6;
}

.alert-error {
  color: #b94a48;
  background-color: #f2dede;
  border-color: #eed3d7;
}

* {
  font-family: var(--font-family);
}

.btn {
  padding: 0.5rem 2rem;
  border-radius: 2rem;
  border: unset;
  font-size: 1.2rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  transition: unset;
}

.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
  font-family: var(--font-family);
  color: white;
  box-shadow: var(--primary-shadow);
}

.btn-primary:hover,
.btn.btn-primary:active {
  box-shadow: var(--select-shadow);
  background-color: var(--primary);
  border-color: var(--primary);
}

.btn-success {
  background-color: var(--success);
  box-shadow: var(--success-shadow);
}

.btn-success:hover,
.btn.btn-success:active {
  background-color: var(--success);
  box-shadow: var(--select-shadow);
}

.btn-danger {
  background-color: var(--danger);
  box-shadow: var(--danger-shadow);
}

.btn-danger:hover,
.btn.btn-danger:active {
  background-color: var(--danger);
  box-shadow: var(--select-shadow);
}

.btn-large {
  padding: 1rem 2rem;
  text-transform: uppercase;
}

.btn-social-login {
  text-decoration: none;
  margin-bottom: 2rem;
  align-items: center;
  padding: 0.5rem 2rem;
  width: 100%;
  background-color: #fff;
  display: flex;
  justify-content: center;
  color: var(--primary);
  border-radius: 2rem;
  box-shadow: var(--primary-shadow);

  img {
    margin-right: 1rem;
  }
}

.btn-social-login:hover {
  color: var(--primary);
  box-shadow: var(--select-shadow);
}

.login-or {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}

.login-or::before {
  content: '';
  flex-grow: 1;
  height: 1px;
  margin-right: 2rem;
  background-color: #fff;
}

.login-or::after {
  content: '';
  flex-grow: 1;
  height: 1px;
  margin-left: 2rem;
  background-color: #fff;
}

.dataTables_scrollBody::-webkit-scrollbar {
  width: 0.5rem;
}

.dataTables_scrollBody::-webkit-scrollbar-thumb {
  border-radius: 12.0625rem;
  background: var(--primary);
}

.shelter-name {
  font-size: 3rem;
  font-weight: 900;
}

.separator {
  width: 4px;
  height: 6rem;
  background-color: var(--primary);
  margin: 0 6rem;
}

.vacancy {
  font-size: 3rem;
  font-weight: 900;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
}

.nav.nav-fill {
  background: #f8f8f8;
  border-bottom: 2px solid #eee;
  border-radius: 1rem 1rem 0 0;
  overflow: hidden;
}

.nav.nav-fill--sub {
  border-radius: 0 0 1rem 1rem;
  border-bottom: none;
  border-top: none;
}

.nav-fill--sub .nav-item {
  border-bottom: none;
  margin-bottom: 0;
}

.nav-item {
  background: transparent;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  overflow: hidden;
  transition: all 0.2s;
}

.nav-item .nav-link {
  color: #555 !important;
  padding: 1rem 1.5rem;
  font-weight: 500;
  font-size: 1.05rem;
}

.nav-item .nav-link:hover {
  color: var(--primary) !important;
  background: rgba(237, 114, 111, 0.08);
}

.nav-item .nav-link.active {
  color: var(--primary) !important;
  font-weight: 700;
  background: rgba(237, 114, 111, 0.1);
}

.nav-item:has(.active) {
  border-bottom-color: var(--primary);
}

.nav-item:hover {
  border-bottom-color: var(--primary);
}

.footer {
  margin-top: auto;
  background-color: var(--primary);
  font-size: 24px;
  font-weight: 400;
  height: 200px;
}

.login {
  background: var(--primary);
  border-radius: 32px
}

#login-btn {
  color: var(--primary)
}

#signup-btn {
  color: var(--primary)
}

#reset-btn {
  color: var(--primary);
  background-color: white;
}

.asteriskField {
  display: none;
}

#id_login,
#id_password,
#id_email,
#id_password1,
#id_password2 {
  width: 100%;
  border-radius: 35px;
}

#id_login::placeholder,
#id_password::placeholder,
#id_email::placeholder,
#id_password1::placeholder,
#id_password2::placeholder {
  color: transparent;
}

#reset {
  color: white;
}

/* Input Styles */

/* TODO: scope this override to @media (min-width: 768px) instead of adding
   a mobile counter-rule below — Bootstrap's .form-control is already
   width: 100% by default, so mobile would inherit it untouched. */
input[type='text']:not(.search-bar__input),
input[type='email'],
input[type='time'],
input[type='number'] {
  width: max-content;
  border-radius: 1.25rem;
  border: 1px solid var(--primary);
  box-shadow: unset;
}

input[type='text']:not(.search-bar__input):focus,
input[type='email']:focus,
input[type='time']:focus,
input[type='number']:focus {
  border: 1px solid var(--primary);
  box-shadow: unset;
}

/* On mobile, let form inputs span the full column width */
@media (max-width: 767.98px) {
  input[type='text']:not(.search-bar__input),
  input[type='email'],
  input[type='time'],
  input[type='number'] {
    width: 100%;
  }
}

select.form-select {
  border: none;
  border-bottom: 2px solid var(--primary);
  border-radius: 0;
  background-color: transparent;
  box-shadow: none;
  padding: 0.5rem 1.5rem 0.5rem 0;
}

select.form-select:focus {
  border: none;
  border-bottom: 2px solid var(--primary);
  box-shadow: none;
  outline: none;
}

/* Navigation Fill */

.nav-fill .nav-item,
.nav-fill > .nav-link {
  flex: 1;
}

/* Green variant for create actions */
.nav-item--success .nav-link {
  color: var(--success) !important;
}

.nav-item--success .nav-link:hover {
  color: var(--success) !important;
  background: rgba(40, 176, 103, 0.1);
}

.nav-item--success .nav-link.active {
  color: #fff !important;
  background: var(--success);
}

.nav-item--success:has(.active) {
  border-bottom-color: var(--success);
}

.nav-item--success:hover {
  border-bottom-color: var(--success);
}

/* Preview View */

.map {
  width: 60%;
  aspect-ratio: 2/1;
  border: 3px solid var(--primary);
  border-radius: 3vh;
}

.map-view {
  height: 600px;
  border: 3px solid var(--primary);
  border-radius: 3vh;
}

.table {
  border-color: var(--primary);
}

/* Check In */

.active > .page-link, .page-link.active {
  background-color: var(--primary);
  border-color: var(--primary);
}

.page-link {
  color: var(--primary);
}

.row {
  margin: auto;
}

/* Training */

.training-video-list {
  --bs-list-group-active-bg: var(--primary);
  --bs-list-group-active-border-color: var(--primary);
}


.input-error {
  color: red;
}

/* Residences list */

.residence-list {
  margin: 2rem 0;
}

.residence-list__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.residence-list__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 2rem;
  padding: 0.6rem 1.25rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}

.search-bar:focus-within {
  border-color: var(--primary);
}

.search-bar svg {
  color: #888;
  flex-shrink: 0;
}

.search-bar:focus-within svg {
  color: var(--primary);
}

.search-bar__input {
  border: none;
  outline: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  width: 100%;
  font-size: 1rem;
  padding: 0;
}

.search-bar__input::placeholder {
  color: #aaa;
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #f8f8f8;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  color: #555;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-toggle:hover {
  background: #eee;
  color: var(--primary);
}

.filter-panel {
  background: #f8f8f8;
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.5rem;
}

.filter-form > div {
  margin-bottom: 0 !important;
}

.filter-form label:not(.form-check-label) {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.25rem;
}

.filter-form .form-check-inline {
  margin-right: 1rem;
}

.filter-form .form-check-input {
  border-color: var(--primary);
}

.filter-form .form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.filter-form select {
  min-width: 150px;
  padding: 0.5rem 1.5rem 0.5rem 0;
  border: none;
  border-bottom: 2px solid var(--primary);
  border-radius: 0;
  background-color: transparent;
  font-size: 1rem;
  cursor: pointer;
}

.filter-form select:hover,
.filter-form select:focus {
  border-bottom-color: var(--primary);
  outline: none;
  box-shadow: none;
}

.filter-form__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  align-self: flex-end;
  padding-bottom: 0.1rem;
}

.filter-form__clear {
  color: #666;
  text-decoration: none;
}

.filter-form__clear:hover {
  color: var(--primary);
}

.bed-badge {
  display: inline-block;
  background: rgba(237, 114, 111, 0.1);
  color: var(--primary);
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}

.residence-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1.25rem;
}

.residence-card {
  display: block;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.residence-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(237, 114, 111, 0.15);
  transform: translateY(-2px);
}

.residence-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #eee;
}

.residence-card__name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.residence-card:hover .residence-card__name {
  color: var(--primary);
}

.residence-card__type {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: #888;
  white-space: nowrap;
}

.residence-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.residence-card__info {
  display: flex;
  gap: 1.5rem;
}

.residence-card__detail {
  display: flex;
  flex-direction: column;
}

.residence-card__label {
  font-size: 0.75rem;
  color: #888;
}

.residence-card__value {
  font-weight: 500;
  color: #333;
}

.residence-card__beds {
  display: flex;
  flex-wrap: wrap;
}

.residence-list__empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #888;
  padding: 3rem;
}

/* Residence rules */

.rules {
  max-width: 960px;
  margin: 4rem auto 4rem;

  .rules__title {
    margin-bottom: 2rem;
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary)
  }
}

/* Residence Edit Page */

.residence-edit {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.residence-edit__title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2rem;
}

.residence-edit__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 1.5rem;
}

.edit-card {
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 1rem;
  overflow: hidden;
}

.edit-card__header {
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1.25rem;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.edit-card__header-btn {
  background: #fff;
  color: var(--primary);
  border: none;
  padding: 0.3rem 1rem;
  border-radius: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
}

.edit-card__header-btn:hover {
  box-shadow: var(--select-shadow);
}

.edit-card__body {
  padding: 1.25rem;
}

.edit-card__row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}

.edit-card__row:last-child {
  border-bottom: none;
}

.edit-card__label {
  color: #666;
  font-size: 0.9rem;
}

.edit-card__value {
  font-weight: 600;
  text-align: right;
}

.edit-card--full {
  grid-column: 1 / -1;
}

/* Capacity/Vacancy items */

.capacity-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.capacity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: #f9f9f9;
  border-radius: 0.5rem;
  border: 1px solid #eee;
}

.capacity-item__info {
  display: flex;
  flex: 1 1 9rem;
  gap: 1rem;
  min-width: 0;
}

.capacity-item__field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.capacity-item__field-label {
  font-size: 0.75rem;
  color: #888;
}

.capacity-item__field-value {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.capacity-item__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.5rem;
  margin-left: auto;
}

.capacity-item__actions .btn {
  display: inline-flex;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.capacity-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 1rem;
  text-decoration: none;
}

.capacity-action-icon:hover {
  color: var(--primary);
}

.capacity-action-icon--remove:hover {
  color: var(--danger);
}

.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
}

.edit-card__footer {
  padding: 0 1.25rem 1.25rem;
}

/* Rules section */

.rules-content {
  padding: 1rem;
  background: #f9f9f9;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  max-height: 200px;
  overflow-y: auto;
}

.rules-content:empty::before {
  content: "No rules defined";
  color: #888;
  font-style: italic;
}

/* Residence Preview Page */

.residence-preview {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
}

.preview-header__name {
  font-size: 1.75rem;
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--primary);
}

.preview-header__beds {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 2rem;
  font-weight: 700;
}

.preview-main {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .preview-main {
    grid-template-columns: 1fr;
  }
}

.preview-map {
  border-radius: 1rem;
  overflow: hidden;
  min-height: 300px;
}

.preview-map #map {
  width: 100%;
  height: 100%;
  min-height: 300px;
}

.preview-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-card {
  background: #fff;
  border-radius: 1rem;
  padding: 1.25rem;
}

.preview-main + .preview-card {
  margin-bottom: 0;
}

.preview-card__title {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.preview-address {
  text-align: center;
}

.preview-address p {
  margin: 0.25rem 0;
}

.preview-address .btn {
  margin-top: 1rem;
}

.preview-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.preview-contact__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
}

.preview-table th,
.preview-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.preview-table th {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
}

.preview-table th img {
  vertical-align: middle;
  margin-right: 0.5rem;
}

.preview-table tbody tr:hover {
  background: #fef5f5;
}

.preview-rules {
  background: #fff;
  border-radius: 1rem;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.preview-card + .preview-rules {
  margin-top: 1.5rem;
}

.preview-rules__title {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.25rem;
  margin-bottom: 1rem;
  text-align: center;
}

/* Toast Notifications */
/* TODO: Bootstrap already ships a Toast component (.toast/.toast-container
   + bootstrap.Toast JS) — most of this custom CSS/JS could be replaced by it. */

.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem 1rem 1.5rem;
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  min-width: 280px;
  max-width: 400px;
  animation: toast-in 0.4s ease;
}

.toast.toast--hiding {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  0% { transform: translateX(100%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}

.toast::before {
  content: '';
  width: 4px;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 0.75rem 0 0 0.75rem;
}

.toast--success::before { background: var(--success); }
.toast--error::before,
.toast--danger::before { background: var(--danger); }
.toast--warning::before { background: #f59e0b; }
.toast--info::before { background: var(--primary); }

.toast__message {
  flex: 1;
  font-size: 0.95rem;
  color: #333;
}

.toast__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.toast__close:hover {
  color: #333;
}

/* Mobile refinements */
@media (max-width: 575.98px) {
  /* Preview header: stack name and bed count instead of squeezing them */
  .preview-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0 1rem;
    margin-bottom: 1rem;
  }

  .preview-header__name {
    font-size: 1.35rem;
    gap: 0.5rem;
  }

  .preview-header__beds {
    font-size: 1.5rem;
  }

  /* Footer: drop the fixed 200px height / oversized type */
  .footer {
    height: auto;
    min-height: 96px;
    font-size: 1rem;
    padding: 1rem 0;
  }

  /* Toasts: span the screen instead of a fixed 280–400px width */
  .toast-container {
    top: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
  }

  .toast {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
}
