/**
 * ==============================================================================
 * FeelingsWheels - High-Conversion Split-Card Winner Modal & Action Bar
 * ==============================================================================
 * File: assets/css/modals.css
 * Purpose: Matches GoSpinWheel's screenshot: Woohoo banner, split-card, & 4 action buttons.
 * Responsive: Desktop, Tablet & Mobile optimized without changing any styles/IDs.
 */

/* -------------------------------------------------------------------------- */
/* 1. FULL-SCREEN CONFETTI CANVAS (Top Layer)                                 */
/* -------------------------------------------------------------------------- */
.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 100000 !important;
  pointer-events: none;
}

/* -------------------------------------------------------------------------- */
/* 2. MODAL OVERLAY & BACKDROP                                                */
/* -------------------------------------------------------------------------- */
.winner-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(6, 9, 14, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 2.5vw, 1.5rem);
  opacity: 1;
  visibility: visible;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: opacity var(--transition-smooth, 0.3s ease), visibility var(--transition-smooth, 0.3s ease);
}

.winner-modal-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.winner-modal-wrapper {
  width: 100%;
  max-width: 840px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.75rem, 2vh, 1.25rem);
  margin: auto;
  animation: modalPopIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalPopIn {
  0% {
    opacity: 0;
    transform: scale(0.85) translateY(24px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* -------------------------------------------------------------------------- */
/* 3. (A) TOP FLOATING WOOHOO BANNER                                          */
/* -------------------------------------------------------------------------- */
.winner-top-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
}

.woohoo-title {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  font-weight: 800;
  color: #FBBF24; /* Golden Yellow */
  letter-spacing: -0.02em;
  text-shadow: 0 4px 16px rgba(251, 191, 36, 0.35);
  line-height: 1.2;
}

.woohoo-subname {
  font-family: var(--font-heading);
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  font-weight: 800;
  color: #F59E0B;
  letter-spacing: -0.01em;
}

/* -------------------------------------------------------------------------- */
/* 4. (B) THE MAIN SPLIT CARD (Left Info + Right Wheel Preview)               */
/* -------------------------------------------------------------------------- */
.winner-split-card {
  background: #181D26;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: clamp(16px, 3vw, 24px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 0, 0, 0.4);
  width: 100%;
  padding: clamp(1.25rem, 3.5vw, 2.5rem);
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(1rem, 2.5vw, 2rem);
  align-items: center;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Close (X) Top-Right Button */
.modal-close-btn {
  position: absolute;
  top: clamp(0.75rem, 2vw, 1.25rem);
  right: clamp(0.75rem, 2vw, 1.25rem);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 10;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  transform: rotate(90deg);
}

/* --- Card Left Half --- */
.card-left-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(0.75rem, 1.8vw, 1.25rem);
  z-index: 2;
  min-width: 0;
  width: 100%;
}

/* Wheel Title with Orange Accent Underline */
.card-wheel-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 100%;
}

.card-wheel-title {
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.2;
  word-break: break-word;
}

.title-accent-line {
  width: 48px;
  height: 4px;
  background: #F97316; /* Bright Orange Line */
  border-radius: var(--radius-full);
}

/* 🏆 WINNER Pill Badge */
.trophy-winner-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-full);
  padding: 0.4rem 1.15rem;
  color: #FBBF24;
  font-size: clamp(0.75rem, 1.5vw, 0.85rem);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.trophy-icon {
  font-size: 1.15rem;
  line-height: 1;
}

/* Massive Winner Name */
.hero-winner-box {
  width: 100%;
  padding: 0.25rem 0;
}

.hero-winner-text {
  font-family: var(--font-heading);
  font-size: clamp(1.85rem, 5.5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.1;
  color: #FFFFFF;
  margin: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
  letter-spacing: -0.03em;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Share Link Pill */
.card-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  padding: 0.45rem 1rem;
  color: #F472B6; /* Light Pink Accent */
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  max-width: 100%;
  transition: all var(--transition-fast);
}

.card-link-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.link-url-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Card Right Half: Mini Wheel Preview --- */
.card-right-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.mini-wheel-frame {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55));
}

.mini-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
}

/* -------------------------------------------------------------------------- */
/* 5. (C) BOTTOM ACTION BAR: THE 4 BUTTONS                                    */
/* -------------------------------------------------------------------------- */
.winner-bottom-actions-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  width: 100%;
}

