/* ══════════════════════════════════════
   ToolSnap.org — Main Stylesheet
   Dark/Light Theme + RTL + Responsive
   ══════════════════════════════════════ */

/* ── CSS Variables / Theme ── */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fa;
  --bg-header: rgba(255,255,255,0.92);
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #8a8a9a;
  --border-color: #e8e8ee;
  --border-light: #f0f0f5;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #eef2ff;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-text: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --transition: 0.2s ease;
  --max-width: 1240px;
  --header-height: 64px;
}

[data-theme="dark"] {
  --bg-primary: #0f0f1a;
  --bg-secondary: #161625;
  --bg-tertiary: #1c1c30;
  --bg-card: #1a1a2e;
  --bg-card-hover: #222240;
  --bg-header: rgba(15,15,26,0.92);
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #606078;
  --border-color: #2a2a40;
  --border-light: #1e1e35;
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-light: #1e1b4b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
}

/* ── Reset ── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}
body{
  font-family:var(--font-sans);
  background:var(--bg-primary);
  color:var(--text-primary);
  line-height:1.6;
  min-height:100vh;
  display:flex;
  flex-direction:column;
  transition: background var(--transition), color var(--transition);
}
a{color:var(--accent);text-decoration:none;transition:color var(--transition)}
a:hover{color:var(--accent-hover)}
img{max-width:100%;height:auto}
button{cursor:pointer;font-family:inherit}

/* ── Header ── */
.header{
  position:sticky;
  top:0;z-index:100;
  background:var(--bg-header);
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
  border-bottom:1px solid var(--border-color);
  height:var(--header-height);
  transition: background var(--transition), border-color var(--transition);
}
.header-inner{
  max-width:var(--max-width);
  margin:0 auto;
  padding:0 24px;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.logo{
  font-size:1.35rem;
  font-weight:700;
  color:var(--text-primary);
  display:flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
  transition:color var(--transition);
}
.logo:hover{color:var(--accent)}
.nav{display:flex;gap:8px;align-items:center}
.nav-link{
  padding:8px 14px;
  border-radius:var(--radius-sm);
  color:var(--text-secondary);
  font-size:0.9rem;
  font-weight:500;
  transition:all var(--transition);
}
.nav-link:hover,.nav-link.active{
  background:var(--bg-tertiary);
  color:var(--text-primary);
}
.header-actions{display:flex;align-items:center;gap:8px}
.icon-btn{
  width:40px;height:40px;
  border:none;
  border-radius:var(--radius-sm);
  background:transparent;
  color:var(--text-secondary);
  font-size:1.1rem;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:all var(--transition);
}
.icon-btn:hover{background:var(--bg-tertiary);color:var(--text-primary)}

.theme-toggle .icon-sun{display:inline}
.theme-toggle .icon-moon{display:none}
[data-theme="dark"] .theme-toggle .icon-sun{display:none}
[data-theme="dark"] .theme-toggle .icon-moon{display:inline}

/* Language Selector */
.lang-selector{position:relative}
.lang-btn{
  width:auto;padding:6px 10px;gap:4px;
  font-size:0.85rem;
}
.lang-arrow{font-size:0.65rem;opacity:0.6}
.lang-dropdown{
  position:absolute;
  top:calc(100% + 6px);
  right:0;
  background:var(--bg-card);
  border:1px solid var(--border-color);
  border-radius:var(--radius-md);
  box-shadow:var(--shadow-lg);
  min-width:180px;
  max-height:340px;
  overflow-y:auto;
  z-index:200;
  display:none;
  padding:6px;
}
.lang-dropdown.open{display:block}
.lang-option{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:var(--radius-sm);
  color:var(--text-primary);
  font-size:0.9rem;
  transition:background var(--transition);
}
.lang-option:hover{background:var(--bg-tertiary)}
.lang-option.active{background:var(--accent-light);color:var(--accent);font-weight:600}
.lang-option:not([href]){cursor:pointer}
/* Language flag image */
.lang-flag-img{border-radius:2px;vertical-align:middle;flex-shrink:0}
.lang-btn .lang-flag-img{margin-right:0}
.lang-option img{border-radius:2px;vertical-align:middle;margin-right:8px;flex-shrink:0}

/* Mobile menu button */
.mobile-menu-btn{display:none}

/* Mobile Nav */
.mobile-nav{
  display:none;
  position:fixed;top:var(--header-height);left:0;right:0;bottom:0;
  background:var(--bg-primary);
  z-index:90;
  padding:20px;
}
.mobile-nav.open{display:block}
.mobile-nav-inner{display:flex;flex-direction:column;gap:4px}
.mobile-nav-link{
  padding:14px 16px;
  font-size:1.1rem;
  color:var(--text-secondary);
  border-radius:var(--radius-sm);
  transition:all var(--transition);
}
.mobile-nav-link:hover{background:var(--bg-tertiary);color:var(--text-primary)}

/* ── Main Content ── */
main{flex:1}
.page{animation:fadeIn 0.3s ease}

@keyframes fadeIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}

