/* ===== toolovo.pl — wspólny system designu ===== */

:root {
  --bg: #ffffff;
  --bg-card: #f8fafc;
  --text: #0f172a;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --cta: #f97316;
  --cta-hover: #ea6a0c;
  --success-bg: #dcfce7;
  --success-text: #16a34a;
  --danger: #dc2626;
  --radius-sm: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --border: #334155;
  --accent: #3b82f6;
  --accent-soft: #1e2b4d;
  --cta: #fb923c;
  --cta-hover: #f9a35c;
  --success-bg: #14301f;
  --success-text: #4ade80;
  --danger: #f87171;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body > main { flex: 1 0 auto; width: 100%; }
body > .site-footer { flex-shrink: 0; }

@media (prefers-reduced-motion: no-preference) {
  body,
  .site-header,
  .site-footer,
  .card,
  .stat-card,
  .tool-input,
  .btn,
  .badge,
  .faq-item,
  .faq-answer-wrap,
  .theme-toggle,
  input[type="range"],
  .search-tools input {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  }
  .card, .btn, .theme-toggle {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.12s ease;
  }
  .faq-icon { transition: transform 0.2s ease; }
  .faq-answer-wrap { transition: max-height 0.25s ease, opacity 0.2s ease; }
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 { font-weight: 600; line-height: 1.3; margin: 0 0 8px; }
h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
p { margin: 0 0 12px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

@media (max-width: 768px) {
  h1 { font-size: 24px; }
  h2 { font-size: 20px; }
  .wrap { padding: 0 16px; }
}

/* ===== Header ===== */

.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-weight: 600;
  font-size: 18px;
  color: var(--text);
}
.logo:hover { text-decoration: none; }
.logo span { color: var(--accent); }

.main-nav {
  display: flex;
  gap: 24px;
}
.main-nav a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}
.main-nav a:hover { color: var(--text); text-decoration: none; }

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover { border-color: var(--text-secondary); }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text);
}

@media (max-width: 768px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    padding: 8px 16px 16px;
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .nav-toggle { display: block; }
  .footer-links {font-size: 10px;}
}

/* ===== Breadcrumbs ===== */

.breadcrumbs {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 20px 0 16px;
}
.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs a:hover { color: var(--accent); }

/* ===== Badge ===== */

.badge {
  display: inline-block;
  background: var(--success-bg);
  color: var(--success-text);
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  vertical-align: middle;
}

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.btn:hover { border-color: var(--text-secondary); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--cta);
  border-color: var(--cta);
  color: #ffffff;
}
.btn-primary:hover { background: var(--cta-hover); border-color: var(--cta-hover); }

/* ===== Tool widget ===== */

.tool-input {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}
.tool-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="number"].tool-input,
input[type="text"].tool-input { resize: none; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.stat-card.highlight {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
}
.stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-card.highlight .stat-label { color: var(--accent); }
.stat-value { font-size: 26px; font-weight: 600; }
.stat-card.highlight .stat-value { color: var(--accent); }

.tool-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* ===== Content sections ===== */

.section {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.section p { color: var(--text-secondary); font-size: 14px; }

/* ===== FAQ ===== */

.faq-item {
  border-bottom: 1px solid var(--border);
}
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  background: none;
  border: none;
  padding: 14px 0;
  text-align: left;
}
.faq-icon {
  font-size: 18px;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-left: 12px;
}
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-answer-wrap {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}
.faq-item.open .faq-answer-wrap { opacity: 1; }
.faq-answer {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 14px;
}

/* ===== Cards / grid ===== */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.card {
  display: block;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  color: var(--text);
}
.card:hover { text-decoration: none; border-color: var(--text-secondary); }
@media (prefers-reduced-motion: no-preference) {
  .card { transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease; }
  .card:hover { transform: translateY(-2px); }
}
.card-icon { font-size: 22px; margin-bottom: 8px; display: block; }
.card-title { font-weight: 500; font-size: 14px; margin-bottom: 4px; }
.card-desc { font-size: 13px; color: var(--text-secondary); }

.category-card {
  border: 1px solid var(--border);
}

/* ===== Hero (homepage) ===== */

.hero {
  padding: 56px 0 40px;
  text-align: center;
}
.hero p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 24px;
}
.search-tools {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}
.search-tools input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text);
}
.search-tools input:focus {
  outline: none;
  border-color: var(--accent);
}
.search-results {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 6px);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: left;
  overflow: hidden;
  z-index: 20;
  max-height: 340px;
  overflow-y: auto;
}
.search-result-item {
  display: block;
  padding: 12px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover, .search-result-item.active {
  background: var(--bg-card);
  text-decoration: none;
}
.search-result-name { font-size: 14px; font-weight: 500; }
.search-result-cat { font-size: 12px; color: var(--text-secondary); }
.search-result-empty { padding: 14px 16px; font-size: 13px; color: var(--text-secondary); }

/* ===== Cookie banner ===== */

.cookie-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 18px 24px;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.cookie-banner .wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
}
.cookie-text { flex: 1; min-width: 240px; font-size: 13px; color: var(--text-secondary); }
.cookie-text a { color: var(--accent); }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cookie-categories {
  max-width: var(--max-width);
  margin: 16px auto 0;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: none;
}
.cookie-banner.expanded .cookie-categories { display: block; }
.cookie-cat-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
}
.cookie-cat-row + .cookie-cat-row { border-top: 1px solid var(--border); }
.cookie-cat-title { font-weight: 500; font-size: 14px; }
.cookie-cat-desc { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.cookie-switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.cookie-switch input { opacity: 0; width: 0; height: 0; }
.cookie-switch-track {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 11px;
  transition: background 0.15s ease;
}
.cookie-switch-track::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
}
.cookie-switch input:checked + .cookie-switch-track { background: var(--accent); }
.cookie-switch input:checked + .cookie-switch-track::before { transform: translateX(18px); }
.cookie-switch input:disabled + .cookie-switch-track { opacity: 0.5; }

@media (max-width: 640px) {
  .cookie-banner .wrap { flex-direction: column; align-items: stretch; }
  .cookie-actions { justify-content: stretch; }
  .cookie-actions .btn { flex: 1; }
  .footer-links {font-size: 9px;}
}

/* ===== Footer ===== */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 64px;
  font-size: 13px;
  color: var(--text-secondary);
}
.footer-sitemap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 24px;
}
.footer-sitemap h4 {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 10px;
  font-weight: 600;
}
.footer-sitemap ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.footer-sitemap a { color: var(--text-secondary); font-size: 13px; }
.footer-sitemap a:hover { color: var(--accent); text-decoration: none; }
.site-footer .wrap {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--text-secondary); }
.footer-links a:hover { color: var(--accent); }
