/* ============================================
   EasyFreeTools — Unified Design System
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --danger: #ef4444;
  --warning: #f59e0b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --max-width: 1100px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

[data-theme="dark"] {
  --primary-light: #1e1b4b;
  --gray-50: #111827; --gray-100: #1f2937; --gray-200: #374151;
  --gray-300: #4b5563; --gray-400: #6b7280; --gray-500: #9ca3af;
  --gray-600: #d1d5db; --gray-700: #e5e7eb; --gray-800: #f3f4f6;
  --gray-900: #f9fafb; --white: #0f172a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3); --shadow: 0 1px 3px rgba(0,0,0,0.4);
}

html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--gray-50); color: var(--gray-800); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }

/* ---- HEADER ---- */
.site-header { background: var(--white); border-bottom: 1px solid var(--gray-200); padding: 0 1.5rem; position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: var(--max-width); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; height: 56px; }
.site-logo { font-size: 1.25rem; font-weight: 800; color: var(--primary); text-decoration: none; display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.site-logo span { font-size: 1.4rem; }
.header-actions { display: flex; align-items: center; gap: 0.75rem; }
.theme-toggle { background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 50%; width: 36px; height: 36px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; transition: background 0.2s; flex-shrink: 0; }
.theme-toggle:hover { background: var(--gray-200); }

/* Search bar */
.search-wrap { position: relative; flex: 1; max-width: 280px; margin: 0 1rem; }
.search-input { width: 100%; padding: 0.45rem 0.75rem 0.45rem 2.2rem; border: 1px solid var(--gray-200); border-radius: 999px; font-size: 0.85rem; background: var(--gray-50); color: var(--gray-800); outline: none; transition: all 0.2s; }
.search-input:focus { border-color: var(--primary); background: var(--white); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.search-input::placeholder { color: var(--gray-400); }
.search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); font-size: 0.85rem; color: var(--gray-400); pointer-events: none; }
.search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; display: none; z-index: 200; }
.search-results.show { display: block; }
.search-result-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.85rem; text-decoration: none; color: var(--gray-800); font-size: 0.88rem; transition: background 0.1s; border-bottom: 1px solid var(--gray-100); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--primary-light); }
.search-result-item .sr-icon { font-size: 1.1rem; flex-shrink: 0; }
.search-result-item .sr-name { font-weight: 600; }
.search-result-item .sr-desc { font-size: 0.75rem; color: var(--gray-400); }
.search-no-results { padding: 1rem; text-align: center; color: var(--gray-400); font-size: 0.85rem; }
@media (max-width: 640px) { .search-wrap { max-width: 160px; } }

/* ---- TOOLS NAV BAR ---- */
.tools-nav { background: var(--white); border-bottom: 1px solid var(--gray-200); }
.tools-nav-container { max-width: var(--max-width); margin: 0 auto; display: flex; align-items: center; padding: 0 0.5rem; position: relative; }
.tools-nav-home { flex-shrink: 0; margin-right: 0.5rem; }
.tools-nav-home a { display: flex; align-items: center; gap: 0.35rem; padding: 0.45rem 0.85rem; border-radius: 999px; font-size: 0.82rem; font-weight: 600; color: var(--primary); text-decoration: none; white-space: nowrap; border: 1px solid var(--primary); background: var(--primary-light); }
.tools-nav-arrow { background: var(--white); border: 1px solid var(--gray-200); border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 0.75rem; color: var(--gray-500); flex-shrink: 0; transition: all 0.15s; z-index: 2; }
.tools-nav-arrow:hover { background: var(--gray-100); color: var(--gray-800); border-color: var(--gray-400); }
.tools-nav-scroll { flex: 1; overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
.tools-nav-scroll::-webkit-scrollbar { height: 0; }
.tools-nav-inner { display: flex; gap: 0.25rem; padding: 0.5rem 0.5rem; }
.tools-nav a { display: flex; align-items: center; gap: 0.35rem; padding: 0.45rem 0.85rem; border-radius: 999px; font-size: 0.82rem; font-weight: 500; color: var(--gray-600); text-decoration: none; white-space: nowrap; transition: all 0.15s; border: 1px solid transparent; }
.tools-nav a:hover { background: var(--gray-100); color: var(--gray-800); }
.tools-nav a.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); font-weight: 600; }

