/*
 * ============================================================
 *  COIN TOSS — Bootstrap 5 Conflict Fix
 *  Add this at the END of stylesheetcointoss.css
 *  (or include as a separate file AFTER bootstrap and cointoss CSS)
 * ============================================================
 */

/* ── 1. FIX: fade-up visible immediately, animate in smoothly ── */
/* Bootstrap layouts often have overflow:hidden parents that block
   IntersectionObserver. This ensures sections are always visible. */
.fade-up {
  opacity: 1 !important;
  transform: none !important;
}

/* ── 2. FIX: Bootstrap .btn overrides our coin toss buttons ── */
/* Bootstrap defines .btn, .btn-primary, .btn-secondary globally.
   We re-declare our button styles with higher specificity. */

.coin-zone .btn,
.coin-actions .btn,
.dm-footer .btn,
.multi-card .btn,
.modal-actions .btn,
section .btn {
  font-family: 'Inter', sans-serif !important;
  font-weight: 700 !important;
  font-size: 14.5px !important;
  padding: 14px 26px !important;
  border-radius: 999px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  transition: transform .18s ease, box-shadow .18s ease !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  line-height: 1.4 !important;
}

.coin-zone .btn:active,
.coin-actions .btn:active,
section .btn:active {
  transform: scale(.97) !important;
}

/* Primary gold button */
.coin-actions .btn.btn-primary,
.dm-footer .btn.btn-primary,
.multi-card .btn.btn-primary,
.modal-actions .btn.btn-primary,
#dmTossBtn,
#tossBtn,
#multiTossBtn,
#modalTossAgain {
  background: linear-gradient(135deg, #FCD34D, #F59E0B 55%, #B45309) !important;
  color: #3a1d02 !important;
  box-shadow: 0 10px 30px rgba(245,158,11,.35) !important;
  border: none !important;
}

.coin-actions .btn.btn-primary:hover,
.dm-footer .btn.btn-primary:hover,
#dmTossBtn:hover,
#tossBtn:hover,
#multiTossBtn:hover {
  box-shadow: 0 14px 38px rgba(245,158,11,.5) !important;
  transform: translateY(-2px) !important;
  color: #3a1d02 !important;
  background: linear-gradient(135deg, #FCD34D, #F59E0B 55%, #B45309) !important;
}

/* Secondary white button */
.coin-actions .btn.btn-secondary,
.modal-actions .btn.btn-secondary,
#quickFlipBtn,
#modalCloseBtn {
  background: #ffffff !important;
  border: 1px solid #E2E8F0 !important;
  color: #0F172A !important;
  box-shadow: 0 8px 30px rgba(15,23,42,.08) !important;
}

.coin-actions .btn.btn-secondary:hover,
#quickFlipBtn:hover,
#modalCloseBtn:hover {
  border-color: #2563EB !important;
  color: #2563EB !important;
  transform: translateY(-2px) !important;
  background: #ffffff !important;
}

/* Tertiary dashed button */
.coin-actions .btn.btn-tertiary,
#resetBtn {
  background: transparent !important;
  color: #64748B !important;
  border: 1px dashed #E2E8F0 !important;
  box-shadow: none !important;
}

.coin-actions .btn.btn-tertiary:hover,
#resetBtn:hover {
  color: #0F172A !important;
  border-color: #64748B !important;
  background: transparent !important;
}

/* Disabled state */
.btn:disabled,
.btn[disabled] {
  opacity: .55 !important;
  cursor: not-allowed !important;
  transform: none !important;
  pointer-events: none !important;
}