/* ── Hero ── */
.hero{
  text-align:center;
  padding:80px 24px 64px;
  max-width:800px;
  margin:0 auto;
}
.hero-title{
  font-size:3.2rem;
  font-weight:800;
  line-height:1.2;
  margin-bottom:16px;
  letter-spacing:-0.02em;
}
.gradient-text{
  background:var(--gradient-text);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text;
}
.hero-subtitle{
  font-size:1.2rem;
  color:var(--text-secondary);
  margin-bottom:32px;
  line-height:1.7;
}
.hero-actions{display:flex;gap:14px;justify-content:center;flex-wrap:wrap}
.btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:14px 28px;
  border-radius:var(--radius-md);
  font-size:1rem;
  font-weight:600;
  border:none;
  transition:all var(--transition);
}
.btn-primary{
  background:var(--accent-gradient);
  color:#fff;
  box-shadow:0 4px 15px rgba(99,102,241,0.3);
}
.btn-primary:hover{transform:translateY(-2px);box-shadow:0 6px 20px rgba(99,102,241,0.4);color:#fff}
.btn-outline{
  border:2px solid var(--border-color);
  color:var(--text-primary);
  background:transparent;
}
.btn-outline:hover{border-color:var(--accent);color:var(--accent);background:var(--accent-light)}

/* ── Sections ── */
section{padding:64px 24px}
.section-title{
  text-align:center;
  font-size:2rem;
  font-weight:700;
  margin-bottom:12px;
}
.section-desc{
  text-align:center;
  color:var(--text-secondary);
  max-width:600px;
  margin:0 auto 40px;
  font-size:1.05rem;
}
.categories,.tools-section,.why-section{
  max-width:var(--max-width);
  margin:0 auto;
}

/* ── Category Grid ── */
.category-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:14px;
  margin-top:32px;
}
.category-card{
  background:var(--bg-card);
  border:1px solid var(--border-color);
  border-radius:var(--radius-lg);
  transition:all var(--transition);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.category-card:hover{
  box-shadow:var(--shadow-md);
  border-color:var(--accent);
}
.category-card-main{
  padding:24px;
  display:block;
  color:var(--text-primary);
  flex:1;
  transition:background var(--transition);
}
.category-card-main:hover{
  background:var(--bg-card-hover);
}
.cat-icon{font-size:2rem;display:block;margin-bottom:12px}
.category-card h3{font-size:1.1rem;font-weight:600;margin-bottom:6px}
.category-card p{font-size:0.88rem;color:var(--text-muted);line-height:1.5}
.cat-sublink{
  display:block;
  padding:10px 24px 14px;
  border-top:1px dashed var(--border-color);
  font-size:0.78rem;
  color:var(--accent);
  transition:all var(--transition);
}
.cat-sublink:hover{background:var(--accent-light);color:var(--accent-hover)}

/* ── Tools Grid ── */
.tools-grid{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:12px;
}
.tool-card{
  background:var(--bg-card);
  border:1px solid var(--border-color);
  border-radius:var(--radius-md);
  padding:20px;
  transition:all var(--transition);
  display:flex;
  flex-direction:column;
  gap:8px;
  color:var(--text-primary);
}
.tool-card:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow-md);
  border-color:var(--accent);
  background:var(--bg-card-hover);
}
.tool-icon{font-size:1.6rem;line-height:1}
.tool-card h3{font-size:0.95rem;font-weight:600}
.tool-card p{font-size:0.82rem;color:var(--text-muted);line-height:1.5}
/* External tool card */
.tool-card.external-tool{border-color:var(--accent);border-style:dashed}
.tool-card.external-tool:hover{border-color:var(--accent-hover);background:var(--accent-light)}
.external-badge{font-size:0.7rem;opacity:0.6;vertical-align:super}

/* ── Why Section ── */
.why-section{background:var(--bg-secondary);max-width:100%;margin-top:32px;padding:64px 24px}
.why-section .section-title{margin-bottom:40px}
.why-grid{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:20px;
  max-width:var(--max-width);
  margin:0 auto;
}
.why-card{
  text-align:center;
  padding:32px 20px;
}
.why-icon{font-size:2.5rem;display:block;margin-bottom:16px}
.why-card h3{font-size:1.1rem;font-weight:600;margin-bottom:8px}
.why-card p{font-size:0.9rem;color:var(--text-muted);line-height:1.6}

