/* OVERALL */
@import url("https://fonts.googleapis.com/css?family=Roboto");

:root {
  --max-width: 1280px;
  --recipe-ingredient-search-width: 225px;
  --lighter-gray: #e8e8e8;
  --warning-orange: #ffd383;
  --warning-light-orange: #ffebc5;
  --warning-red: #ff9c9c;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Roboto", sans-serif;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a,
a:visited {
  color: inherit;
  cursor: pointer;
}

#content-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1.5rem;
  flex: 1 0 auto;
}

#content {
  max-width: var(--max-width);
  width: 100%;
  padding: 1em;
}

textarea {
  font-family: "Roboto", sans-serif;
  line-height: 1.4;
  resize: none;
}

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

/* HTMX */
.htmx-indicator{
  display: none;
  opacity:0;
  transition: opacity 500ms ease-in;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: block;
  opacity:1
}


/* HEADER */
.dev-bar {
  width: 100%;
  background-color: rgb(162, 255, 22);
  display: flex;
  justify-content: center;
  padding: 3px;
  font-weight: bold;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 10;
  opacity: 0.6;
}

header {
  display: flex;
  justify-content: center;
  background-color: #333;
  color: #fff;
  padding: 1em;
  text-align: left;
}

.main-header .nav-wrap {
  width: 100%;
  max-width: var(--max-width);
}

.main-header .site-title {
  margin: 0;
  display: inline;
}

.main-header nav {
  display: flex;
  align-items: center;
}

.main-header ul {
  margin: 0;
  display: flex;
  align-items: center;
}

.main-header li {
  display: inline;
  margin-right: 1em;
}

