/* ════════════════════════════════════════════
   A3 Digital Tools — Tool Page Styles
════════════════════════════════════════════ */

/* ── TOOL HERO ── */
.tool-hero {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: var(--sp-8) 0 var(--sp-6);
  position: relative;
  overflow: hidden;
}
.tool-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse 600px 300px at 0% -20%, rgba(var(--tool-color-rgb, 41,82,227),0.04) 0%, transparent 70%);
  pointer-events: none;
}
.tool-hero__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-6);
  flex-wrap: wrap;
  margin-top: var(--sp-3);
}
.tool-hero__left { display: flex; align-items: flex-start; gap: var(--sp-5); flex: 1; min-width: 280px; }
.tool-hero__icon {
  width: 72px; height: 72px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
}
.tool-hero__text { flex: 1; }
.tool-hero__cat {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: var(--text-xs); font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: 0.08em;
  text-decoration: none; margin-bottom: var(--sp-3);
  transition: opacity 0.15s;
}
.tool-hero__cat:hover { opacity: 0.75; }
.tool-hero__title {
  font-size: clamp(22px, 3.5vw, 34px);
  font-weight: var(--fw-black);
  color: var(--gray-900);
  line-height: var(--lh-tight);
  margin-bottom: var(--sp-3);
  letter-spacing: -0.02em;
}
.tool-hero__title span { color: var(--gray-400); font-weight: var(--fw-semi); }
.tool-hero__desc {
  font-size: var(--text-md);
  color: var(--gray-500);
  line-height: var(--lh-normal);
  margin-bottom: var(--sp-4);
  max-width: 560px;
}
.tool-hero__meta {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
}
.tool-meta-badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: var(--text-xs); font-weight: var(--fw-semi);
  color: var(--gray-600);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  padding: 4px 10px; border-radius: var(--radius-full);
}
.tool-hero__rating {
  text-align: right;
  flex-shrink: 0;
}
.tool-rating__stars {
  font-size: 18px;
  color: #F59E0B;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.tool-rating__text { font-size: var(--text-sm); color: var(--gray-500); font-weight: var(--fw-semi); }

/* ── TOOL EMBED ── */
.tool-embed-section {
  padding: var(--sp-8) 0;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.tool-embed-wrap { max-width: 900px; margin: 0 auto; }
.tool-trust-bar {
  display: flex;
  justify-content: center;
  gap: var(--sp-6);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--gray-500);
  letter-spacing: 0.03em;
}
.tool-iframe-container {
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1.5px solid var(--gray-200);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  min-height: 200px;
  position: relative;
}
.tool-iframe-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-16) var(--sp-8);
  gap: var(--sp-4);
  position: absolute;
  inset: 0;
  background: var(--white);
  z-index: 2;
}
.tool-iframe-loader__icon { font-size: 48px; }
.tool-iframe-loader__text { font-size: var(--text-base); font-weight: var(--fw-semi); color: var(--gray-500); }
.tool-iframe-loader__spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#tool-iframe {
  width: 100%;
  border: none;
  display: block;
  transition: opacity 0.3s;
}

.tool-no-embed {
  background: var(--warning-light);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  text-align: center;
  font-size: var(--text-base);
  color: #92400E;
}
.tool-no-embed a { color: var(--blue); }

/* ── TOOL FEATURES ── */
.tool-features-section {
  padding: var(--sp-10) 0;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}
.tool-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: var(--sp-5);
}
.tool-feature {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}
.tool-feature__icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.tool-feature__text { font-size: var(--text-sm); color: var(--gray-700); font-weight: var(--fw-semi); line-height: 1.4; }

/* ── TOOL SECTION TITLE ── */
.tool-section-title {
  font-size: var(--text-xl);
  font-weight: var(--fw-xbold);
  color: var(--gray-900);
  margin-bottom: var(--sp-6);
  padding-bottom: var(--sp-4);
  border-bottom: 2px solid var(--gray-100);
}

/* ── TOOL CONTENT LAYOUT ── */
.tool-content-section {
  padding: var(--sp-10) 0;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}
.tool-content-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--sp-10);
  align-items: start;
}
.tool-content-sidebar { position: sticky; top: calc(var(--header-height) + var(--sp-5)); }

/* ── HOW TO USE ── */
.tool-howto-section {
  padding: var(--sp-10) 0;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.tool-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: var(--sp-5);
}
.tool-step {
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}
.tool-step__num {
  width: 36px; height: 36px;
  background: var(--blue);
  color: var(--white);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-cond);
  font-size: 18px; font-weight: var(--fw-black);
  flex-shrink: 0;
}
.tool-step__body h3 { font-size: var(--text-base); font-weight: var(--fw-xbold); color: var(--gray-900); margin-bottom: var(--sp-2); }
.tool-step__body p { font-size: var(--text-sm); color: var(--gray-500); margin: 0; line-height: var(--lh-normal); }

/* ── FAQ ── */
.tool-faq-section {
  padding: var(--sp-10) 0;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}

