/* ============================================
   ToolFlash — Global Stylesheet v1.0
   ============================================ */

/* 1. Design Tokens */
:root {
  --color-primary:       #2563EB;
  --color-primary-dark:  #1D4ED8;
  --color-primary-light: #EFF6FF;
  --color-success:       #10B981;
  --color-warning:       #F59E0B;
  --color-danger:        #EF4444;
  --color-bg:            #F0F4F8;
  --color-card:          #FFFFFF;
  --color-text:          #0F172A;
  --color-muted:         #64748B;
  --color-border:        #E2E8F0;
  --color-ad-bg:         #F8FAFC;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);

  --container-width: 980px;
}

/* 2. Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 70px; }
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 3. Layout */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* 4. Header */
.site-header {
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-text);
  text-decoration: none;
}
.logo:hover { text-decoration: none; }
.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.85rem;
  font-weight: 800;
}
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-muted);
  transition: background 0.15s, color 0.15s;
}
.site-nav a:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  text-decoration: none;
}

/* 5. Page Hero */
.page-hero {
  background: linear-gradient(135deg, #EFF6FF 0%, #F0F4F8 100%);
  padding: 28px 0 22px;
  border-bottom: 1px solid var(--color-border);
}
.breadcrumb {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-bottom: 8px;
}
.breadcrumb a { color: var(--color-muted); }
.breadcrumb a:hover { color: var(--color-primary); }
.page-hero h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  color: var(--color-text);
  line-height: 1.2;
  margin-bottom: 6px;
}
.page-hero .subtitle { font-size: 1rem; color: var(--color-muted); }

/* 6. Tool Card */
.tool-section { padding: 24px 0; }
.tool-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px;
  border: 1px solid var(--color-border);
}

/* 7. Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid transparent;
  line-height: 1;
  font-family: var(--font-sans);
}
.btn:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 2px; }
.btn-primary { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); text-decoration: none; }
.btn-secondary { background: transparent; color: var(--color-primary); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-primary-light); border-color: var(--color-primary); text-decoration: none; }
.btn-success { background: var(--color-success); color: white; border-color: var(--color-success); }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.875rem; }

/* 8. Form Elements */
input[type="text"], input[type="number"], input[type="email"], input[type="tel"],
input[type="url"], input[type="search"], input[type="date"], textarea, select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: white;
  transition: border-color 0.15s;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--color-primary); }
textarea { resize: vertical; min-height: 140px; }

/* Checkbox group */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  user-select: none;
  font-size: 0.9375rem;
  font-weight: 500;
}
.checkbox-item:hover { border-color: var(--color-primary); background: var(--color-primary-light); }
.checkbox-item input[type="checkbox"] {
  width: 16px; height: 16px;
  padding: 0; border: none;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.checkbox-item.checked { border-color: var(--color-primary); background: var(--color-primary-light); color: var(--color-primary); }

/* Range slider */
.slider-wrapper { margin: 14px 0; }
.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.9375rem;
  font-weight: 500;
}
.slider-value {
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding: 3px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.875rem;
}
input[type="range"] {
  width: 100%; padding: 0;
  height: 6px;
  -webkit-appearance: none; appearance: none;
  background: var(--color-border);
  border-radius: 3px;
  outline: none; border: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer; border: none;
}

/* Result display */
.result-box {
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  word-break: break-all;
  min-height: 52px;
  display: flex;
  align-items: center;
  color: var(--color-text);
  flex: 1;
}
.result-display-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-top: 16px;
}

/* Strength meter */
.strength-meter { margin-top: 14px; }
.strength-bar { display: flex; gap: 4px; margin-bottom: 6px; }
.strength-segment {
  height: 6px; flex: 1;
  border-radius: 3px;
  background: var(--color-border);
  transition: background 0.3s;
}
.strength-label { font-size: 0.8125rem; color: var(--color-muted); font-weight: 500; }

/* Stat row */
.stat-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.stat-box {
  flex: 1;
  min-width: 100px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  text-align: center;
}
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--color-primary); display: block; }
.stat-label { font-size: 0.8rem; color: var(--color-muted); }

