/* File: assets/css/components.css */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 30px;
  border-radius: 999px; /* Pill shape */
  font-family: inherit;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  border: none; /* Reset border */
  box-shadow: 0 4px 0 0 rgba(0, 0, 0, 0.15);
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 0 0 rgba(0, 0, 0, 0.15);
  filter: saturate(105%);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.15);
}

.btn:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--primary-color), white 20%);
  outline-offset: 2px;
}

/* Button Variants */
.btn-primary {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 0 0 color-mix(in oklab, var(--primary-color), black 20%);
}
.btn-primary:hover {
  box-shadow: 0 6px 0 0 color-mix(in oklab, var(--primary-color), black 20%);
}
.btn-primary:active {
  box-shadow: 0 2px 0 0 color-mix(in oklab, var(--primary-color), black 20%);
}

.btn-secondary {
  background-color: #78909c;
  color: white;
  box-shadow: 0 4px 0 0 #546e7a;
}
.btn-secondary:hover {
  box-shadow: 0 6px 0 0 #546e7a;
}
.btn-secondary:active {
  box-shadow: 0 2px 0 0 #546e7a;
}

.btn-light:hover {
  background-color: var(--secondary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(255, 193, 7, 0.4);
}

/* Wavy Dividers */
.wavy-divider {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  line-height: 0;
  transform: rotate(180deg);
}
.wavy-divider.top {
  top: 0;
  bottom: auto;
  transform: rotate(180deg);
}
.wavy-divider svg {
  position: relative;
  display: block;
  width: calc(100% + 1.3px);
  height: 120px;
}

/* Section Titles */
.section-title {
  text-align: center;
  margin-bottom: 50px;
}
.section-title span {
  color: var(--secondary-color);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 14px;
}
.section-title h2 {
  font-size: 2.5rem;
  font-weight: 900;
  margin: 10px 0 0 0;
  color: var(--font-color);
}
@media (max-width: 768px) {
  .section-title h2 {
    font-size: 2.2rem;
  }
}

.btn-warning {
  background-color: var(--secondary-color);
  color: #3b2f00;
  box-shadow: 0 4px 0 0 #d3a008;
}
.btn-warning:hover {
  box-shadow: 0 6px 0 0 #d3a008;
}
.btn-warning:active {
  box-shadow: 0 2px 0 0 #d3a008;
}

.btn-accent {
  background-color: var(--accent-color);
  color: white;
  box-shadow: 0 4px 0 0 #e27050;
}
.btn-accent:hover {
  box-shadow: 0 6px 0 0 #e27050;
}
.btn-accent:active {
  box-shadow: 0 2px 0 0 #e27050;
}

.btn-light {
  background-color: var(--light-bg);
  color: var(--font-color);
  box-shadow: 0 4px 0 0 #bcaaa4;
}
.btn-light:hover {
  box-shadow: 0 6px 0 0 #bcaaa4;
}
.btn-light:active {
  box-shadow: 0 2px 0 0 #bcaaa4;
}

/* Floating Action Button (FAB) */
.btn-fab {
  position: fixed;
  right: clamp(12px, 3vw, 20px);
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 9;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 28px;
  padding: 0;
  background-color: var(--accent-color);
  color: #fff;
  box-shadow: var(--shadow);
}
@media (max-width: 480px) {
  .btn-fab {
    width: 58px;
    height: 58px;
    font-size: 26px;
    right: 12px;
  }
}

/* --- Form Controls --- */
select {
  appearance: none;
  border: 2px solid var(--border-color);
  border-radius: 999px;
  background: var(--surface-color);
  font: inherit;
  font-weight: 700;
  color: var(--font-color);
  padding: 12px 18px;
  padding-right: 40px;
  min-height: 44px;
  box-shadow: 0 4px 0 0 #bcaaa4;
  transition:
    transform 0.1s,
    box-shadow 0.1s,
    background 0.2s,
    border-color 0.2s;
  width: 100%;
}
select:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--primary-color), white 20%);
  outline-offset: 2px;
}

/* --- Modals / Cards --- */
.card {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
}
@media (max-width: 480px) {
  .card {
    padding: 14px;
  }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-content {
  background: var(--surface-color);
  padding: 28px;
  border-radius: 22px;
  text-align: center;
  border: 5px solid var(--secondary-color);
  box-shadow: 0 10px 0 0 #d3a008;
  animation: fadeIn 0.45s ease;
  max-width: min(90vw, 420px);
}
.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* TTS Toast / Subtitles */
#tts-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 12px 24px;
  border-radius: 16px; /* Better than 999px for multiline text */
  font-weight: bold;
  font-size: 1.1rem;
  z-index: 10000;
  text-align: center;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  max-width: 90vw;
  border: 2px solid rgba(255, 255, 255, 0.2);
  line-height: 1.4;
}

#tts-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 768px) {
  #tts-toast {
    bottom: auto;
    top: 40px; /* Show near the top on mobile to avoid covering controls */
    transform: translateX(-50%) translateY(-100px);
    font-size: 0.95rem;
    padding: 12px 20px;
    width: 90vw; /* Take more width on mobile */
  }
  #tts-toast.show {
    transform: translateX(-50%) translateY(0);
  }
}