/* ---- MAIN ---- */
.main-content { flex: 1; max-width: var(--max-width); width: 100%; margin: 0 auto; padding: 2rem 1.5rem; }

/* ---- HERO (landing page) ---- */
.hero { text-align: center; padding: 3rem 1rem 2rem; }
.hero h1 { font-size: 2.5rem; font-weight: 800; color: var(--gray-900); margin-bottom: 0.75rem; line-height: 1.2; }
.hero p { font-size: 1.15rem; color: var(--gray-500); max-width: 600px; margin: 0 auto 2rem; }
.hero-badge { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--success-light); color: var(--success); padding: 0.4rem 1rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600; margin-bottom: 1.5rem; }

/* ---- TOOL GRID (landing page) ---- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-top: 1rem; }
.tool-grid-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.25rem; display: flex; align-items: flex-start; gap: 1rem; text-decoration: none; color: var(--gray-800); transition: all 0.2s; }
.tool-grid-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tool-grid-icon { font-size: 2rem; flex-shrink: 0; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: var(--gray-50); border-radius: var(--radius-sm); }
.tool-grid-info h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.25rem; }
.tool-grid-info p { font-size: 0.85rem; color: var(--gray-500); line-height: 1.4; }
.tool-grid-section { margin-top: 2.5rem; }
.tool-grid-section h2 { font-size: 1.3rem; font-weight: 700; color: var(--gray-900); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--gray-200); }

/* ---- TOOL CARD (tool pages) ---- */
.tool-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow); }
.tool-title { font-size: 1.75rem; font-weight: 800; color: var(--gray-900); margin-bottom: 0.5rem; }
.tool-subtitle { color: var(--gray-500); margin-bottom: 1.5rem; font-size: 1rem; }

/* ---- DROP ZONE ---- */
.drop-zone { border: 2px dashed var(--gray-300); border-radius: var(--radius); padding: 3rem 2rem; text-align: center; cursor: pointer; transition: all 0.2s; background: var(--gray-50); }
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--primary); background: var(--primary-light); }
.drop-zone .drop-icon { font-size: 3rem; margin-bottom: 1rem; display: block; }
.drop-zone .drop-text { font-size: 1.1rem; color: var(--gray-600); margin-bottom: 0.5rem; }
.drop-zone .drop-hint { font-size: 0.85rem; color: var(--gray-400); }
.drop-zone .browse-btn { display: inline-block; margin-top: 1rem; padding: 0.6rem 1.5rem; background: var(--primary); color: white; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.95rem; cursor: pointer; border: none; transition: background 0.2s; }
.drop-zone .browse-btn:hover { background: var(--primary-hover); }
.drop-zone input[type="file"] { display: none; }

/* ---- OPTIONS ---- */
.options-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; align-items: flex-end; }
.option-group { display: flex; flex-direction: column; gap: 0.35rem; }
.option-group label { font-size: 0.8rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; }
.option-group select, .option-group input[type="number"], .option-group input[type="text"], .option-group input[type="range"] { padding: 0.5rem 0.75rem; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 0.95rem; background: var(--white); color: var(--gray-800); min-width: 120px; }
.option-group select:focus, .option-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.7rem 1.5rem; font-size: 1rem; font-weight: 600; border-radius: var(--radius-sm); border: none; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { background: var(--gray-300); cursor: not-allowed; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-outline { background: var(--white); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); }
.btn-lg { padding: 0.85rem 2rem; font-size: 1.1rem; }

