:root {
  --dropdown-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
  --dropdown-border: 1px solid #E0E0E0;
  --dropdown-radius: 10px;

  /* Calendar colors */
  --weekend-color: #F36A6A;
  --accent-color: #A100DB;
  --accent-color-rgb: 161, 0, 219;

  /* Text color on primary/accent backgrounds */
  --text-on-primary: white;

  /* Admin dashboard accent */
  --admin-primary: #7c3aed;

  /* Admin badge colors */
  --badge-high: #29B223;
  --badge-mid: #F5A623;
  --badge-low: #F54949;
  --badge-neutral: #888888;

  /* Timeline hour height */
  --hour-height: 60px;

  /* Border radius (use Bootstrap: --bs-border-radius-pill, --bs-border-radius-lg, --bs-border-radius-sm) */
  --radius-card: 20px;
  --radius-card-sm: 10px;
  --radius-xs: 5px;

  /* Form select chevron (for custom dropdowns) */
  --form-select-chevron: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  --form-select-chevron-size: 15px 15px;
  --form-select-chevron-position: right 16px center;
  --form-select-chevron-padding: 42px;
}

html {
  font-size: 14px;
  font-weight: 400;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 20px;
  }

  :root {
    --hour-height: 90px;
  }
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
}


body.auth-bg {
  background-image: url("/img/auth/page-bg.jpg");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
}


.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}


/* Global dropdown styles */
.dropdown-menu {
  margin-top: 3px !important;
  box-shadow: var(--dropdown-shadow);
  border: var(--dropdown-border);
  border-radius: var(--dropdown-radius);
  overflow: hidden;
}

/* Export dropdown — visually paired with the primary button that opens it */
#exportDropdown .dropdown-menu {
  min-width: 100%;
  padding: 6px;
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

#exportDropdown .dropdown-item {
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

#exportDropdown .dropdown-item:hover,
#exportDropdown .dropdown-item:focus,
#exportDropdown .dropdown-item:active {
  background-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* Main content area */
main {
  display: flex;
  flex-direction: column;
}

/* Page content padding */
.page-content {
  padding: 20px;
}

@media (min-width: 768px) {
  .page-content {
    padding: 50px 20px 20px;
  }
}

@media (min-width: 1024px) {
  .page-content {
    padding: 30px 40px;
  }
}

/* Modal title */
.modal-title {
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}

@media (min-width: 768px) {
  .modal-title {
    font-size: 30px;
  }
}

/* Date Navigation Component */
.date-navigation {
  display: flex;
  align-items: center;
  padding: 10px;
  border-radius: var(--bs-border-radius-pill);
  gap: 8px;
  background-color: var(--bs-tertiary-bg);
}

.date-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--bs-border-color);
  background: transparent;
  color: var(--bs-body-color);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.date-nav-btn:hover {
  background-color: var(--bs-secondary-bg);
  border-color: var(--bs-secondary-border-subtle);
  color: var(--bs-body-color);
}

.date-nav-btn.disabled,
.date-nav-btn[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
}

.date-nav-btn.disabled:hover,
.date-nav-btn[disabled]:hover {
  background-color: transparent;
  border-color: var(--bs-border-color);
}

.date-picker-container {
  position: relative;
}

.date-picker-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 280px;
  gap: 15px;
  padding: 2px 12px;
  border: none;
  background: transparent;
  color: var(--bs-body-color);
  cursor: pointer;
  font-size: 20px;
  border-radius: var(--bs-border-radius-pill);
  transition: background-color 0.15s;
}

.date-picker-btn:hover {
  background-color: var(--bs-secondary-bg);
}

.date-text {
  font-weight: 400;
}

.date-text-short {
  display: none;
}

@media (max-width: 374px) {
  .date-picker-btn {
    font-size: 16px;
  }

  .date-nav-btn {
    width: 32px;
    height: 32px;
  }

  .date-nav-btn svg {
    width: 20px;
    height: 20px;
  }

  .date-picker-btn img {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 767px) {
  .date-navigation {
    width: 100%;
  }

  .date-picker-container {
    flex: 1;
  }

  .date-picker-btn {
    width: 100%;
  }

  .date-text-full {
    display: none;
  }

  .date-text-short {
    display: inline;
  }
}

/* Icon mask utility */
.icon-mask {
  display: block;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

/* Lift toasts above sticky action buttons on settings pages */
body:has(.settings-layout) .toast-container {
  bottom: 80px !important;
}

/* === Details Modal (shared between Sleep & Exercise modals) === */

.details-modal .modal-content {
  border: none;
  border-radius: var(--radius-card);
  overflow: hidden;
}

.details-modal .modal-dialog {
  margin-left: 0.5rem;
  margin-right: 0.5rem;
}

.details-modal .modal-title {
  margin-top: 12px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.details-modal .modal-header {
  padding: 20px 20px 0;
}

.details-modal .btn-close {
  position: absolute;
  top: 33px;
  right: 35px;
}

.details-modal .modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.details-modal-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.details-modal-row {
  display: flex;
  gap: 20px;
  width: 100%;
}

.details-modal-row .details-modal-field {
  flex: 1;
}

.details-modal-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.details-modal-field-label {
  font-size: 16px;
  font-weight: 400;
  color: var(--bs-body-color);
}

.details-modal-field-value {
  font-size: 14px;
  color: var(--bs-secondary-color);
}

@media (min-width: 768px) {
  .details-modal .modal-dialog {
    max-width: 100%;
    margin-left: 1.75rem;
    margin-right: 1.75rem;
  }

  .details-modal .modal-title {
    font-size: 20px;
  }

  .details-modal .modal-header {
    padding: 30px 30px 0;
  }

  .details-modal .btn-close {
    top: 43px;
    right: 45px;
  }

  .details-modal .modal-body {
    padding: 30px;
    gap: 25px;
  }

  .details-modal-fields {
    gap: 25px;
  }

  .details-modal-row {
    gap: 25px;
  }

  .details-modal-field {
    gap: 7px;
  }

  .details-modal-field-label {
    font-size: 20px;
  }

  .details-modal-field-value {
    font-size: 16px;
  }
}

@media (min-width: 1025px) {
  .details-modal .modal-dialog {
    max-width: var(--bs-modal-width);
    margin-left: auto;
    margin-right: auto;
  }
}

/* jQuery unobtrusive validation hardcodes "input-validation-error" on invalid
   inputs. Bootstrap only styles ".is-invalid", so the input would otherwise
   render with no visible error state. Mirror Bootstrap's invalid styling. */
.input-validation-error {
    border-color: var(--bs-danger) !important;
}

.input-validation-error:focus {
    border-color: var(--bs-danger);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-danger-rgb), 0.25);
}
