@keyframes fadeHighlight {
  0% {
    background-color: transparent;
  }
  50% {
    background-color: #f9f3be; /* soft yellow  #fdf6b2; /* soft yellow */
  }  
  100% {
    background-color: transparent;
  }
  
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-100%); }
  to { opacity: 1; transform: translateX(0); }
}

.slide-in {
 /* animation: slideIn 0.5s ease-out forwards;*/
  animation: slideIn 1s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

body {
  position: relative;
  display: flex;
  align-items: center;
  flex-direction: column;
  height: 200vh;
  background: linear-gradient(130deg, rgb(239, 231, 223), rgb(229, 223, 214));
  color: rgba(127, 104, 33, 0.996);
}

#sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 160px;
  min-height: 100vh;
  background-color: #f4f4f4;  
  padding: 12px;
  box-shadow: 1px 0 5px rgba(0,0,0,0.1);  
  display: flex;
  flex-direction: column;  
  gap: 10px;
  /*z-index: 700;*/
}

.main, #headerEl, #estimated-total {
  padding-left: 180px;
}


.input-container {
  display: flex;
  justify-content: center;
  gap: 10px; /* spacing between fields */
  border: solid 1px rgb(141, 128, 96);
  border-bottom: none;
  flex-wrap: wrap;
  /*height: 65px;*/
  width: 820px;
  padding-top: 9px;
  padding-bottom: 12px;
  margin-top: 10px;
  
}

.field {
  font-weight: bold;
  font-size: 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.grocery-input {
  font-size: 17px;
  height: 23px;
}
#item {
  width: 200px;  
}
#price {
  width: 80px
}
#store {
  height: 29px;
  width: 130px;
}
#aisle { 
  width: 90px;
}
#group { 
  width: 195px;
}
.add-btn-container {
  display: flex;
  justify-content: center;
  border: solid 1px rgb(141, 128, 96);
  border-top: none;
  height: 60px;
  width: 820px;
  padding-top: 6px;
  padding-bottom: 8px;
}
#add-item-btn {  
  margin-top: 1px;
  height: 45px;
  width: 220px;
  cursor: pointer;  
  font-size: 20px;
  background: linear-gradient(rgb(226, 218, 218), rgb(187, 184, 164));
  border: solid 2px rgba(127, 104, 33, 0.996);
}
#add-item-btn:hover {
  background: linear-gradient(rgb(242, 236, 236), rgb(212, 209, 191));
  color:rgb(75, 74, 61)  
}
#add-item-btn:active {
  scale: 98.7%;
}

#display-list {
  border: solid 1px rgb(141, 128, 96);
  min-height: 80vh;
  max-height: 180vh; 
  width: 820px;
  padding-top: 9px;
  margin-top: 10px;
}

span.icon {
  font-family: 'Amatic SC', 'Comic Sans MS', sans-serif;
  font-weight: bold; 
  display:inline-block; 
  transition: transform 0.2s ease, color 0.2s ease;
}

span.icon:hover { /* transforms size of hide/show and delete icons */
  transform: scale(1.4);
 color: rgb(83, 5, 125);
}

p:hover {
  cursor: pointer;
  background-color: #f0efe5; /* soft yellow */
 /*font-weight: bold;*/
}

p.highlight {
  background-color: #fdf6b2; /* soft yellow */
  animation: fadeHighlight 2s ease forwards;
}

h3 {
  border-bottom: 1px solid #ccc;
  margin-top: 15px;
  font-weight: bold;
  color: #333;
}

#display-list > p {
  margin-left: 16px; /* slight indent */
}

@keyframes bounceIn {
  0% {
    transform: translateX(-100%);
    animation-timing-function: ease-in;
  }
  60% {
    transform: translateX(30px);
    animation-timing-function: ease-out;
  }
  80% {
    transform: translateX(-10px);
    animation-timing-function: ease-in;
  }
  100% {
    transform: translateX(0);
    animation-timing-function: ease-out;
  }
}

.bounce-in {
  animation: bounceIn 0.8s forwards;
}

.price-wrapper {
  position: relative;
}

.currency-symbol {
  position: absolute;
  left: 7px;
  top: 35px;
  transform: translateY(-50%);
  color: #555;
  font-size: 1rem;
  pointer-events: none;
}

.price-wrapper input[type="number"] {
  padding-top: 1px;
  padding-left: 18px; /* Make room for the dollar sign */
  -moz-appearance: textfield; /* Firefox */
}

/*gets rid of up and down arrows for the price input box */
.price-wrapper input::-webkit-outer-spin-button,
.price-wrapper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

@keyframes slideFadeIn {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.quantity-input {
 
   padding-left: 32px; /* Make room for the label */
 /* padding-right: 50px;*/
  height: 1rem;
  font-size: 1rem;
  animation: slideFadeIn 400ms ease-out;
}

.input-wrapper {
  position: relative;
  display: inline-block;
}

.qty-label {
  position: absolute;
  opacity: 70%;
  left: 12px;
  top: 10px;
  transform: translateY(-50%);
  font-size: 0.9rem;
  font-family:'Times New Roman', Times, serif;
  color: #666;
  pointer-events: none;
}

#sidebar button {
  padding: 8px;
  cursor: pointer;
  font-size: 18px;
}

#view-trash-items {
  margin-bottom: 25px;
}

#deselect-all {
  margin-bottom: 25px;
}


