/* ═══════════════════════════════════════════════════════════════════════════
   CARD TAP FLIP — Task #1320487
   Premium card hover/lift animation on mobile tap + tap to flip to back
   Mobile settlement cards: tap to flip (front: name/payout/deadline, back: full details)
   60%+ mobile traffic — this is the premium card experience.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────
   CARD HOVER/LIFT ON MOBILE TAP
   Premium multi-layer shadow that lifts on tap
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Card lift animation — premium feel on mobile tap */
  .dir-card,
  .settlement-card,
  .card-wrap .card,
  .sr-card,
  article.card {
    transition:
      transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
      box-shadow 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
      border-color 0.2s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    will-change: transform, box-shadow;
  }

  /* Premium lift on tap/active */
  .dir-card:active,
  .settlement-card:active,
  .card-wrap .card:active,
  .sr-card:active,
  article.card:active {
    transform: scale(0.98) translateY(2px);
    box-shadow:
      0 1px 2px rgba(0,0,0,0.04),
      0 4px 8px rgba(0,0,0,0.06),
      0 8px 20px rgba(0,0,0,0.04);
  }

  /* Premium hover on hover-capable devices (tablets) */
  .dir-card:hover,
  .settlement-card:hover,
  .card-wrap .card:hover,
  .sr-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow:
      0 4px 8px rgba(0,0,0,0.06),
      0 12px 32px rgba(0,0,0,0.10),
      0 24px 56px rgba(0,0,0,0.06);
    border-color: rgba(212,175,55,0.3);
  }

  /* Gold shimmer on premium cards (high-value settlements) */
  .dir-card.is-premium:hover,
  .settlement-card.is-premium:hover,
  .sr-card.is-premium:hover {
    box-shadow:
      0 4px 8px rgba(0,0,0,0.06),
      0 12px 32px rgba(0,0,0,0.10),
      0 0 0 1.5px rgba(212,175,55,0.5),
      0 0 24px rgba(212,175,55,0.15);
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   CARD TAP FLIP (3D flip animation)
   Front: name/payout/deadline
   Back: full details, eligibility check, share button
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Flip container */
  .flip-card {
    perspective: 1200px;
    -webkit-perspective: 1200px;
  }

  /* Flip inner — the rotating element */
  .flip-card__inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    will-change: transform;
  }

  /* Flipped state */
  .flip-card.is-flipped .flip-card__inner {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
  }

  /* Front and back faces */
  .flip-card__face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: inherit;
  }

  /* Back face — initially hidden (rotated 180deg) */
  .flip-card__back {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
  }

  /* ── BACK FACE CONTENT ── */
  .flip-card__back-content {
    padding: 16px;
    background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-radius: inherit;
  }

  .flip-card__back-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
  }

  .flip-card__back-title {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.3;
  }

  .flip-card__close-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #6b7280;
    flex-shrink: 0;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
  }

  .flip-card__close-btn:active {
    background: #e2e8f0;
  }

  /* Settlement details on back */
  .flip-card__details {
    flex: 1;
    overflow-y: auto;
  }

  .flip-card__detail-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
  }

  .flip-card__detail-row:last-child {
    border-bottom: none;
  }

  .flip-card__detail-icon {
    font-size: 14px;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
    margin-top: 1px;
  }

  .flip-card__detail-label {
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1px;
  }

  .flip-card__detail-value {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    line-height: 1.4;
  }

  /* CTAs on back */
  .flip-card__ctas {
    display: flex;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.06);
  }

  .flip-card__cta {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 9px 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    min-height: 42px;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s, opacity 0.15s;
  }

  .flip-card__cta:active {
    transform: scale(0.96);
    opacity: 0.9;
  }

  .flip-card__cta--check {
    background: linear-gradient(135deg, #d4af37 0%, #a88a20 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(212,175,55,0.35);
  }

  .flip-card__cta--view {
    background: #f3f4f6;
    color: #374151;
  }

  .flip-card__cta svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }

  /* Flip hint badge */
  .flip-card__hint {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 6px;
  }

  .flip-card__hint svg {
    width: 12px;
    height: 12px;
    opacity: 0.6;
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   FLIP CARD INIT — JS adds .flip-ready class after hydration
   Prevents FOUC
   ───────────────────────────────────────────────────────────────────────── */
.flip-card {
  opacity: 0;
  transition: opacity 0.2s;
}
.flip-card.flip-ready {
  opacity: 1;
}

/* ─────────────────────────────────────────────────────────────────────────
   HAPTIC FEEDBACK on card tap (via JS)
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Tap ripple effect on cards */
  .dir-card.is-tapping,
  .settlement-card.is-tapping {
    position: relative;
    overflow: hidden;
  }

  .dir-card.is-tapping::after,
  .settlement-card.is-tapping::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(212,175,55,0.12);
    transform: translate(-50%, -50%);
    animation: flip-tap-ripple 0.5s ease-out forwards;
    pointer-events: none;
  }

  @keyframes flip-tap-ripple {
    to {
      width: 200%;
      height: 200%;
      opacity: 0;
    }
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   HIGH-VALUE CARD INDICATOR (gold shimmer)
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .dir-card.is-high-value::before,
  .settlement-card.is-high-value::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
      135deg,
      rgba(212,175,55,0.08) 0%,
      transparent 50%,
      rgba(212,175,55,0.04) 100%
    );
    pointer-events: none;
    z-index: 0;
  }

  .dir-card.is-high-value > *,
  .settlement-card.is-high-value > * {
    position: relative;
    z-index: 1;
  }

  /* Gold left border accent for high-value */
  .dir-card.is-high-value,
  .settlement-card.is-high-value {
    border-left: 3px solid rgba(212,175,55,0.6);
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   REDUCED MOTION
   ───────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .flip-card__inner {
    transition: none;
  }

  .dir-card:active,
  .settlement-card:active {
    transform: none;
  }

  .dir-card:hover,
  .settlement-card:hover {
    transform: none;
  }

  @keyframes flip-tap-ripple {
    /* No animation */
  }
}