/* ============================================================
   dailytool.me — Cards, grids, tool UI, results, FAQ, ads, misc
   ============================================================ */

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
}

.card-hover { transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease; }
.card-hover:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  height: 100%;
}

.tool-card-head { display: flex; align-items: flex-start; gap: var(--space-3); }

.tool-card-icon {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-50);
  color: var(--brand-600);
  border: 1px solid var(--brand-100);
}

[data-theme="dark"] .tool-card-icon { background: var(--brand-900); color: var(--brand-300); border-color: var(--brand-800); }

.tool-card-icon svg { width: 22px; height: 22px; }

.tool-card h3 {
  margin: 0;
  font-size: 1.05rem;
}
.tool-card h3 a { color: var(--text); }
.tool-card h3 a:hover { color: var(--brand-600); text-decoration: none; }

.tool-card p {
  color: var(--text-muted);
  font-size: 0.925rem;
  margin: 0;
  flex: 1;
}

.tool-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.grid {
  display: grid;
  gap: var(--space-4);
}
.grid-col-2 { grid-template-columns: repeat(2, 1fr); }
.grid-col-3 { grid-template-columns: repeat(3, 1fr); }
.grid-col-4 { grid-template-columns: repeat(4, 1fr); }
.grid-col-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

@media (max-width: 980px) { .grid-col-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .grid-col-3, .grid-col-2, .grid-col-4 { grid-template-columns: 1fr; } }

