/* base reset */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* page foundation */

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  background: linear-gradient(180deg, #f7f9ff 0%, #e3ecff 70%);
  background-attachment: fixed;
  font-family: "Poppins", sans-serif;
  overflow-x: hidden;
}

header h1 {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

#homepageMessage {
  margin-bottom: 1rem;
}

.homepageSubtext {
  margin-bottom: 2rem;
  line-height: 1.6;
}

main {
  display: flex;
  flex: 1;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  text-align: center;
  padding: 0.75rem;
}

/* horizontal scrollable cards container */
#cardsContainer {
  display: none;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  width: 100%;
  padding: 0;
  margin: 0;
  scroll-behavior: smooth;
  flex-direction: row;
}

#cardsContainer::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

#cardsContainer > section {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  flex: 0 0 100%;
  min-width: 100%;
  max-width: 100%;
  margin: 0.75rem 1rem;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  #cardsContainer {
    overflow-x: visible;
    scroll-snap-type: none;
    flex-wrap: wrap;
    justify-content: center;
  }

  #cardsContainer > section {
    flex: 0 0 auto;
    min-width: 32rem;
    max-width: 32rem;
    margin: 1rem 1.5rem;
  }
}

section {
  background-color: white;
  padding: 1rem;
  border-radius: 0.5rem;
  width: 100%;
  min-width: 0;
}

/* reusable card style matching generator */
.card {
  padding: 1.25rem 1.25rem 1.5rem;
  margin: 2.5rem auto 3rem;
  max-width: 32rem;
  background: linear-gradient(180deg, #ffffff, #f6f8ff);
  border-radius: 1.25rem;
  box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.08);
}

/* form controls */

input {
  padding: 0.625rem;
  margin: 0.375rem 0;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 0.25rem;
}

button {
  background: #4c6fff;
  color: white;
  padding: 0.625rem 1.25rem;
  border-radius: 0.375rem;
  border: none;
  cursor: pointer;
}

button:hover {
  background: #3a56d4;
}

/* home button */

#createBallBtn {
  background: #4e6bff;
  padding: 1rem 2rem;
  border-radius: 0.625rem;
  font-size: 1.1rem;
  position: relative;
  overflow: hidden;
}

#createBallBtn:hover {
  background: #3d55d6;
}

#createBallBtn::after {
  content: "✨";
  position: absolute;
  right: 1rem;
  opacity: 0;
  transform: translateX(-0.5rem);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#createBallBtn:hover::after {
  opacity: 1;
  transform: translateX(0);
}
/* generator */

#generator {
  padding: 1.25rem 1.25rem;
  margin: 0;
  max-width: 32rem;
  background: linear-gradient(180deg, #ffffff, #f6f8ff);
  border-radius: 1.25rem;
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
  position: relative;
  z-index: 1;
}

#generator::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 1.375rem;
  background: linear-gradient(
    135deg,
    rgba(76, 111, 255, 0.2),
    rgba(76, 111, 255, 0.05)
  );
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#generator:hover::before {
  opacity: 1;
}

#saveDateBtn,
#undoBtn {
  margin: 0.5rem;
}

/* magic ball */

#magicBall {
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #666, #000);
  color: white;
  font-size: 2.25rem;
  width: 6.5rem;
  height: 6.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0.5rem auto;
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.35);
  animation: floatPulse 5s ease-in-out infinite;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#magicBall:hover {
  transform: scale(1.05);
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.4);
}

#generator > * {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

#generator > *:first-child {
  margin-top: 0;
}

#generator > *:last-child {
  margin-bottom: 0;
}

#generator #saveDateBtn,
#generator #undoBtn {
  margin: 0.25rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.85rem;
}

#magicBall.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#generateDate {
  font-weight: normal;
}

#generatedDate .date-intro {
  margin-top: 0.5rem;
  font-size: 1rem;
  font-weight: normal;
  text-align: center;
  line-height: 1.4;
}

#generatedDate .date-item {
  margin: 0.5rem 0;
  text-align: left;
  line-height: 1.6;
}

#generatedDate strong {
  font-weight: 600;
}

/* shake animation */

@keyframes shake {
  0% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-3px, 2px);
  }
  40% {
    transform: translate(3px, -2px);
  }
  60% {
    transform: translate(-3px, 2px);
  }
  80% {
    transform: translate(3px, -2px);
  }
  100% {
    transform: translate(0, 0);
  }
}