/* 9. Ad Slots */
.ad-slot { margin: 28px 0; text-align: center; }
.ad-slot-label {
  font-size: 0.65rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: #CBD5E1; margin-bottom: 6px;
}
.ad-placeholder {
  background: #FAFBFC;
  border: 1px solid #F1F5F9;
  border-radius: var(--radius-md);
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #E2E8F0;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

/* 10. Content Sections */
.content-section { padding: 28px 0; }
.content-section + .content-section { padding-top: 0; }
.content-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--color-border);
}
.content-section p {
  color: var(--color-muted);
  margin-bottom: 12px;
  line-height: 1.75;
}
.content-section ul, .content-section ol {
  margin: 10px 0 12px 24px;
  color: var(--color-muted);
}
.content-section li { margin-bottom: 6px; line-height: 1.6; }

/* Steps */
.steps-list { list-style: none; padding: 0; counter-reset: steps; }
.steps-list li {
  counter-increment: steps;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
  padding: 14px 16px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  line-height: 1.6;
}
.steps-list li::before {
  content: counter(steps);
  min-width: 28px; height: 28px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* 11. FAQ */
.faq-section { padding: 0 0 28px; }
.faq-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--color-border);
}
.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-question {
  padding: 16px 20px;
  background: var(--color-card);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: background 0.15s;
  border: none;
  width: 100%;
  text-align: left;
  color: var(--color-text);
  font-family: var(--font-sans);
}
.faq-question:hover { background: var(--color-bg); }
.faq-arrow { transition: transform 0.2s; color: var(--color-muted); flex-shrink: 0; margin-left: 12px; }
.faq-item.open .faq-arrow { transform: rotate(180deg); }
.faq-answer {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s;
  background: var(--color-bg);
  font-size: 0.9375rem;
  color: var(--color-muted);
  line-height: 1.7;
}
.faq-item.open .faq-answer { padding: 16px 20px; max-height: 400px; }

/* 12. Related Tools */
.related-section { padding: 0 0 40px; }
.related-section h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 14px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.related-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-text);
}
.related-card:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.related-icon {
  width: 36px; height: 36px;
  background: var(--color-primary-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.related-name { font-weight: 600; font-size: 0.875rem; line-height: 1.3; }

/* 13. Footer */
.site-footer { background: #1E293B; color: #94A3B8; padding: 36px 0 24px; margin-top: 10px; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 28px;
}
.footer-brand .logo { color: white; margin-bottom: 10px; }
.footer-brand p { font-size: 0.875rem; line-height: 1.6; }
.footer-col h4 { color: #E2E8F0; font-size: 0.875rem; font-weight: 600; margin-bottom: 12px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: #94A3B8; font-size: 0.875rem; transition: color 0.15s; }
.footer-col a:hover { color: white; text-decoration: none; }
.footer-bottom {
  padding-top: 20px;
  border-top: 1px solid #334155;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-bottom a { color: #64748B; }
.footer-bottom a:hover { color: #94A3B8; text-decoration: none; }

/* 14. Utilities */
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.text-muted { color: var(--color-muted); }
.text-sm { font-size: 0.875rem; }
.divider { height: 1px; background: var(--color-border); margin: 8px 0; }

/* 15. Mobile Navigation (hamburger) */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.hamburger-btn:hover { background: var(--color-bg); }
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: all 0.3s;
}
.hamburger-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
  display: none;
  position: fixed;
  top: 60px;
  left: 0; right: 0;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  z-index: 99;
  box-shadow: var(--shadow-md);
}
.mobile-nav.open { display: block; }
.mobile-nav a {
  display: block;
  padding: 14px 20px;
  font-weight: 500;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  font-size: 1rem;
  transition: background 0.15s;
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  text-decoration: none;
}

/* noscript warning */
.noscript-warning {
  background: #fef2f2;
  color: #dc2626;
  text-align: center;
  padding: 16px 20px;
  font-size: 0.9375rem;
  border-bottom: 2px solid #fca5a5;
}

/* 16. Responsive */
@media (max-width: 768px) {
  .site-nav { display: none; }
  .hamburger-btn { display: flex; }
  .tool-card { padding: 20px; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .result-display-row { flex-direction: column; }
}
@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .tool-card { padding: 16px; }
  .page-hero h1 { font-size: 1.5rem; }
  .btn { padding: 11px 18px; }
}

/* 17. Back to Top */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s, transform 0.25s;
  z-index: 999;
}
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { transform: translateY(-3px); background: var(--color-primary-dark); }