.btn-win-action {
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0 1.35rem;
  border-radius: 14px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Button 1: Spin Again (Orange-Red Gradient Hero) */
.btn-action-spin-again {
  background: linear-gradient(90deg, #FF6B00 0%, #FF2E55 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 18px rgba(255, 46, 85, 0.4);
  min-width: 170px;
}

.btn-action-spin-again:hover {
  box-shadow: 0 6px 24px rgba(255, 46, 85, 0.6);
  transform: translateY(-2px);
}

.btn-action-spin-again:active {
  transform: translateY(0);
}

/* Button 2: Remove Winner */
.btn-action-remove {
  background: #202632;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #F8FAFC;
}

.btn-action-remove:hover {
  background: #EF4444;
  border-color: #EF4444;
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

/* Button 3: Copy Image */
.btn-action-copy-img {
  background: #202632;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #F8FAFC;
}

.btn-action-copy-img:hover {
  background: #2B3342;
  border-color: rgba(255, 255, 255, 0.2);
  color: #38E1FF;
  transform: translateY(-1px);
}

/* Button 4: Download Image */
.btn-action-download {
  background: #202632;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #F8FAFC;
}

.btn-action-download:hover {
  background: #2B3342;
  border-color: rgba(255, 255, 255, 0.2);
  color: #00E599;
  transform: translateY(-1px);
}

/* -------------------------------------------------------------------------- */
/* 6. TABLET RESPONSIVE BREAKPOINT (max-width: 860px)                         */
/* -------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .winner-split-card {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1.25rem;
    padding: 1.75rem;
  }

  .mini-wheel-frame {
    max-width: 250px;
  }
}

/* -------------------------------------------------------------------------- */
/* 7. MOBILE RESPONSIVE BREAKPOINT (max-width: 680px)                         */
/* -------------------------------------------------------------------------- */
@media (max-width: 680px) {
  .winner-modal-overlay {
    padding: 0.75rem;
    align-items: flex-start; /* Chhoti screen me modal top se start hoga taaki cut na ho */
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  }

  .winner-modal-wrapper {
    gap: 0.85rem;
  }

  .winner-split-card {
    grid-template-columns: 1fr; /* Single column stack */
    padding: 1.5rem 1.15rem;
    gap: 1.25rem;
    text-align: center;
  }

  .card-left-content {
    align-items: center;
  }

  .card-wheel-title-group {
    align-items: center;
  }

  .title-accent-line {
    width: 38px;
  }

  .mini-wheel-frame {
    max-width: 190px;
  }

  /* Perfect 2x2 Equal Grid for Mobile */
  .winner-bottom-actions-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columns barabar size */
    width: 100%;
    gap: 0.65rem;
  }

  .btn-action-spin-again {
    grid-column: auto; /* Full width span hata diya */
    min-width: unset;
    width: 100%;
  }

  .btn-win-action {
    width: 100%;
    height: 46px;
    padding: 0 0.5rem;
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    box-sizing: border-box;
    white-space: nowrap;
  }

  .btn-win-action svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }
}

/* -------------------------------------------------------------------------- */
/* 8. ULTRA-SMALL PHONES (max-width: 380px) & LANDSCAPE MOBILE FIX            */
/* -------------------------------------------------------------------------- */
@media (max-width: 380px) {
  .winner-modal-overlay {
    padding: 0.5rem;
  }

  .winner-split-card {
    padding: 1.2rem 0.85rem;
  }

  .mini-wheel-frame {
    max-width: 150px;
  }

  .btn-win-action {
    font-size: 0.78rem;
    gap: 0.35rem;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .winner-top-banner {
    display: none; /* Low height landscape par banner chup jayega taaki wheel & actions fit aayein */
  }

  .winner-split-card {
    grid-template-columns: 1.2fr 1fr;
    padding: 1rem;
  }

  .mini-wheel-frame {
    max-width: 140px;
  }
}




/* -------------------------------------------------------------------------- */
/* COMMAND PALETTE (⌘K) SEARCH MODAL STYLING                                  */
/* -------------------------------------------------------------------------- */
.search-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(6, 9, 14, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4rem 1.5rem;
}

.search-modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 640px;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalPopIn 0.25s ease-out;
}

.search-input-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card-subtle);
}

.search-icon-svg {
    color: var(--accent-mint);
    flex-shrink: 0;
}

.live-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.live-search-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.esc-badge {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.15rem 0.45rem;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    cursor: pointer;
}

.search-results-wrapper {
    max-height: 380px;
    overflow-y: auto;
    padding: 0.5rem;
}

.search-empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-item-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.search-item-card:hover,
.search-item-card.is-selected {
    background: var(--bg-elevated);
    color: var(--accent-mint);
}

.search-item-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.search-item-action {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-cyan);
    opacity: 0.8;
}

.search-modal-footer {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.65rem 1.5rem;
    background: var(--bg-card-subtle);
    border-top: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    color: var(--text-muted);
}