/* ── SEO Content Section ── */
.seo-section{max-width:var(--max-width);margin:0 auto;padding:48px 24px 64px}
.seo-content{max-width:820px;margin:0 auto}
.seo-content h2{font-size:1.5rem;font-weight:700;margin-bottom:24px;color:var(--text-primary)}
.seo-content p{font-size:0.95rem;color:var(--text-secondary);line-height:1.85;margin-bottom:18px}
.seo-content a{font-weight:600;text-decoration:underline;text-underline-offset:2px}
.seo-content a:hover{color:var(--accent-hover)}

/* ── Legal Pages ── */
.legal-page{
  max-width:760px;
  margin:0 auto;
  padding:60px 24px;
}
.legal-page h1{font-size:2.2rem;font-weight:700;margin-bottom:8px}
.legal-date{color:var(--text-muted);font-size:0.9rem;margin-bottom:32px}
.legal-content section{margin-bottom:28px;padding:0}
.legal-content h2{font-size:1.15rem;font-weight:600;margin-bottom:10px;color:var(--text-primary)}
.legal-content p{color:var(--text-secondary);line-height:1.75;margin-bottom:12px}
.legal-content ul{list-style:disc;padding-left:24px;margin-bottom:12px}
.legal-content li{color:var(--text-secondary);line-height:1.75;margin-bottom:6px}
.legal-content a{color:var(--accent);text-decoration:underline}

/* ── Footer ── */
.footer{
  background:var(--bg-secondary);
  border-top:1px solid var(--border-color);
  padding:48px 24px 24px;
  margin-top:auto;
  transition:background var(--transition),border-color var(--transition);
}
.footer-inner{
  max-width:var(--max-width);
  margin:0 auto;
  display:flex;
  gap:48px;
  flex-wrap:wrap;
}
.footer-brand{flex:1;min-width:200px}
.footer-logo{font-size:1.3rem;font-weight:700;color:var(--text-primary)}
.footer-tagline{margin-top:8px;color:var(--text-muted);font-size:0.9rem}
.footer-links{display:flex;gap:48px;flex-wrap:wrap}
.footer-col h4{font-size:0.85rem;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;color:var(--text-secondary);margin-bottom:12px}
.footer-col a{display:block;font-size:0.9rem;color:var(--text-muted);margin-bottom:8px;transition:color var(--transition)}
.footer-col a:hover{color:var(--accent)}
.footer-bottom{
  max-width:var(--max-width);
  margin:32px auto 0;
  padding-top:20px;
  border-top:1px solid var(--border-light);
  text-align:center;
  font-size:0.85rem;
  color:var(--text-muted);
}

/* ── Placeholder links (disabled) ── */
.placeholder-link{
  cursor:not-allowed !important;
  opacity:0.55 !important;
  pointer-events:none;
}

/* ── RTL Support ── */
[dir="rtl"] .lang-dropdown{right:auto;left:0}
[dir="rtl"] .legal-content ul{padding-left:0;padding-right:24px}
[dir="rtl"] .header-inner{flex-direction:row-reverse}
[dir="rtl"] .nav{flex-direction:row-reverse}
[dir="rtl"] .hero-actions{flex-direction:row-reverse}
[dir="rtl"] .footer-links{flex-direction:row-reverse}

/* ── Responsive ── */
@media (max-width:1100px){
  .tools-grid{grid-template-columns:repeat(3,1fr)}
  .why-grid{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:768px){
  .header-inner{padding:0 16px}
  .nav{display:none}
  .mobile-menu-btn{display:flex}
  .hero{padding:56px 16px 40px}
  .hero-title{font-size:2.2rem}
  .hero-subtitle{font-size:1rem}
  .category-grid{grid-template-columns:repeat(2,1fr);gap:10px}
  .tools-grid{grid-template-columns:repeat(2,1fr);gap:10px}
  .why-grid{grid-template-columns:1fr;gap:8px}
  .why-section{padding:48px 16px}
  .footer-inner{flex-direction:column;gap:32px}
  .footer-links{gap:24px}
  .legal-page{padding:40px 16px}
  .legal-page h1{font-size:1.7rem}
}
@media (max-width:480px){
  .hero-title{font-size:1.8rem}
  .category-grid{grid-template-columns:1fr}
  .tools-grid{grid-template-columns:1fr}
  .btn{width:100%;justify-content:center}
  .hero-actions{flex-direction:column;align-items:stretch}
  .section-title{font-size:1.5rem}
}

/* ── Scrollbar ── */
::-webkit-scrollbar{width:8px}
::-webkit-scrollbar-track{background:var(--bg-secondary)}
::-webkit-scrollbar-thumb{background:var(--border-color);border-radius:4px}
::-webkit-scrollbar-thumb:hover{background:var(--text-muted)}

/* ── Selection ── */
::selection{background:var(--accent);color:#fff}
