/* ============================================
   PetInsuranceGuides Animation Styles
   ============================================ */

/* ===== 1. Page fade-in on load ===== */
body {
  opacity: 0;
  transition: opacity .5s ease-out;
}
body.is-loaded {
  opacity: 1;
}

/* ===== 2. Scroll progress bar (top of page) ===== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #1a5ec0 0%, #0ea5e9 50%, #10b981 100%);
  z-index: 9999;
  width: 0;
  transition: width .1s linear;
  box-shadow: 0 1px 6px rgba(26, 94, 192, .35);
}

/* ===== 3. Scroll reveal animations ===== */
.reveal-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .65s cubic-bezier(.16, 1, .3, 1), transform .65s cubic-bezier(.16, 1, .3, 1);
}
.reveal-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.reveal-up:nth-child(1) { transition-delay: 0s; }
.reveal-up:nth-child(2) { transition-delay: .08s; }
.reveal-up:nth-child(3) { transition-delay: .16s; }
.reveal-up:nth-child(4) { transition-delay: .24s; }
.reveal-up:nth-child(5) { transition-delay: .32s; }
.reveal-up:nth-child(6) { transition-delay: .4s; }

/* ===== 4. Sticky CTA floating bar ===== */
.sticky-cta {
  position: fixed;
  bottom: -100px;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, .96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, .08);
  z-index: 9998;
  transition: bottom .35s cubic-bezier(.16, 1, .3, 1);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, .18);
}
.sticky-cta.is-visible {
  bottom: 0;
}
.sticky-cta-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.sticky-cta-text {
  color: #f1f5f9;
  font-size: .95rem;
  font-weight: 500;
}
.sticky-cta-text strong {
  color: #fff;
  font-weight: 700;
}
.sticky-cta-btn {
  background: linear-gradient(135deg, #1a5ec0, #0ea5e9);
  color: #fff;
  padding: 11px 24px;
  border-radius: 8px;
  font-weight: 700;
  font-size: .9rem;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(26, 94, 192, .35);
}
.sticky-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(26, 94, 192, .5);
}

/* ===== 5. Comparison table - sortable headers ===== */
table.comparison th,
table[data-sortable] th {
  position: relative;
  user-select: none;
}
table.comparison th:hover,
table[data-sortable] th:hover {
  background: rgba(26, 94, 192, .08);
}
table.comparison th::after,
table[data-sortable] th::after {
  content: "⇅";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: .3;
  font-size: .7rem;
  transition: opacity .2s;
}
table.comparison th.sort-asc::after,
table[data-sortable] th.sort-asc::after {
  content: "▲";
  opacity: 1;
  color: #1a5ec0;
}
table.comparison th.sort-desc::after,
table[data-sortable] th.sort-desc::after {
  content: "▼";
  opacity: 1;
  color: #1a5ec0;
}
table.comparison tbody tr,
table[data-sortable] tbody tr {
  transition: background .25s ease, transform .25s ease;
}
table.comparison tbody tr:hover,
table[data-sortable] tbody tr:hover {
  background: rgba(26, 94, 192, .04);
  transform: scale(1.005);
}

/* ===== 6. Card hover expand (Top Picks, etc.) ===== */
[data-expand] {
  transition: transform .35s cubic-bezier(.16, 1, .3, 1), box-shadow .35s ease;
  cursor: pointer;
}
[data-expand]:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .08);
}

/* ===== 7. Premium Calculator ===== */
#premium-calculator {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(26, 94, 192, .12);
  border-radius: 16px;
  padding: 32px;
  margin: 32px 0;
  position: relative;
  overflow: hidden;
}
#premium-calculator::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(14, 165, 233, .08) 0%, transparent 70%);
  pointer-events: none;
}
.calc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.calc-icon {
  font-size: 1.5rem;
}
.calc-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}
.calc-subtitle {
  color: #64748b;
  font-size: .9rem;
  margin: 0 0 24px;
}
.calc-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.calc-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.calc-control label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #475569;
}
.calc-control select {
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: .9rem;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
}
.calc-control select:focus {
  outline: none;
  border-color: #1a5ec0;
  box-shadow: 0 0 0 3px rgba(26, 94, 192, .15);
}
.calc-empty {
  text-align: center;
  color: #94a3b8;
  font-size: .9rem;
  padding: 32px 16px;
  font-style: italic;
}
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.calc-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  position: relative;
  transition: transform .3s cubic-bezier(.16, 1, .3, 1), box-shadow .3s ease, border-color .3s;
  opacity: 0;
  animation: calcCardIn .5s cubic-bezier(.16, 1, .3, 1) forwards;
}
.calc-card:nth-child(1) { animation-delay: .04s; }
.calc-card:nth-child(2) { animation-delay: .08s; }
.calc-card:nth-child(3) { animation-delay: .12s; }
.calc-card:nth-child(4) { animation-delay: .16s; }
.calc-card:nth-child(5) { animation-delay: .2s; }
.calc-card:nth-child(6) { animation-delay: .24s; }
.calc-card:nth-child(7) { animation-delay: .28s; }
.calc-card:nth-child(8) { animation-delay: .32s; }
.calc-card:nth-child(9) { animation-delay: .36s; }
.calc-card:nth-child(10){ animation-delay: .4s; }
@keyframes calcCardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.calc-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .08);
  border-color: #1a5ec0;
}
.calc-card:nth-child(1) {
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 60%);
  border-color: #10b981;
}
.calc-badge {
  position: absolute;
  top: -8px;
  right: 12px;
  background: #10b981;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: .3px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, .35);
}
.calc-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.calc-card-name {
  font-weight: 800;
  font-size: .95rem;
  color: #0f172a;
}
.calc-card-rating {
  color: #f59e0b;
  font-size: .75rem;
  letter-spacing: -1px;
}
.calc-card-price {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  margin-bottom: 6px;
}
.calc-dollar {
  font-size: 1rem;
  font-weight: 600;
  color: #64748b;
  margin-right: 2px;
}
.calc-per {
  font-size: .75rem;
  font-weight: 600;
  color: #94a3b8;
  margin-left: 2px;
}
.calc-saved {
  display: inline-block;
  font-size: .7rem;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 10px;
}
.calc-card-cta {
  display: block;
  text-align: center;
  background: #1a5ec0;
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  transition: background .2s;
}
.calc-card-cta:hover {
  background: #0d4ba0;
}
.calc-disclaimer {
  font-size: .7rem;
  color: #94a3b8;
  margin-top: 20px;
  margin-bottom: 0;
  text-align: center;
  line-height: 1.5;
}

/* ===== 8. Top Picks cards (if data-expand applied) ===== */
.top-pick-card {
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  padding: 20px;
}

/* ===== 9. Smooth scroll behavior ===== */
html {
  scroll-behavior: smooth;
}

/* ===== 10. Reduce motion preference ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal-up {
    opacity: 1;
    transform: none;
  }
}

/* ===== 11. Mobile responsiveness for calculator ===== */
@media (max-width: 720px) {
  .calc-controls {
    grid-template-columns: 1fr;
  }
  .sticky-cta-inner {
    padding: 12px 16px;
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
  .calc-grid {
    grid-template-columns: 1fr 1fr;
  }
  #premium-calculator {
    padding: 20px 16px;
  }
}
@media (max-width: 480px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }
}