/* ── RELATED TOOLS ── */
.tool-related-section {
  padding: var(--sp-10) 0;
  background: var(--gray-50);
}

/* ── CATEGORY PAGE HERO ── */
/* cat-hero styles moved to category-page.css */
/* removed — see category-page.css */
/* removed — see category-page.css */
/* removed — see category-page.css */
/* removed — see category-page.css */
/* removed — see category-page.css */
/* removed — see category-page.css */

.cat-tools-section { padding: var(--sp-10) 0; background: var(--gray-50); }
.cat-other-section { padding: var(--sp-10) 0; background: var(--white); border-top: 1px solid var(--gray-200); }

/* ── RATING WIDGET POSITIONING on tool hero ── */
.tool-hero__rating {
    text-align: right;
    flex-shrink: 0;
    min-width: 180px;
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
    .tool-hero__rating {
        text-align: left;
        width: 100%;
    }
}

/* ── BOTTOM RATING SECTION ── */
.tool-bottom-rating-section {
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
    padding: var(--sp-8) 0;
}
.tool-bottom-rating {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-6);
    flex-wrap: wrap;
}
.tbr-left h3 {
    font-size: var(--text-lg);
    font-weight: var(--fw-xbold);
    color: var(--gray-900);
    margin-bottom: 4px;
}
.tbr-left p { font-size: var(--text-sm); color: var(--gray-500); margin: 0; }
.tbr-right { display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-2); }
.rate-tool-stars--lg { gap: 6px; }
.rate-star--lg { font-size: 32px !important; }
.tbr-feedback { font-size: 13px; font-weight: 600; color: var(--teal); min-height: 18px; }
.rate-already { font-size: 13px; font-weight: 700; color: var(--teal); }

/* ── VERCEL EMBED HELP BOX ── */
.tool-embed-help {
    background: var(--warning-light);
    border: 1.5px solid #FCD34D;
    border-radius: var(--radius-md);
    padding: var(--sp-5) var(--sp-6);
    margin-top: var(--sp-4);
    font-size: var(--text-sm);
    color: #92400E;
}
.tool-embed-help code, .tool-embed-help pre {
    font-family: monospace;
    font-size: 12px;
    background: rgba(0,0,0,0.06);
    padding: 8px 12px;
    border-radius: 6px;
    display: block;
    margin-top: 8px;
    overflow-x: auto;
    word-break: break-all;
}

/* ── HERO: remove stats gap when no stats ── */
.hero__inner {
    padding-bottom: var(--sp-4);
}

/* ── RESPONSIVE bottom rating ── */
@media (max-width: 640px) {
    .tool-bottom-rating { flex-direction: column; align-items: flex-start; }
    .tbr-right { align-items: flex-start; }
}

/* ── ANTI-BLINK / FLASH FIXES ── */

/* Prevent FOUC (Flash of Unstyled Content) on tool pages */
.tool-iframe-outer {
    position: relative;
    min-height: 400px;
    background: #f8f9fc;
    border-radius: var(--radius-xl);
    overflow: hidden;
}

/* Loader must be absolutely positioned to not cause layout shift */
.tool-iframe-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f9fc;
    z-index: 5;
    gap: var(--sp-4);
    transition: opacity 0.25s ease;
    border-radius: var(--radius-xl);
}

.tool-iframe-loader__icon {
    font-size: 44px;
    line-height: 1;
}

.tool-iframe-loader__text {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-500);
}

.tool-iframe-loader__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: a3dtSpin 0.75s linear infinite;
}

@keyframes a3dtSpin {
    to { transform: rotate(360deg); }
}

/* Iframe itself - no transition to prevent blink */
#tool-iframe {
    display: block;
    width: 100%;
    border: none;
    background: #f8f9fc;
    /* No opacity transition — causes blink */
}

/* Tool hero - prevent content jump */
.tool-hero {
    background: var(--white);
    border-bottom: 2px solid var(--gray-100);
    padding: var(--sp-8) 0 var(--sp-6);
}

/* Prevent page blink from JS-heavy operations */
.site-main {
    /* Prevent invisible content flashing during page load */
    min-height: 50vh;
}

/* Trust bar - prevent reflow */
.tool-trust-bar {
    display: flex;
    justify-content: center;
    gap: var(--sp-6);
    flex-wrap: wrap;
    margin-bottom: var(--sp-4);
    padding: var(--sp-3) 0;
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    color: var(--gray-500);
    letter-spacing: 0.02em;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

/* Not-configured box */
.tool-no-embed {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    background: var(--warning-light);
    border: 1.5px solid #FCD34D;
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    font-size: var(--text-base);
    color: #92400E;
}

.tool-no-embed span {
    font-size: 28px;
    flex-shrink: 0;
}

.tool-no-embed strong {
    display: block;
    font-weight: var(--fw-bold);
    color: #78350F;
    margin-bottom: 4px;
}

.tool-no-embed p {
    margin: 0;
    font-size: var(--text-sm);
    color: #92400E;
}

.tool-no-embed a {
    color: var(--blue);
    font-weight: var(--fw-semi);
}
