/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Prevent iOS Safari auto-zoom on input focus.
   iOS zooms the page when focusing an input with font-size < 16px,
   which causes horizontal overflow on narrow viewports. Setting 16px
   on mobile prevents the zoom without blocking pinch-to-zoom. */
@media screen and (max-width: 767px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  select,
  textarea {
    font-size: 16px;
  }
}

/* Toggle Switch */
.gh-toggle {
  appearance: none;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: #e8e4d9;
  cursor: pointer;
  position: relative;
  transition: background 0.3s;
  flex-shrink: 0;
}
.gh-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.3s;
}
.gh-toggle:checked {
  background: #1b4332;
}
.gh-toggle:checked::after {
  transform: translateX(20px);
  background: #e9c46a;
}
.gh-toggle:focus-visible {
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}

/* Dialog modal animations */
dialog.modal-animate[open] {
  animation: modal-in 0.2s ease-out;
}
dialog.modal-animate[open]::backdrop {
  animation: backdrop-in 0.2s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; scale: 0.95; }
  to   { opacity: 1; scale: 1; }
}
@keyframes backdrop-in {
  from { background-color: rgba(0, 0, 0, 0); }
  to   { background-color: rgba(0, 0, 0, 0.3); }
}

/* Flash toast transitions */
.flash-toast {
  transition: opacity 300ms ease-out, transform 300ms ease-out;
}
.flash-toast-enter {
  opacity: 0;
  transform: translateY(-8px);
}
.flash-toast-leaving {
  opacity: 0;
  transform: translateY(-8px);
}

/* Generic fade-out for elements being removed (e.g. session cards on revoke).
   Paired with turbo_confirm_controller's fade-before-submit hook. */
.fadeable {
  transition: opacity 300ms ease-out, transform 300ms ease-out;
}
.fadeable-leaving {
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .flash-toast,
  .fadeable {
    transition: none;
  }
}