.fade-out {
  animation: fadeOut 0.6s ease forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}


.flip-toggle {
  transition: transform 0.5s ease;
  transform-style: preserve-3d;
  backface-visibility: hidden;

}
.flip-toggle.flipped {
  transform: rotateY(90deg);
}

.list-item-wrapper {
  perspective: 800px;
}

.icon:hover {
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
  100% { filter: brightness(1); }
}


.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.modal.hidden {
  display: none;
}

@keyframes bounceInTop {
  0% {
    transform: translateY(-100vh);
    opacity: 0;
  }
  60% {
    transform: translateY(30px);
    opacity: 1;
  }
  80% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0);
  }
}

.modal-content, .bounce-in-top {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  animation: bounceInTop 0.6s ease-out;
  min-width: 150px;
  max-width: 400px;
}

.modal-content label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.modal-content label input {
  width: 93%;
  padding: 6px 8px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
}

.modal-content h2 {
  border-bottom: 1px solid #ccc;
  margin: 20px 0 50px 0;
  font-weight: bold;
}

.modal-actions {
  margin-top: 20px;
}


@media print {
  
  .shopping-checkbox, .icon, 
  .input-container, #sidebar,
  .add-btn-container, .qty-label {
    visibility: hidden;
  }
  
  #headerEl {
    margin: 0;
    padding: 0;
    color: black;
    font-size: 20px;
  }

  #estimated-total {
    margin: 0 auto 100px auto;
    padding: 0;
  }

  .aisleH3:first-of-type {
    padding-top: 23px;   
  }

  .aisleH3:not(:first-of-type) {
    margin-top: -11px;
    padding: 0;
  }

  .input-wrapper {
    margin-left: -40px;
  }

  .list-item {
    margin-top: -11px;
  }
  
  .quantity-input { 
    padding-left: 2px; /* Make room for the label */   
    font-size: 0.9rem;  
    border: none; 
    text-align: right; 
  }

  #printable-list, #printable-list * {
    visibility: visible;
  }

  #display-list {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 1rem;
    font-size: 12pt;
    line-height: 1.0;
    border: none;
    color: black;
  }

  .hidden-for-screen {
    display: block;
  }
}

.hidden-for-screen, .hidden {
  display: none;
}

.delete-all-btn {
  margin: 5px 10px;
  background-color: #c0392b;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.delete-all-btn:hover {
  background-color: #d36053;
}

@keyframes explode {
  0% {
    transform-origin: top right; 
    transform: scale(1);
    opacity: 1;
   
  }
  50% {
    transform-origin: center center; 
    transform: scale(1.5) rotate(-10deg);
    opacity: 0.5;
   
  }
  100% {
    transform-origin: top left; 
    transform: scale(2.8) rotate(-20deg);
    opacity: 0;
  
  }
}

.explode {
  animation: explode 1000ms ease-out forwards;
}

#search-modal {
  position: absolute;
  top: 320px; /* adjust based on your layout */
  margin: 0 auto;
  right: 0;
  left: 637px;
  /*
  right: 65px;*/
  width: 300px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  padding: 1rem;
  z-index: 100;
}

.search-hidden {  
  opacity: 0;
  pointer-events: none;
}

.search-visible {
  opacity: 1;
  pointer-events: auto;
}

#search-results {
  margin-top: 10px;
  list-style: none;
  padding: 0;
}

#search-results li {
  padding: 6px 10px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 200ms ease;
}

#search-results li:hover {
  background: #f0f0f0;
}

/*makes side bar move to the top for smaller screens*/
@media (max-width: 1040px) {

  #sidebar {
  display: flex;
  flex-direction: row;
  justify-content: center;
  flex-wrap: wrap;
  column-gap: 10px;
  row-gap: 5px;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 10px; /* ensures it doesn’t collapse */
  max-height: 10vh; /* prevents it from taking over the screen */
  padding: 10px 0;
  border-bottom: 1px solid #3c3333;
  background: linear-gradient(-70deg, #6b6161, rgb(147, 145, 129));
  /*background: linear-gradient(rgb(226, 218, 218), rgb(187, 184, 164));*/
  overflow: auto; /* allows scrolling if buttons overflow */
  z-index: 800;
  }

  #sidebar button {
    margin-top: 7px;
  padding: 5px;
  width: 100px;
  height: 40px;
  cursor: pointer;
  font-size: 14px;
  
  background: linear-gradient(rgb(226, 218, 218), rgb(187, 184, 164));
  border: solid 2px rgba(127, 104, 33, 0.996);
  }

  #sidebar button:hover {
  background: linear-gradient(rgb(242, 236, 236), rgb(212, 209, 191));
  color:rgb(75, 74, 61)  
  }
  #sidebar button:active {
    scale: 98.7%;
  }

  .main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px;    
  }

  #headerEl {
    padding-top: 140px;
    padding-left: 0;
    margin: 5px auto;
  }

  #estimated-total {
    padding-left: 0;
    margin: 5px auto;
  }
    
  #display-list, .input-container, .add-btn-container {
    width: 90vw;
  }

  .input-container {
    flex-wrap: wrap;
    min-height: 65px;
    max-height: 195px;
    padding-bottom: 0;
  }

  #search-modal {

    position: absolute;
    top: 500px; /* adjust based on your layout */
    margin: 0 auto;
    left: 0;
    right: 0;
    width: 300px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    padding: 1rem;
    z-index: 100;
  }
}