/* ===========================
   TaskToolsAI — Global Styles
   =========================== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #4F46E5;
  --primary-dark:  #3730A3;
  --primary-light: #818CF8;
  --accent:        #22C55E;
  --accent-dark:   #16A34A;

  --bg:            #FFFFFF;
  --bg-secondary:  #F8FAFC;
  --bg-card:       #FFFFFF;
  --border:        #E2E8F0;

  --text:          #0F172A;
  --text-muted:    #64748B;
  --text-light:    #94A3B8;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 30px rgba(0,0,0,.12);

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

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --transition: .2s ease;
}

[data-theme="dark"] {
  --bg:           #0F172A;
  --bg-secondary: #1E293B;
  --bg-card:      #1E293B;
  --border:       #334155;
  --text:         #F1F5F9;
  --text-muted:   #94A3B8;
  --text-light:   #64748B;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,.4);
  --shadow-lg:  0 8px 30px rgba(0,0,0,.5);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  transition: background var(--transition), color var(--transition);
}

img { max-width: 100%; display: block; }
a  { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
ul { list-style: none; }

/* --- Typography --- */
h1, h2, h3, h4, h5 {
  line-height: 1.25;
  font-weight: 700;
  color: var(--text);
}
h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }
p  { color: var(--text-muted); line-height: 1.75; }

/* --- Layout Utilities --- */
.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
}

.section { padding: 72px 0; }
.section-sm { padding: 40px 0; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: .5rem; }
.gap-4 { gap: 1rem; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

/* --- Card --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: var(--font);
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,70,229,.35);
}
.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--accent-dark);
  color: #fff;
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}
.btn-lg { padding: .85rem 1.9rem; font-size: 1rem; }
.btn-sm { padding: .45rem 1rem; font-size: .82rem; }

/* --- Badge --- */
.badge {
  display: inline-block;
  padding: .25rem .7rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-primary { background: rgba(79,70,229,.12); color: var(--primary); }
.badge-accent   { background: rgba(34,197,94,.12);  color: var(--accent-dark); }

/* ===========================
   HEADER
   =========================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.logo span { color: var(--primary); }
.logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}
.nav a {
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  transition: color var(--transition);
}
.nav a:hover, .nav a.active { color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: .75rem; }

/* Dark mode toggle */
.theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: .45rem .6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .35rem;
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 500;
  transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle svg { width: 16px; height: 16px; }

/* Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ===========================
   FOOTER
   =========================== */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 56px 0 28px;
  margin-top: 80px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.footer-brand p {
  margin-top: .75rem;
  font-size: .875rem;
  max-width: 280px;
}

.footer-col h4 {
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-light);
  margin-bottom: .9rem;
}
.footer-col ul li { margin-bottom: .5rem; }
.footer-col ul li a {
  color: var(--text-muted);
  font-size: .875rem;
  transition: color var(--transition);
}
.footer-col ul li a:hover { color: var(--primary); }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  font-size: .82rem;
  color: var(--text-light);
  flex-wrap: wrap;
  gap: .75rem;
}
.footer-bottom a { color: var(--text-light); }
.footer-bottom a:hover { color: var(--primary); }

/* ===========================
   AD PLACEHOLDERS
   =========================== */
.ad-placeholder {
  display: block;
  min-height: 90px;
  margin: 2rem 0;
}

/* ===========================
   TOOL LAYOUT
   =========================== */
.tool-page { padding: 2.5rem 0 4rem; }

.tool-header { margin-bottom: 2rem; }
.tool-header h1 { margin-bottom: .5rem; }
.tool-header p  { font-size: 1.05rem; }

.tool-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.tool-textarea {
  width: 100%;
  min-height: 180px;
  padding: .9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text);
  font-family: 'Courier New', monospace;
  font-size: .9rem;
  resize: vertical;
  transition: border-color var(--transition);
  line-height: 1.6;
}
.tool-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.tool-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.tool-result {
  position: relative;
}
.copy-btn {
  position: absolute;
  top: .6rem;
  right: .6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .3rem .7rem;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}
.copy-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Stats bar */
.tool-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: .75rem 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-top: .75rem;
  font-size: .83rem;
  color: var(--text-muted);
}
.tool-stats strong { color: var(--text); }

/* ===========================
   SEO CONTENT BLOCK
   =========================== */
.seo-content { margin-top: 3rem; }
.seo-content h2 { margin-bottom: .75rem; margin-top: 2rem; }
.seo-content h3 { margin-bottom: .5rem; margin-top: 1.5rem; }
.seo-content p  { margin-bottom: 1rem; }
.seo-content ul { margin: .75rem 0 1rem 1.25rem; list-style: disc; }
.seo-content ul li { color: var(--text-muted); margin-bottom: .35rem; }

/* ===========================
   FAQ
   =========================== */
