/* bootstrap alert CSS, translated to the django-standard levels
of debug, info, success, warning, error
 */

.alert-debug {
  background-color: #fff;
  border-color: #d6e9c6;
  color: #000;
}

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

.no-decoration {
  text-decoration: none !important;
}

/*center the logo in mobile*/
a.navbar-brand img {
  margin: auto !important;
}

/* header */
.navbar-header {
  margin: 0 auto;
}

/* remove some spacing between the logo and Nav */
a.navbar-brand {
  margin: auto;
}

.navbar-brand img {
  width: 140px;
}

/* toggler to change to 'x' when hamburger menu shown: https://stackoverflow.com/a/59214165/2469390 */
.navbar-toggler.collapsed .close-icon {
  display: none;
}

/* hack needed to keep the logo from shifting as the 'x' is smaller*/
.navbar-toggler {
  width: 2.75em;
}

.navbar-toggler:not(.collapsed) .navbar-toggler-icon {
  display: inline;
}

/* remove border/outline https://stackoverflow.com/a/51563589/2469390 */
.navbar-toggler:focus,
.navbar-toggler:active,
.navbar-toggler-icon:focus {
  outline: none;
  -webkit-box-shadow: none;
  box-shadow: none;
}

/* forms */
/*add some space above the submit button*/
input.btn-primary {
  margin-top: 0.5em;
}

/* sticky submit button */
.sticky-button {
  position: sticky;
  bottom: 0;
  background-color: white;
  padding: 10px;
  z-index: 1000;
}

/* hide the asterisk for reuired fields (django-crispy-forms) */
.asteriskField {
  display: none;
}

.form-group {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

input.numberinput {
  max-width: 6em;
}

input.textinput, input.datetimepickerinput, select.select {
  max-width: 20em;
}

small {
  font-size: 90%;
}

.warn-orange {
  color: rgb(187, 136, 39);
}

/* email input is too wide compared to text inputs */
.emailinput {
  max-width: 320px;
}

/* ALERTS LIST */
.sticky-section-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: white;
  border-bottom: 1px solid #dee2e6;
}

.sticky-section-header + .row {
  margin-top: 1rem;
}

/* SHIPMENTS LIST */

/* sticky header */
#shipments-list-headers {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #f8f9fa; /* Ensure it's visually distinct when scrolling */
}


/* the table cell originally hidden, which expands  - needs important or shows padding*/
.expansion-cell {
  padding: 0 !important;
}

/* shipments list filters */
fieldset legend.form-label {
  font-size: 1em;
}

/* try to hide expansion-cell on landscape phone orientation */
.expansion-cell-content {
  padding: 0.75em;
}

.accordion div.row div.col {
  padding: 8px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
}

/* remove the bottom border on the chevron upon expansion */
.accordion-button:not(.collapsed) {
  border: none;
  background-color: inherit;
  -webkit-box-shadow: none;
  box-shadow: none;
  color: black !important;
}

.accordion-button:not(.collapsed)::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

/* custom checkbox styling: https://moderncss.dev/pure-css-custom-checkbox-style/ */
input[type=checkbox].shipments-list {
  margin: auto !important;
}

/* shipment filter form */
/* radio legends are too large */
fieldset legend {
  font-size: 1rem;
}

/* toggle switches */
.visually-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* to center accordion button chevron char */
.accordion-button::after {
  margin-left: 40%;
  color: green !important;
}

/* needed for mobile - too much padding by default */
.accordion-button {
  padding: 0 !important;
}

/* password input width (changed with bootstrap 5) */
.passwordinput {
  max-width: 20em;
}


/* rows */
.striped-row:nth-child(odd) {
  background-color: #ffffff; /* White background for odd rows */
}

.striped-row:nth-child(even) {
  background-color: #f2f2f2; /* Light gray background for even rows */
}

/* tooltips */
.dashed-underline {
  border-bottom: 1px dashed #000;
  cursor: help;
}

/* progress/spinnners */
.spinner-border {
  margin-right: 5px;
}

.btn:disabled {
  cursor: not-allowed;
}

#toasts {
  /* Increase z-index to be higher than other elements */
  z-index: 12000;
  /* Position it above everything */
  position: fixed;
}


/* top of page loader
 https://old.reddit.com/r/htmx/comments/1blwnc4/tip_of_the_day_unobtrusive_global_loading/
 */
.loading-bar {
  opacity: 0;
  position: fixed;
  /* required to overlay the sticky headers */
  z-index: 20;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent,
    var(--bs-primary),
    transparent
  );
  /* transition for smoother opacity changes */
  transition: opacity 0.2s ease-out;
}

/* Show and animate when HTMX request is in progress */
.htmx-request.loading-bar {
  opacity: 1;
  animation: slide 0.8s ease-in-out infinite; /* Controls sliding animation */
  animation-delay: 0.5s; /* Delay before animation starts */
  /* Use transition-delay for the opacity change */
  transition-delay: 0.5s;
}

@keyframes slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* alpinejs */
[x-cloak] { display: none !important; }

/*carrier dropdown selection*/

/* Rotate chevron when expanded */
[aria-expanded="true"] .fa-chevron-down {
  transform: rotate(180deg);
}

.fa-chevron-down {
  transition: transform 0.2s ease-in-out;
}

/* Store Filter Dropdown */
:root {
  --store-dropdown-width: 280px;
  --store-dropdown-z-index: 1050;
  --border-color-light: #dee2e6;
}

.store-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: var(--store-dropdown-width);
  z-index: var(--store-dropdown-z-index);
  overflow-y: auto;
  border: 1px solid var(--border-color-light);
  border-top: none;
  background-color: white;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  border-radius: 0 0 0.375rem 0.375rem;
}

.store-dropdown-button {
  width: var(--store-dropdown-width);
}

/* Notes feature */
.notes-editor {
  animation: fadeIn 0.15s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notes-editor textarea {
  resize: vertical;
  min-height: 80px;
}

.notes-editor textarea:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

.notes-icon-button {
  line-height: 1;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.notes-icon-empty,
.notes-icon-empty .fa-pen-to-square {
  color: var(--bs-secondary-color, #adb5bd) !important;
  opacity: 0.55;
}

.notes-icon-filled,
.notes-icon-filled .fa-pen-to-square {
  color: var(--bs-primary) !important;
  opacity: 1;
}

.notes-icon-button:hover,
.notes-icon-button:focus,
.notes-icon-button:active {
  text-decoration: none;
  opacity: 0.9;
}