/* ---- FILE LIST ---- */
.file-list { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.file-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-sm); }
.file-item .file-info { flex: 1; min-width: 0; }
.file-item .file-name { font-weight: 600; font-size: 0.9rem; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .file-size { font-size: 0.8rem; color: var(--gray-400); }
.file-item .file-remove { background: none; border: none; color: var(--gray-400); cursor: pointer; font-size: 1.2rem; }
.file-item .file-remove:hover { color: var(--danger); }

/* ---- PROGRESS / RESULT ---- */
.progress-bar { width: 100%; height: 6px; background: var(--gray-200); border-radius: 999px; overflow: hidden; margin-top: 1rem; }
.progress-bar .progress-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.3s; width: 0%; }
.result-area { margin-top: 1.5rem; padding: 1.5rem; background: var(--success-light); border: 1px solid #a7f3d0; border-radius: var(--radius); display: none; }
.result-area.show { display: block; }
.result-area h3 { color: #065f46; margin-bottom: 0.5rem; }
.result-stats { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 1rem 0; }
.result-stat { display: flex; flex-direction: column; }
.result-stat .stat-label { font-size: 0.8rem; color: var(--gray-500); }
.result-stat .stat-value { font-size: 1.2rem; font-weight: 700; color: var(--gray-800); }

/* ---- PRIVACY BADGE ---- */
.privacy-badge { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--success); font-weight: 600; margin-top: 1rem; }

/* ---- AD SLOT ---- */
.ad-slot { background: var(--gray-100); border: 1px dashed var(--gray-300); border-radius: var(--radius-sm); padding: 1rem; text-align: center; color: var(--gray-400); font-size: 0.8rem; margin: 1.5rem 0; min-height: 90px; display: flex; align-items: center; justify-content: center; }

/* ---- SEO CONTENT ---- */
.seo-content { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--gray-200); }
.seo-content h2 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); margin-bottom: 1rem; }
.seo-content h3 { font-size: 1.15rem; font-weight: 600; color: var(--gray-800); margin: 1.5rem 0 0.75rem; }
.seo-content p { color: var(--gray-600); margin-bottom: 1rem; line-height: 1.7; }
.seo-content ul, .tool-card ul { color: var(--gray-600); margin-bottom: 1rem; padding-left: 1.75rem; list-style-position: inside; }
.seo-content li { margin-bottom: 0.4rem; }

/* ---- FAQ ---- */
.faq-item { border: 1px solid var(--gray-200); border-radius: var(--radius-sm); margin-bottom: 0.5rem; overflow: hidden; }
.faq-question { width: 100%; padding: 1rem 1.25rem; background: var(--white); border: none; text-align: left; font-size: 0.95rem; font-weight: 600; color: var(--gray-800); cursor: pointer; display: flex; justify-content: space-between; }
.faq-question::after { content: '+'; font-size: 1.2rem; color: var(--gray-400); }
.faq-question.open::after { content: '\2212'; }
.faq-answer { padding: 0 1.25rem; max-height: 0; overflow: hidden; transition: max-height 0.3s, padding 0.3s; color: var(--gray-600); font-size: 0.9rem; line-height: 1.6; }
.faq-answer.open { max-height: 500px; padding: 0 1.25rem 1rem; }

/* ---- RELATED TOOLS ---- */
.related-tools { margin-top: 2rem; }
.related-tools h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; color: var(--gray-800); }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.related-link { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-sm); text-decoration: none; color: var(--gray-700); font-size: 0.9rem; font-weight: 500; transition: all 0.2s; }
.related-link:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow-sm); }

/* ---- TEXTAREA ---- */
.tool-textarea { width: 100%; min-height: 200px; padding: 1rem; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-family: var(--font); font-size: 1rem; color: var(--gray-800); background: var(--white); resize: vertical; line-height: 1.6; }
.tool-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }

/* ---- FOOTER ---- */
.site-footer { background: var(--white); border-top: 1px solid var(--gray-200); padding: 2rem 1.5rem; text-align: center; margin-top: auto; }
.footer-inner { max-width: var(--max-width); margin: 0 auto; }
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 1rem; }
.footer-links a { color: var(--gray-500); text-decoration: none; font-size: 0.85rem; }
.footer-links a:hover { color: var(--primary); }
.footer-copy { font-size: 0.8rem; color: var(--gray-400); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.75rem; }
  .tool-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .main-content { padding: 1rem; }
  .tool-card { padding: 1.25rem; }
  .tool-title { font-size: 1.35rem; }
  .drop-zone { padding: 2rem 1rem; }
  .options-row { flex-direction: column; }
  .result-stats { flex-direction: column; gap: 0.75rem; }
  .related-grid { grid-template-columns: 1fr; }
}