.shake {
  animation: shake 0.4s ease;
}

/* gentle idle float 

@keyframes idleFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}
  */

@keyframes floatPulse {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.35);
  }
  50% {
    transform: translateY(-0.6rem) scale(1.05);
    box-shadow: 0 1.25rem 2.75rem rgba(0, 0, 0, 0.45);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.35);
  }
}

@keyframes softPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

#createBallBtn {
  animation: softPulse 3s ease-in-out infinite;
}

#generator:not(.shake) {
  animation: idleFloat 6s ease-in-out infinite;
}

/* calm UX adjustments */

button:not(#saveDateBtn) {
  background: transparent;
  color: #4c6fff;
  border: 1px solid rgba(76, 111, 255, 0.4);
}

button:not(#saveDateBtn):hover {
  background: rgba(76, 111, 255, 0.08);
}

#setup h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

#setup p {
  color: #666;
  max-width: 26.25rem;
  margin: 0 auto 1rem;
}

/* options card */
#optionsCard {
  padding: 1.25rem 1.25rem;
  margin: 0;
  max-width: 32rem;
  background: linear-gradient(180deg, #ffffff, #f6f8ff);
  border-radius: 1.25rem;
  box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

#optionsCard > *:last-child {
  margin-bottom: 0;
}

#optionsCard h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  text-align: center;
}

#optionsCard > p {
  color: #666;
  margin-bottom: 1rem;
  text-align: center;
  font-size: 0.9rem;
}

/* options layout */

.option-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.option-row > input {
  flex: 1 1 0%;
  min-width: 0;
}

.option-row > button {
  flex: 0 0 auto;
}

.option-row > ul {
  width: 100%;
  margin-top: 0.5rem;
  padding-left: 0;
  list-style: none;
}

.option-row > ul > li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
}

/* suggestions card */
#suggestionsCard {
  padding: 2rem 1.5rem;
  margin: 0;
  max-width: 32rem;
  background: linear-gradient(180deg, #ffffff, #f6f8ff);
  border-radius: 1.25rem;
  box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  min-height: auto;
}

.suggestion-hidden {
  display: none;
}

.suggestion-group.expanded .suggestion-hidden {
  display: list-item;
}

.expand-category-btn {
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  background: rgba(76, 111, 255, 0.1);
  color: #4c6fff;
  border: 1px solid rgba(76, 111, 255, 0.3);
  cursor: pointer;
  border-radius: 0.375rem;
  transition: background-color 0.2s ease;
}

.expand-category-btn:hover {
  background: rgba(76, 111, 255, 0.15);
}

#suggestionsCard h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
}

#suggestionsCard > p {
  margin-bottom: 1rem;
  color: #666;
  font-size: 0.9rem;
  text-align: center;
}

#suggestionsCard .suggestions-content {
  text-align: left;
  padding: 0;
  overflow-y: visible;
}

#suggestionsCard .suggestion-group {
  margin-bottom: 1.5rem;
}

#suggestionsCard .suggestion-list {
  max-height: 12rem;
  overflow-y: auto;
  transition: max-height 0.3s ease;
}

.suggestion-group.expanded .suggestion-list {
  max-height: none;
}

@media (min-width: 601px) {
  #suggestionsCard .suggestion-group {
    display: inline-block;
    width: 32%;
    vertical-align: top;
    margin-bottom: 0;
  }
}

#suggestionsCard .suggestion-group h4 {
  font-weight: 600;
  font-size: 1rem;
  margin: 0.5rem 0 0.25rem;
}

#suggestionsCard .suggestion-group ul {
  padding-left: 1.125rem;
  list-style: none;
}

#suggestionsCard li {
  cursor: pointer;
  padding: 0.5rem 0.625rem;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  transition: background-color 0.2s ease, font-weight 0.2s ease;
}

#suggestionsCard li:hover {
  background-color: rgba(76, 111, 255, 0.1);
}

#suggestionsCard li.selected {
  background-color: rgba(80, 130, 255, 0.2);
  font-weight: 600;
}

#suggestionsCard li.selected::after {
  content: " ✓";
}

/* databank card */

#databank {
  padding: 1.25rem 1.25rem;
  margin: 0;
  max-width: 32rem;
  background: linear-gradient(180deg, #ffffff, #f6f8ff);
  border-radius: 1.25rem;
  box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

#databank > *:last-child {
  margin-bottom: 0;
}