.main-header .user-info {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.main-header a {
  color: #fff;
  text-decoration: none;
}

.main-header .logout-link {
  color: black;
  box-shadow: none;
}
/* FOOTER */
footer {
  background-color: #333;
  color: #fff;
  padding: 1em;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

/***********************/
/* SITE-WIDE REUSABLES */
/***********************/

/* CLEAN NUMBER INPUT */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
  text-align: right;
  width: 50px;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* FULL PAGE LOADING */
.full-page-loading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 40px;
  padding: 40px;
}

.full-page-loading-text {
  font-size: 2em;
}

/* FULL PAGE SAVING */
.full-page-saving-overlay {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  background-color: rgba(0, 0, 0, 0.5);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
}

.full-page-saving-content {
  background-color: white;
  display: flex;
  flex-direction: column;
  gap: 20px;
  justify-content: center;
  padding: 20px;
  border-radius: 5px;
  font-size: 2em;
}

/* PURE CSS SPINNER */
.spinner {
  border: 9px solid #f3f3f3;
  border-top: 9px solid #333;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  animation: spin 1.5s linear infinite;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: auto;
}

.spinner.spinner-small {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  border-width: 4px !important;
  border-top-width: 4px !important;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* SHORT NUMBER INPUT */
input[type="number"].short-number {
  width: 30px;
}

/* WARNING */
.warning {
  display: flex;
  gap: 8px;
  border-radius: 5px;
  padding: 3px 7px;
  background-color: var(--warning-orange);
  align-items: center;
  width: fit-content;
}

/* AUTH PAGES (login, password reset) */
.auth-body {
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 22rem;
}

.auth-brand {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
}

.auth-card h1 {
  font-size: 1.25rem;
  margin: 0 0 0.75rem;
}

.auth-help {
  color: #555;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}

.auth-form label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
  box-sizing: border-box;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.4rem 0.5rem;
  width: 100%;
}

.auth-form .helptext,
.auth-form ul {
  color: #555;
  font-size: 0.8rem;
  line-height: 1.4;
  padding-left: 1.1rem;
}

.auth-form .errorlist {
  color: #b00020;
  list-style: none;
  padding-left: 0;
}

.auth-links {
  font-size: 0.9rem;
  margin-top: 1.25rem;
}

/* BUTTONS */
.btn {
  background-color: #000000;
  color: #fff;
  font-size: 16px;
  padding: 5px 14px;
  border: none;
  border-radius: 5px;
  box-shadow: 2px 2px 6px gray;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  height: fit-content;
  width: fit-content;
}

.btn:hover {
  text-decoration: underline;
}

.btn-alt {
  background-color: #fff;
  color: #000000;
  border: 1px solid #000000;
}

.btn-action {
  background-color: #fff;
  color: black;
  font-size: 0.9rem;
  border: 1px solid black;
  padding: 2px 10px;
  flex-shrink: 0;
  box-shadow: none;
}

.btn-large {
  font-size: 24px;
  padding: 7px 18px;
}

.btn-save {
  color: black;
  background-color: #51db67;
  box-shadow: 3px 3px 8px gray;
}

.btn-link {
  text-decoration: underline;
  cursor: pointer;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}


/* Add caret next to collapsible h tag */
.collapsible {
  cursor: pointer;
}

.collapsible::after {
  content: "\25B2";
  display: inline-block;
  margin-left: 5px;
}

.collapsible.collapsed::after {
  content: "\25BC";
}

/* COMBOBOX */
/* I believe the width is set to 0 so that clicks don't register on the summary element but I can't recall */
.combobox summary {
  padding: 0;
  border: 0;
  list-style: none;
  width: 0;
}

.combobox summary::after {
  display: none;
}

.combobox .combobox-results {
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid #000;
  padding: 0;
  margin: 0;
  background-color: white;
}

.combobox .combobox-result {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: stretch;
  border: 1px solid #000;
  width: 100%;
  height: 30px;
  margin: 0;
  padding: 0;
  cursor: pointer;
  padding-left: 10px;
  box-sizing: border-box;
}

/* SIMPLE CUSTOM SELECT */
.alpine-select-wrap {
  position: relative;
  align-self: flex-start;
  width: 100%;
  height: 100%;

  .alpine-select {
    display: flex;
    flex-direction: column;
    position: absolute;
    box-shadow: -1px -1px 8px 2px;
  
    .alpine-option {
      display: flex;
      align-items: center;
      background-color: white;
      padding: 5px 10px;
      border: 1px solid #000;
      cursor: pointer;
  
      &.selected {
        background-color: #51db67;
      }
    }
}
}

.modal-open {
  overflow: hidden;
}

svg {
  display: block;
}

.modal-backdrop {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.modal-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 80%;
  max-width: var(--max-width);
  box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.5);
  margin: 50px 0;
}

.modal-header {
  width: 100%;
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  background-color: #51db67;
  color: white;
  padding: 10px;
  box-sizing: border-box;
}

.modal-content {
  width: 100%;
  background-color: white;
  padding: 20px;
  box-sizing: border-box;
}

/* OBJECT DETAIL PAGE (Recipe, Ingredient, Pacakging, Menus) REUSABLES */
.object-detail-page .main-form-header {
  display: flex;
  align-items: center;
  padding: 16px 0;
}

.object-detail-page .name {
  font-size: 2em;
}

.object-detail-page .formset-wrap {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: flex-start;
}

.object-detail-page .formset-form-wrap {
  background-color: var(--lighter-gray);
  padding: 5px;
}

.object-detail-page .formset-empty-form {
  display: none;
}

.object-detail-page .delete-formset-form {
  cursor: pointer;
}

.object-detail-page .unit-conversion-input {
  width: 38px;
}

.object-detail-page section {
  padding: 20px;
  border-top: solid 1px #000000;
}

.object-detail-page .btn-add-formset-form {
  display: flex;
  align-items: center;
}

.object-detail-page .btn-add-formset-form::before {
  content: "+";
  font-size: 1.5em;
  font-weight: bold;
  margin-right: 10px;
  padding-bottom: 3px;
}

.object-detail-page .top-save-wrap {
  margin-left: auto;
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  align-items: center;
}

.object-detail-page .bottom-save-wrap {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: flex-end;
}

.object-detail-page .bottom-delete-wrap {
  float: right;
}

.hide-spinner {
  display: none;
}

/* Session expiry bar. Fixed to the top rather than a modal so the unsaved work the
   message is promising to keep stays visible behind it. */
.session-expired-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 12px 20px;
  background-color: #7a2e2e;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.session-expired-banner[hidden] {
  display: none;
}

.session-expired-message {
  font-weight: 600;
}

/* Snacks sit below the add-ons inside the Snacks and Add-ons column. The rows carry the .add-on-row
   classes as well, so they pick up the quantity controls and the hover-revealed trash icon that
   clients.css and fulfillment.css each define for their own page family. */
.snacks-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px dotted #999;
  padding-top: 5px;
}

.snack-row .snack-name {
  flex-grow: 1;
  /* Lets the name give way to the day picker instead of squeezing it. */
  min-width: 0;
}

.snack-row .snack-weekday {
  display: flex;
  align-items: center;
  min-height: 20px;
  /* No fixed width on the select below, and none here either: a select sizes itself to its widest
     option plus whatever the browser gives the arrow, and that allowance differs between browsers.
     A width tuned to one of them clipped "no specific day" in Firefox. */
  flex-shrink: 0;
}

.snack-row .snack-weekday__btn {
  display: flex;
  cursor: pointer;
}

.new-snack-row {
  display: flex;
  width: 100%;
  justify-content: center;
}

/* The snack totals sit under the add-on totals in the summary row, the same way the snack rows sit
   under the add-on rows in the column they are counting. */
.snacks-summary {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px dotted #999;
  margin-top: 5px;
  padding-top: 5px;
}

.snacks-summary__header {
  font-weight: bold;
}
