/* File: css/shared-styles.css
 * Purpose: Shared CSS styles across all pages
 * Updated: 2026-04-15 — Mobile-first overhaul: touch targets, focus rings,
 *          click-based nav dropdowns, custom checkboxes, mobile form sizing
 */

/* ========== BASE STYLES ========== */
html {
  scroll-behavior: smooth;
}

/* Prevent iOS zoom on input focus — enforced via text-base (16px) on inputs */
@media screen and (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* ========== HERO & CTA PATTERNS ========== */
.hero-pattern {
  background-color: #1B2B4B;
  position: relative;
}
.hero-pattern::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}
.hero-pattern::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(46,125,82,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(201,151,42,0.06) 0%, transparent 50%);
  pointer-events: none;
}

.cta-pattern {
  position: relative;
  overflow: hidden;
}
.cta-pattern::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* ========== CARD & HOVER EFFECTS ========== */
.card-hover {
  transition: all 0.3s ease;
}
.card-hover:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}
/* Disable hover transforms on touch devices */
@media (hover: none) {
  .card-hover:hover {
    transform: none;
  }
}

/* ========== MODAL ========== */
.modal-enter {
  animation: modalEnter 0.3s ease-out;
}
@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ========== ACCORDION ========== */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}
.accordion-content.active {
  max-height: 500px;
}

/* ========== PROGRESS BAR ========== */
.progress-fill {
  transition: width 1s ease-out;
}

/* ========== SCROLL REVEAL ========== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease-out;
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #F4F3F0;
}
::-webkit-scrollbar-thumb {
  background: #1B2B4B;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #2a3d5c;
}

/* ========== SKIP NAVIGATION (Accessibility) ========== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
.sr-only.focus\:not-sr-only:focus {
  position: fixed;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: #1B2B4B;
  color: white;
  z-index: 9999;
  text-decoration: none;
  font-weight: 600;
}

/* ========== NAVIGATION DROPDOWN ========== */

/* Desktop: dropdown hidden by default, shown via JS toggle (.active) or hover */
.nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  padding: 0.5rem 0;
  z-index: 60;
  margin-top: -2px;
}
/* Hover bridge above dropdown */
.nav-dropdown::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

/* Show on hover (desktop only — hover:hover ensures touch devices skip this) */
@media (hover: hover) {
  .nav-dropdown-trigger:hover .nav-dropdown {
    display: block;
  }
}

/* Show via JS click toggle (works on all devices) */
.nav-dropdown.active {
  display: block;
}

/* Right-aligned dropdown (login button) */
.nav-dropdown-right {
  right: 0;
  left: auto;
  transform: none;
}

.nav-dropdown a {
  display: flex;
  align-items: center;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  color: #475569;
  transition: all 0.15s;
  min-height: 44px;
}
.nav-dropdown a:hover {
  background: #F4F3F0;
  color: #1B2B4B;
}

/* Dropdown trigger chevron rotation when open */
.nav-dropdown-trigger .fa-chevron-down {
  transition: transform 0.2s ease;
}
.nav-dropdown-trigger.active .fa-chevron-down {
  transform: rotate(180deg);
}

/* Mobile nav dropdown min-width override for small screens */
@media (max-width: 400px) {
  .nav-dropdown {
    min-width: 180px;
  }
}

/* ========== MOBILE MENU ========== */

/* Mobile collapse toggle chevron rotation */
.mobile-collapse-toggle .fa-chevron-down {
  transition: transform 0.2s ease;
}
.mobile-collapse-toggle.active .fa-chevron-down {
  transform: rotate(180deg);
}

/* Mobile menu links — ensure adequate tap targets */
#mobileMenu a {
  min-height: 44px;
  display: flex;
  align-items: center;
}
#mobileMenu .mobile-collapse-content a {
  min-height: 40px;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* ========== FORM FOCUS STATES ========== */
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #2E7D52;
  box-shadow: 0 0 0 3px rgba(46, 125, 82, 0.1);
}

/* ========== FOCUS RING UTILITY ========== */
/* Visible focus rings for keyboard navigation */
:focus-visible {
  outline: 2px solid #2E7D52;
  outline-offset: 2px;
}
/* Remove default focus ring for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* ========== BUTTON TRANSITIONS ========== */
button, .btn {
  transition: all 0.2s ease;
}
button:active, .btn:active {
  transform: scale(0.98);
}

/* ========== LINK UNDERLINE ANIMATION ========== */
.link-underline {
  position: relative;
}
.link-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: #2E7D52;
  transition: width 0.3s ease;
}
.link-underline:hover::after {
  width: 100%;
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  z-index: 9999;
  animation: slideIn 0.3s ease;
}
/* Mobile: position above sticky CTA bar */
@media (max-width: 1023px) {
  .toast {
    bottom: 80px;
    right: 16px;
    left: 16px;
    text-align: center;
  }
}
.toast.success {
  background: #2E7D52;
}
.toast.error {
  background: #dc2626;
}
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========== CUSTOM CHECKBOX (Touch-friendly) ========== */
.check-item {
  display: flex;
  align-items: center;
  min-height: 48px;
  gap: 0.75rem;
  padding: 0.375rem 0;
  cursor: pointer;
}
.check-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  /* Tap target area extends beyond visual checkbox */
  padding: 0;
  margin: 0;
}
/* Invisible tap target expansion */
.check-item input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
}
.check-item input[type="checkbox"]:checked {
  background: #2E7D52;
  border-color: #2E7D52;
}
.check-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 7px;
  width: 6px;
  height: 11px;
  border: solid white;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.check-item input[type="checkbox"]:focus-visible {
  outline: 2px solid #2E7D52;
  outline-offset: 2px;
}
.check-item label {
  cursor: pointer;
  line-height: 1.5;
}

/* ========== PRINT STYLES ========== */
@media print {
  .no-print {
    display: none !important;
  }
  body {
    background: white !important;
  }
}