/* ── 3. FIX: Bootstrap .badge conflicts with our trust badges ── */
/* Bootstrap .badge is a pill label. Rename scope to avoid clash. */
.badge-row .badge {
  background: var(--card, #ffffff) !important;
  border: 1px solid var(--border, #E2E8F0) !important;
  border-radius: 16px !important;
  padding: 20px !important;
  text-align: center !important;
  flex: 1 !important;
  min-width: 140px !important;
  box-shadow: 0 8px 30px rgba(15,23,42,.08) !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  color: inherit !important;
  display: block !important;
  line-height: inherit !important;
  vertical-align: inherit !important;
}

/* ── 4. FIX: Bootstrap .container padding vs our custom container ── */
/* Bootstrap adds 12px padding. Our design needs 24px. */
.container {
  padding-left: 24px !important;
  padding-right: 24px !important;
  max-width: 1180px !important;
}

/* ── 5. FIX: Bootstrap resets h1-h6 font — restore Sora display font ── */
h1, h2, h3 {
  font-family: 'Sora', sans-serif !important;
  letter-spacing: -0.02em !important;
}

.hero-copy h1 {
  font-size: clamp(40px, 6vw, 64px) !important;
  font-weight: 800 !important;
  line-height: 1.04 !important;
  margin-bottom: 18px !important;
}

.hero-copy h1 span {
  color: #F59E0B !important;
}

/* ── 6. FIX: Bootstrap body font overrides ── */
body {
  font-family: 'Inter', sans-serif !important;
}

/* ── 7. FIX: stat-card .label vs Bootstrap .label ── */
/* Bootstrap 5 removed .label, but just in case: */
.stat-card .label {
  font-size: 13px !important;
  color: #64748B !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: .04em !important;
  margin-bottom: 10px !important;
  background: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  display: block !important;
}

/* ── 8. FIX: Bootstrap .form-control / input resets ── */
.dm-input {
  display: block !important;
  width: 100% !important;
  padding: 13px 16px !important;
  border-radius: 10px !important;
  border: 1.5px solid #E2E8F0 !important;
  background: #FAFAFA !important;
  color: #0F172A !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 15px !important;
  transition: border-color .2s, box-shadow .2s !important;
  outline: none !important;
  box-shadow: none !important;
}

.dm-input:focus {
  border-color: #F59E0B !important;
  box-shadow: 0 0 0 3px rgba(245,158,11,.15) !important;
}

[data-theme="dark"] .dm-input {
  background: #0B1220 !important;
  color: #F1F5F9 !important;
  border-color: #243047 !important;
}

/* ── 9. FIX: Bootstrap navbar & header z-index vs our sticky header ── */
.site-header {
  z-index: 1030 !important; /* match Bootstrap's navbar z-index */
}

/* ── 10. FIX: Bootstrap row/col inside sections ── */
/* Prevent Bootstrap grid gutters from breaking our layouts */
.hero-grid,
.fair-grid,
.stats-grid,
.grid-3,
.grid-6,
.settings-card {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* ── 11. FIX: Multi-coin results — animation fill mode ── */
/* Bootstrap resets can prevent @keyframes from holding their
   final state. 'both' = invisible before delay, visible after. */

.multi-results {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 16px !important;
  margin-top: 30px !important;
  min-height: 64px !important;
}

.mini-coin {
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-family: 'Sora', sans-serif !important;
  font-weight: 800 !important;
  color: #fff !important;
  font-size: 20px !important;
  box-shadow: 0 8px 18px rgba(15,23,42,.25) !important;
  /* 'both' = hidden before delay fires, stays visible after end */
  animation: mini-pop-fix .5s ease both !important;
  opacity: 1;
  transform: scale(1);
}

/* Re-declare keyframes with a unique name to avoid any cached conflict */
@keyframes mini-pop-fix {
  from {
    transform: scale(0) rotate(-30deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Re-declare original mini-pop with fill-mode fix so JS-set
   animationDelay still works without any JS changes needed */
@keyframes mini-pop {
  from {
    transform: scale(0) rotate(-30deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Also patch the class-level animation shorthand to include 'both' */
.multi-results .mini-coin {
  animation-fill-mode: both !important;
  animation-name: mini-pop !important;
  animation-duration: .5s !important;
  animation-timing-function: ease !important;
}

/* ── 12. FIX: Coin toss share styles leaking into site's existing share bar ──
   Scope ALL share-btn styles strictly to .share-card so they don't
   override your site's existing sharebar.css share buttons. ── */

/* Reset any global .share-btn styles that may bleed out */
.share-btn {
  all: revert;
}

/* Re-apply ONLY inside the coin toss share card */
.share-card .share-btn {
  width: 48px !important;
  height: 48px !important;
  border-radius: 50% !important;
  background: rgba(255,255,255,.08) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  transition: all .2s !important;
  border: 1px solid rgba(255,255,255,.15) !important;
  cursor: pointer !important;
  text-decoration: none !important;
  color: inherit !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

.share-card .share-btn:hover {
  background: #F59E0B !important;
  color: #3a1d02 !important;
  transform: translateY(-3px) !important;
  border-color: transparent !important;
}

.share-card .share-buttons {
  display: flex !important;
  justify-content: center !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
  align-items: center !important;
}

/* ── 13. FIX: Protect site's existing share bar from ALL our overrides ──
   Target your site's share section by its container class.
   Adjust '.share-bar', '.sharebar', '[class*="share-"]' as needed
   to match your actual share section wrapper class. ── */

/* Common share bar wrapper names — add yours if different */
.share-bar,
.sharebar,
.share-section:not(.share-card),
[class*="sharebar"] {
  /* Reset any coin toss variables that might bleed in */
  --flip-duration: unset;
}

/* Ensure the site share buttons keep their original layout */
.share-bar .share-btn,
.sharebar .share-btn,
[class*="sharebar"] a,
[class*="sharebar"] button {
  all: revert !important;
}

/* ══════════════════════════════════════════════════════════
   BLOG SECTION — ct-prefixed to avoid all Bootstrap conflicts
   ══════════════════════════════════════════════════════════ */

.ct-blog-section {
  padding: 64px 0;
  background: var(--bg, #FAFAFA);
}

/* ── Search + Filter bar ── */
.ct-blog-controls {
  display: flex;
  gap: 14px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.ct-blog-search,
.ct-blog-filter {
  flex: 1;
  min-width: 200px;
  padding: 13px 18px;
  border-radius: 12px;
  border: 1.5px solid var(--border, #E2E8F0);
  background: var(--card, #fff);
  color: var(--text, #0F172A);
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(15,23,42,.05);
  appearance: none;
  -webkit-appearance: none;
}

.ct-blog-search:focus,
.ct-blog-filter:focus {
  border-color: #F59E0B;
  box-shadow: 0 0 0 3px rgba(245,158,11,.15);
}

.ct-blog-filter {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 42px;
  cursor: pointer;
}

/* ── Blog grid ── */
.ct-blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 900px) { .ct-blog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .ct-blog-grid { grid-template-columns: 1fr; } }

/* ── Blog card ── */
.ct-blog-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 22px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #E2E8F0);
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(15,23,42,.07);
  text-decoration: none !important;
  color: var(--text, #0F172A) !important;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  cursor: pointer;
}

.ct-blog-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 40px rgba(15,23,42,.13);
  border-color: #F59E0B;
  color: var(--text, #0F172A) !important;
  text-decoration: none !important;
}

/* ── Icon bubble ── */
.ct-blog-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(245,158,11,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  transition: background .2s;
}

.ct-blog-card:hover .ct-blog-icon {
  background: rgba(245,158,11,.2);
}

/* ── Card body ── */
.ct-blog-body {
  flex: 1;
  min-width: 0;
}

.ct-blog-body h3 {
  font-family: 'Sora', sans-serif !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  margin-bottom: 6px !important;
  line-height: 1.35 !important;
  color: var(--text, #0F172A) !important;
  letter-spacing: -0.01em !important;
}

.ct-blog-body p {
  font-size: 13.5px;
  color: var(--text-muted, #64748B);
  margin-bottom: 10px;
  line-height: 1.5;
}

.ct-blog-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(245,158,11,.1);
  color: #B45309;
  border: 1px solid rgba(245,158,11,.2);
  font-family: 'IBM Plex Mono', monospace;
}

/* ── Hidden cards during filter ── */
.ct-blog-card.ct-hidden {
  display: none !important;
}

/* ── Empty state ── */
.ct-blog-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted, #64748B);
  font-size: 15px;
}

/* ── Dark mode ── */
[data-theme="dark"] .ct-blog-search,
[data-theme="dark"] .ct-blog-filter {
  background-color: #121A2B;
  color: #F1F5F9;
  border-color: #243047;
}