.faq { margin-top: 3rem; }
.faq h2 { margin-bottom: 1.5rem; }

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: .75rem;
  overflow: hidden;
}
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: .95rem;
  background: var(--bg-card);
  color: var(--text);
  transition: background var(--transition);
  user-select: none;
}
.faq-question:hover { background: var(--bg-secondary); }
.faq-question .faq-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
  transition: transform var(--transition);
}
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-answer {
  display: none;
  padding: 0 1.25rem 1rem;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: .92rem;
  line-height: 1.7;
}
.faq-item.open .faq-answer { display: block; }

/* ===========================
   RELATED TOOLS / LINKS
   =========================== */
.related-tools { margin-top: 3rem; }
.related-tools h2 { margin-bottom: 1.25rem; }

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.related-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-weight: 600;
  font-size: .875rem;
  transition: all var(--transition);
  text-decoration: none;
}
.related-card:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.related-card .icon {
  width: 36px; height: 36px;
  background: rgba(79,70,229,.1);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ===========================
   BREADCRUMB
   =========================== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--text-light); }

/* ===========================
   BLOG
   =========================== */
.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.blog-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.blog-card-body { padding: 1.5rem; flex: 1; }
.blog-card-body h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.blog-card-meta {
  font-size: .78rem;
  color: var(--text-light);
  margin-bottom: .75rem;
  display: flex;
  gap: .75rem;
}
.blog-card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .82rem;
}

/* Blog article */
.article-content h2 { margin: 2rem 0 .75rem; }
.article-content h3 { margin: 1.5rem 0 .5rem; }
.article-content p  { margin-bottom: 1.1rem; }
.article-content ul, .article-content ol {
  margin: .75rem 0 1.25rem 1.5rem;
}
.article-content li { margin-bottom: .4rem; color: var(--text-muted); }
.article-content strong { color: var(--text); }

/* ===========================
   HERO (homepage)
   =========================== */
.hero {
  padding: 80px 0 64px;
  text-align: center;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-secondary) 100%);
  border-bottom: 1px solid var(--border);
}
.hero-badge { margin-bottom: 1.25rem; }
.hero h1 { margin-bottom: 1.1rem; }
.hero p {
  font-size: 1.15rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}
.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

/* Search bar */
.search-wrap {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}
.search-wrap input {
  width: 100%;
  padding: .85rem 1.1rem .85rem 3rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  color: var(--text);
  font-size: .95rem;
  font-family: var(--font);
  transition: border-color var(--transition);
}
.search-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79,70,229,.1);
}
.search-wrap input::placeholder { color: var(--text-light); }
.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

/* ===========================
   CATEGORIES
   =========================== */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: 1.25rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  font-weight: 600;
  font-size: .875rem;
  color: var(--text);
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
}
.category-card .cat-icon {
  font-size: 1.75rem;
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: rgba(79,70,229,.08);
}
.category-card:hover {
  border-color: var(--primary);
  background: rgba(79,70,229,.04);
  color: var(--primary);
}

/* ===========================
   TOOLS GRID
   =========================== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
}
.tool-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.tool-card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1rem;
}
.tool-card h3 {
  font-size: 1rem;
  margin-bottom: .4rem;
  color: var(--text);
}
.tool-card p {
  font-size: .85rem;
  line-height: 1.55;
  flex: 1;
}
.tool-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
  font-size: .78rem;
  color: var(--text-light);
}

/* ===========================
   SECTION HEADERS
   =========================== */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.section-header h2 { margin-bottom: 0; }
.section-header p   { color: var(--text-muted); font-size: .9rem; }

/* ===========================
   NOTIFICATIONS / TOASTS
   =========================== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--text);
  color: var(--bg);
  padding: .75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 500;
  z-index: 999;
  opacity: 0;
  transform: translateY(8px);
  transition: all .25s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .nav { display: none; flex-direction: column; gap: 1rem; }
  .nav.open {
    display: flex;
    position: absolute;
    top: 64px;
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    z-index: 99;
  }
  .menu-toggle { display: flex; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .hero { padding: 48px 0 40px; }
  .section { padding: 48px 0; }
}

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; align-items: stretch; }
  .tool-actions  { flex-direction: column; align-items: stretch; }
  .btn-lg { text-align: center; justify-content: center; }
}

/* ===========================
   CONTACT PAGE — responsive grid
   =========================== */
@media (max-width: 700px) {
  .contact-layout {
    grid-template-columns: 1fr !important;
  }
}

/* ===========================
   PRINT
   =========================== */
@media print {
  .site-header, .site-footer, .ad-placeholder, .theme-toggle, .menu-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: underline; }
}

/* ===========================
   FOCUS ACCESSIBILITY
   =========================== */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===========================
   SELECTION COLOR
   =========================== */
::selection {
  background: rgba(79,70,229,.18);
  color: var(--text);
}