/* ---------- Category cards ---------- */
.cat-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.cat-card:hover {
  text-decoration: none;
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.cat-card-icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cat-card-icon svg { width: 26px; height: 26px; }

.cat-card h3 { margin: 0 0 2px; font-size: 1.1rem; }
.cat-card p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

.cat-pdf .cat-card-icon { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
[data-theme="dark"] .cat-pdf .cat-card-icon { background: #3b1212; color: #f87171; border-color: #641313; }
.cat-construction .cat-card-icon { background: #fef3c7; color: #d97706; border: 1px solid #fde68a; }
[data-theme="dark"] .cat-construction .cat-card-icon { background: #3d2c07; color: #fbbf24; border-color: #6b4a0a; }
.cat-finance .cat-card-icon { background: #d1fae5; color: #059669; border: 1px solid #a7f3d0; }
[data-theme="dark"] .cat-finance .cat-card-icon { background: #052e1d; color: #34d399; border-color: #0a4a30; }
.cat-calculators .cat-card-icon { background: #dbeafe; color: #2563eb; border: 1px solid #bfdbfe; }
[data-theme="dark"] .cat-calculators .cat-card-icon { background: #101d3a; color: #60a5fa; border-color: #1c3470; }
.cat-media .cat-card-icon { background: #fce7f3; color: #db2777; border: 1px solid #fbcfe8; }
[data-theme="dark"] .cat-media .cat-card-icon { background: #3a1028; color: #f472b6; border-color: #6b1e47; }
.cat-fonts .cat-card-icon { background: #ede9fe; color: #7c3aed; border: 1px solid #ddd6fe; }
[data-theme="dark"] .cat-fonts .cat-card-icon { background: #241642; color: #a78bfa; border-color: #43336b; }

/* ---------- Hero ---------- */
.hero {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: var(--space-16) 0;
  text-align: center;
}

.hero h1 { max-width: 18ch; margin-left: auto; margin-right: auto; }
.hero .hero-sub { max-width: 56ch; margin: 0 auto var(--space-8); color: var(--text-muted); font-size: 1.1rem; }

.hero-search {
  max-width: 560px;
  margin: 0 auto var(--space-5);
  position: relative;
}

.hero-search .search-input {
  padding: var(--space-4) var(--space-6);
  fill: 0;
  font-size: 1.05rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.hero-search .search-input:focus { box-shadow: var(--focus-ring); }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-height: 360px;
  overflow-y: auto;
  padding: var(--space-2);
  text-align: left;
}

.search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--r-sm);
  color: var(--text);
  font-weight: 500;
}

.search-result:hover { background: var(--bg-muted); text-decoration: none; }

.search-result-title { font-weight: 600; }

.search-result-cat {
  flex: none;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}

.hero .popular-links { color: var(--text-muted); font-size: 0.9rem; }
.hero .popular-links a { font-weight: 500; }

.badge-row { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); margin-bottom: var(--space-6); }

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
}
.feature-pill svg { width: 14px; height: 14px; color: var(--accent-600); }

/* ---------- Sections ---------- */
.section { padding: var(--space-16) 0; }
.section-alt { background: var(--bg-subtle); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-head { max-width: 62ch; margin-bottom: var(--space-8); }
.section-head h2 { margin-bottom: var(--space-2); }
.section-head p { color: var(--text-muted); margin: 0; }

.section-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}
.section-head-row .section-head { margin-bottom: 0; }
.link-more { font-weight: 600; font-size: 0.95rem; white-space: nowrap; }

/* ---------- Steps ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
  counter-reset: step;
}

.step {
  position: relative;
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding-top: var(--space-8);
}

.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: -18px;
  left: var(--space-5);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-600);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.step h3 { margin-bottom: var(--space-2); font-size: 1.05rem; }
.step p { margin: 0; color: var(--text-muted); font-size: 0.925rem; }

/* ---------- Feature list ---------- */
.feature-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--space-5); }
.feature-item {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.feature-item svg { flex: none; width: 22px; height: 22px; color: var(--accent-600); margin-top: 2px; }
.feature-item h3 { font-size: 1rem; margin-bottom: var(--space-1); }
.feature-item p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: var(--space-4) 0 var(--space-2);
}
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  align-items: center;
}
.breadcrumbs li { display: flex; align-items: center; gap: var(--space-2); margin: 0; }
.breadcrumbs li + li::before {
  content: "/";
  color: var(--text-faint);
}
.breadcrumbs a { color: var(--text-muted); font-weight: 500; }
.breadcrumbs a:hover { color: var(--brand-600); text-decoration: underline; }
.breadcrumbs [aria-current="page"] { color: var(--text-soft); font-weight: 600; }

/* ---------- Tool page layout ---------- */
.tool-page-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--space-8);
  align-items: start;
}

@media (max-width: 960px) {
  .tool-page-wrap { grid-template-columns: 1fr; }
}

.tool-header-strip { border-bottom: 1px solid var(--border); background: var(--bg-subtle); }
.tool-header-strip .container { padding-top: var(--space-4); padding-bottom: var(--space-6); }

.tool-title-row { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.tool-title-row h1 { margin: 0; }

.tool-page-lead { color: var(--text-muted); max-width: 70ch; margin-top: var(--space-3); }

.tool-shell { margin-top: var(--space-8); }

.sidebar { position: sticky; top: calc(var(--header-h) + var(--space-5)); display: flex; flex-direction: column; gap: var(--space-5); }

/* ---------- Calculator UI ---------- */
.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 760px) { .calc-grid { grid-template-columns: 1fr; } }

.input-panel { }
.result-panel { }

.result-summary-card {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  color: #fff;
  border-radius: var(--r-md);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

.result-summary-card .result-label { font-size: 0.85rem; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.05em; }
.result-summary-card .result-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; word-break: break-word; }
.result-summary-card .result-note { font-size: 0.875rem; opacity: 0.9; margin-top: var(--space-2); }

.result-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.result-meta {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--space-3);
}
.result-meta .meta-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.result-meta .meta-value { font-weight: 700; font-size: 1rem; color: var(--text); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 480px; }

.chart-wrap { margin: var(--space-5) 0; min-height: 260px; }

/* ---------- Alerts / status ---------- */
.alert {
  border-radius: var(--r-sm);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  font-size: 0.925rem;
  border: 1px solid transparent;
}
.alert-info { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-800); }
[data-theme="dark"] .alert-info { background: #141c3a; border-color: #2b3a6b; color: var(--brand-200); }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
[data-theme="dark"] .alert-error { background: #2c0d0d; border-color: #5b1a1a; color: #fca5a5; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
[data-theme="dark"] .alert-success { background: #0a2a17; border-color: #185b32; color: #86efac; }

.status-line[role="status"], .progress-line[role="progressbar"] {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: var(--space-3) 0;
  min-height: 1.4em;
}

progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: var(--bg-muted);
}
progress::-webkit-progress-bar { background: var(--bg-muted); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--brand-500); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--brand-500); border-radius: 999px; }

/* ---------- FAQ ---------- */
.faq-list { display: grid; gap: var(--space-3); }

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.faq-item summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--text-muted);
  flex: none;
  transition: transform 0.15s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:hover { background: var(--bg-subtle); }
.faq-item .faq-answer { padding: 0 var(--space-5) var(--space-4); color: var(--text-soft); }

/* ---------- Ads ---------- */
.ad-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text-faint);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  min-height: 90px;
  margin: var(--space-5) 0;
  overflow: hidden;
}
.ad-container::before {
  content: "Advertisement";
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}
.ad-container > div { padding: var(--space-4); margin-top: 12px; }
.ad-slot { width: 100%; display: flex; align-items: center; justify-content: center; }
.ad-slot[data-size="leaderboard"] { min-height: 90px; }
.ad-slot[data-size="rectangle"] { min-height: 250px; }
.ad-slot[data-size="sidebar"] { min-height: 300px; }
.ad-slot[data-size="mobile-banner"] { min-height: 50px; }
.ad-label {
  font-size: 0.65rem;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ---------- File dropzone ---------- */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: var(--space-10) var(--space-5);
  text-align: center;
  background: var(--bg-subtle);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--text-muted);
}
.dropzone:hover { border-color: var(--brand-400); background: var(--brand-50); }
[data-theme="dark"] .dropzone:hover { background: #141c3a; }
.dropzone[data-drag="true"] { border-color: var(--brand-500); background: var(--brand-50); }
[data-theme="dark"] .dropzone[data-drag="true"] { background: #141c3a; }
.dropzone svg { width: 40px; height: 40px; color: var(--brand-400); }
.dropzone b { color: var(--text); font-weight: 600; }
.dropzone .dz-hint { font-size: 0.85rem; }

.file-list-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: var(--space-2);
  background: var(--surface);
  flex-wrap: wrap;
}
.file-list-row .fname { flex: 1; min-width: 160px; word-break: break-word; font-weight: 500; }
.file-list-row .fmeta { color: var(--text-muted); font-size: 0.85rem; }
.file-list-row .remove-file {
  border: none;
  background: var(--bg-muted);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  cursor: pointer;
  flex: none;
}
.file-list-row .remove-file:hover { color: var(--danger-600); }

.handle-wrap { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.handle-up, .handle-down {
  border: 1px solid var(--border);
  background: var(--surface);
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-soft);
}
.handle-up:hover, .handle-down:hover { background: var(--bg-muted); }
.handle-up:disabled, .handle-down:disabled { opacity: 0.4; cursor: default; }

/* ---------- Related tools ---------- */
.related-tools { margin-top: var(--space-8); }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.related-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.related-link:hover { text-decoration: none; box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.related-link svg { flex: none; width: 20px; height: 20px; color: var(--brand-500); }

/* ---------- CTA ---------- */
.cta-panel {
  background: linear-gradient(135deg, var(--brand-600), var(--accent-600));
  border-radius: var(--r-lg);
  padding: var(--space-12);
  text-align: center;
  color: #fff;
}
.cta-panel h2 { color: #fff; }
.cta-panel p { color: rgba(255,255,255,0.9); max-width: 52ch; margin: 0 auto var(--space-6); }
.cta-panel .btn { background: #fff; color: var(--brand-700); }
.cta-panel .btn:hover { background: var(--bg-muted); }

/* ---------- Article / prose ---------- */
.prose { font-size: 1rem; color: var(--text-soft); }
.prose h2 { margin-top: var(--space-8); }
.prose h3 { margin-top: var(--space-6); color: var(--text); }
.prose ul, .prose ol { margin-bottom: var(--space-4); }
.prose li { line-height: 1.7; }
.prose img { border-radius: var(--r-md); margin: var(--space-5) 0; }
.prose table { margin: var(--space-5) 0; }

/* ---------- Blog ---------- */
.blog-card .blog-meta { color: var(--text-muted); font-size: 0.85rem; margin-top: var(--space-3); display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.blog-excerpt { color: var(--text-muted); }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: var(--space-20) 0; }
.notfound .nf-code { font-size: clamp(4rem, 12vw, 7rem); font-weight: 800; letter-spacing: -0.04em; background: linear-gradient(135deg, var(--brand-500), var(--accent-500)); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; margin-bottom: var(--space-4); }

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .ad-container, .tool-actions, .no-print, .sidebar, .btn-print { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .card, .tool-shell { box-shadow: none !important; border-color: #ccc !important; }
  .result-summary-card { background: #eee !important; color: #000 !important; }
  a { color: #000 !important; }
  .tool-page-wrap { grid-template-columns: 1fr !important; }
  .container { max-width: 100% !important; }
}