#databank h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  text-align: center;
}

.databank-help {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 1rem;
  text-align: center;
}

/* this will need to be refactored since it doesn't fit the organizational structure of the rest of the stylesheet */
.instructionsSubtext {
  margin: 0.5rem 0 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #666;
  opacity: 0.9;
}

.databank-group {
  margin-bottom: 0.75rem;
}

.databank-group h4 {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

#databank ul {
  padding-left: 1.125rem;
}

#databank li {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.remove-item {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem 0.5rem;
}

.remove-item:hover {
  color: #d33;
}

/* share area */

#share {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  margin: 1rem 0;
}

#share button {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
}

/* completed dates card */

#completed {
  padding: 1.25rem 1.25rem;
  margin: 0;
  max-width: 32rem;
  background: linear-gradient(180deg, #ffffff, #f6f8ff);
  border-radius: 1.25rem;
  box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

#completed > *:last-child {
  margin-bottom: 0;
}

/* share card */
#shareCard {
  padding: 1.25rem 1.25rem;
  margin: 0;
  max-width: 32rem;
  background: linear-gradient(180deg, #ffffff, #f6f8ff);
  border-radius: 1.25rem;
  box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

#shareCard > *:last-child {
  margin-bottom: 0;
}

#shareCard h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  text-align: center;
}

#shareCard button {
  display: block;
  width: 100%;
  margin: 0.375rem 0;
  padding: 0.5rem 0.875rem;
  font-size: 0.9rem;
}

#shareCard .share-status {
  margin: 0.5rem 0;
  min-height: 1.5rem;
  color: #666;
  font-size: 0.85rem;
}

#completed h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-align: center;
}

#completedDatesList {
  list-style-type: none;
  padding-left: 0;
  text-align: left;
}

#completedDatesList li {
  margin: 0.5rem 0;
  padding: 0.75rem;
  background-color: #f0f0f0;
  border-radius: 0.375rem;
  font-size: 0.95rem;
}

/* responsive - mobile first approach */

/* Mobile styles (default, applies to all screens below 768px) */
@media (max-width: 767px) {
  body {
    padding: 0.75rem 0.75rem;
  }

  header h1 {
    margin-bottom: 0.75rem;
    font-size: 1.4rem;
  }

  main {
    padding: 0.5rem;
    gap: 0.75rem;
  }

  #cardsContainer {
    align-items: flex-start;
  }

  #cardsContainer > section {
    margin: 0.5rem 0.75rem;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  #cardsContainer > section > * {
    height: auto;
  }

  #magicBall {
    height: 6.5rem !important;
    width: 6.5rem !important;
  }

  #generator {
    padding: 1.25rem 1rem;
  }

  #optionsCard,
  #databank,
  #completed,
  #shareCard {
    padding: 1rem 1rem;
  }

  #generator > * {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
  }

  #suggestionsCard {
    padding: 1.5rem 1.25rem;
    min-height: 0;
  }

  #appFooter {
    margin-top: 0.5rem;
    padding: 0.5rem 0 0.25rem;
  }
}

/* Desktop styles (768px and above) */
@media (min-width: 768px) {
  main {
    max-width: 37.5rem;
    margin: 0 auto;
  }

  #cardsContainer > section {
    margin: 1rem 1.5rem;
  }

  #magicBall {
    font-size: 3rem;
    width: 8rem;
    height: 8rem;
  }

  #appFooter {
    margin-top: 1.5rem;
  }
}

/* special loading themes */

#holidaySplash {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #630000, #3b0404);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  z-index: 2000;
  transform: translateX(0);
  opacity: 1;
  will-change: transform, opacity;
}

#holidaySplash h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

#holidaySplash p {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* footer */

#appFooter {
  margin-top: 1.5rem;
  padding: 0.75rem 0 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: #999;
  opacity: 0.7;
}

#appFooter a {
  color: #999;
  text-decoration: none;
}

#appFooter a:hover {
  text-decoration: underline;
  color: #4c6fff;
}

/* Suggestions card layout adjustments */
@media (max-width: 600px) {
  #suggestionsCard .suggestion-group {
    display: block;
    width: 100%;
    margin-bottom: 1.5rem;
  }
}
