/*
 * ══════════════════════════════════════════════════════════
 *  malikarsalan.com — Tools Shared Stylesheet
 *  Path: /assets/css/tools.css
 *  Version: 1.0 · Updated: 2026
 *
 *  HOW TO USE IN EVERY TOOL PAGE
 *  ─────────────────────────────
 *  1. Add the FOUC script as the very first <head> child:
 *
 *     <script>(function(){try{var t=localStorage.getItem('ma-theme');
 *     if(t==='light'||t==='dark'){document.documentElement.setAttribute('data-theme',t);return;}
 *     if(window.matchMedia('(prefers-color-scheme:light)').matches){document.documentElement.setAttribute('data-theme','light');}}catch(e){}})();</script>
 *
 *  2. Link fonts (before this stylesheet):
 *     <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=IBM+Plex+Sans:wght@300;400;500&family=IBM+Plex+Mono:wght@400;500&display=swap" rel="stylesheet">
 *
 *  3. Link this file:
 *     <link rel="stylesheet" href="/assets/css/tools.css">
 *
 *  4. Add tool-specific CSS in a <style> block after this link.
 *
 *  5. Copy the THEME SCRIPT from the bottom of this file into
 *     your page's <script> section.
 *
 *  STANDARD PAGE STRUCTURE
 *  ────────────────────────
 *  <body>
 *    <nav>…nav-inner…</nav>
 *    <div class="container">
 *      <nav class="breadcrumb">…</nav>
 *      <div class="tool-header">…</div>
 *    </div>
 *    <div class="tool-area"> <!-- tool-specific content --> </div>
 *    <div class="container">
 *      <div class="info-section">…steps…</div>
 *      <div class="info-section">…faq…</div>
 *      <div class="content-section">…prose…</div>
 *    </div>
 *    <footer>…</footer>
 *    <div class="toast" id="toast">…</div>
 *  </body>
 * ══════════════════════════════════════════════════════════
 */

/* ═══════════════════════════════════════════════════════════
   THEME TOKENS — dark (default)
═══════════════════════════════════════════════════════════ */
:root,
[data-theme="dark"] {
  --bg:        #0c0f14;
  --bg2:       #131720;
  --bg3:       #1a1f2e;
  --bg4:       #0a0d11;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.13);
  --text:      #e8e4dc;
  --muted:     #8a8680;
  --faint:     #3a3a3d;
  --accent:    #c8a96e;   /* warm gold */
  --accent2:   #7ec8c8;   /* teal       */
  --green:     #7ec87e;
  --red:       #e07e7e;
  --shadow:    rgba(0,0,0,0.4);
  --noise-opacity: 0.4;
  --nav-bg:    rgba(12,15,20,0.92);
  --panel-bg:  #0e1118;
  --grid-line: rgba(255,255,255,0.04);
}

/* ═══════════════════════════════════════════════════════════
   THEME TOKENS — light
═══════════════════════════════════════════════════════════ */
[data-theme="light"] {
  --bg:        #f5f3ef;
  --bg2:       #ffffff;
  --bg3:       #ede9e3;
  --bg4:       #eae6e0;
  --border:    rgba(0,0,0,0.08);
  --border2:   rgba(0,0,0,0.15);
  --text:      #1a1814;
  --muted:     #6b6560;
  --faint:     #b8b4ae;
  --accent:    #a07840;
  --accent2:   #2a8080;
  --green:     #2a802a;
  --red:       #cc4444;
  --shadow:    rgba(0,0,0,0.1);
  --noise-opacity: 0.15;
  --nav-bg:    rgba(245,243,239,0.94);
  --panel-bg:  #f0ede8;
  --grid-line: rgba(0,0,0,0.05);
}

/* ═══════════════════════════════════════════════════════════
   FONT ALIASES  (loaded from Google Fonts in <head>)
═══════════════════════════════════════════════════════════ */
:root {
  --ff-serif: 'Playfair Display', Georgia, serif;
  --ff-sans:  'IBM Plex Sans', system-ui, sans-serif;
  --ff-mono:  'IBM Plex Mono', monospace;
}

/* ═══════════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--ff-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* Noise texture overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 1000;
  opacity: var(--noise-opacity);
  transition: opacity 0.25s;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* ═══════════════════════════════════════════════════════════
   LAYOUT CONTAINERS
═══════════════════════════════════════════════════════════ */
.container       { max-width: 900px;  margin: 0 auto; padding: 0 24px; }
.container-wide  { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ═══════════════════════════════════════════════════════════
   NAVIGATION
═══════════════════════════════════════════════════════════ */
nav.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background 0.25s, border-color 0.25s;
}
.nav-inner {
  max-width: 900px; margin: 0 auto; padding: 0 24px;
  height: 56px; display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { font-family: var(--ff-mono); font-size: 13px; color: var(--accent); letter-spacing: 0.04em; }
.nav-logo a { color: inherit; }
.nav-right { display: flex; align-items: center; gap: 20px; }
.nav-links-list { display: flex; gap: 22px; list-style: none; }
.nav-links-list a { font-size: 13px; color: var(--muted); letter-spacing: 0.02em; transition: color 0.2s; }
.nav-links-list a:hover,
.nav-links-list a.active { color: var(--text); }
@media (max-width: 560px) { .nav-links-list { display: none; } }

/* ═══════════════════════════════════════════════════════════
   THEME TOGGLE
═══════════════════════════════════════════════════════════ */
.theme-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border2); background: var(--bg2);
  color: var(--muted); font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   BREADCRUMB
═══════════════════════════════════════════════════════════ */
.breadcrumb {
  padding: 18px 0 0; display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--faint); font-family: var(--ff-mono); flex-wrap: wrap;
}
.breadcrumb a { color: var(--muted); transition: color 0.2s; }
.breadcrumb a:hover { color: var(--text); }

/* ═══════════════════════════════════════════════════════════
   TOOL HEADER
═══════════════════════════════════════════════════════════ */
.tool-header   { padding: 28px 0 36px; }
.tool-eyebrow  { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }

/* Badges */
.tool-badge {
  font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 3px;
}
.badge-tool    { background: rgba(126,200,200,0.1); color: var(--accent2); border: 1px solid rgba(126,200,200,0.25); }
.badge-free    { background: rgba(126,200,126,0.1); color: var(--green);   border: 1px solid rgba(126,200,126,0.25); }
.badge-ai      { background: rgba(200,169,110,0.1); color: var(--accent);  border: 1px solid rgba(200,169,110,0.25); }
.badge-private { background: rgba(200,169,110,0.1); color: var(--accent);  border: 1px solid rgba(200,169,110,0.25); }
.badge-pdf     { background: rgba(224,126,126,0.1); color: var(--red);     border: 1px solid rgba(224,126,126,0.25); }

.tool-header h1 {
  font-family: var(--ff-serif); font-size: clamp(26px,4vw,42px);
  font-weight: 700; color: var(--text); line-height: 1.2;
  margin-bottom: 12px; transition: color 0.25s;
}
.tool-header h1 em { font-style: italic; color: var(--accent); }
.tool-tagline  { font-size: 16px; color: var(--muted); max-width: 560px; line-height: 1.65; margin-bottom: 20px; }

.tool-features { display: flex; gap: 20px; flex-wrap: wrap; }
.tool-feat     { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.feat-dot      { width: 5px; height: 5px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; font-size: 13px; font-weight: 500;
  letter-spacing: 0.02em; border-radius: 4px;
  transition: all 0.2s; cursor: pointer; border: none;
  font-family: var(--ff-sans); white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { opacity: 0.88; }
.btn-success { background: var(--green); color: var(--bg); }
.btn-success:hover { opacity: 0.88; }
.btn-danger  { background: var(--red); color: var(--bg); }
.btn-danger:hover  { opacity: 0.88; }
.btn-ghost   { background: transparent; color: var(--muted); border: 1px solid var(--border2); }
.btn-ghost:hover   { color: var(--text); border-color: var(--muted); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ═══════════════════════════════════════════════════════════
   UPLOAD / DROP ZONE  (shared pattern)
═══════════════════════════════════════════════════════════ */
.drop-zone {
  position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  padding: 40px 24px; cursor: pointer;
  border: 1.5px dashed var(--border2); border-radius: 6px;
  background: var(--bg3); text-align: center;
  transition: all 0.2s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(200,169,110,0.04);
}
.dz-icon  { color: var(--faint); transition: color 0.2s; }
.drop-zone:hover .dz-icon, .drop-zone.drag-over .dz-icon { color: var(--accent); }
.dz-title { font-size: 14px; font-weight: 500; color: var(--muted); }
.dz-sub   { font-size: 12px; color: var(--faint); line-height: 1.5; max-width: 220px; }

/* ═══════════════════════════════════════════════════════════
   STATUS PILL
═══════════════════════════════════════════════════════════ */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 99px;
  background: var(--bg3); border: 1px solid var(--border);
  font-family: var(--ff-mono); font-size: 11px; color: var(--muted);
  transition: all 0.25s;
}
.status-pill.ready  { border-color: rgba(126,200,126,0.3); color: var(--green); background: rgba(126,200,126,0.06); }
.status-pill.error  { border-color: rgba(224,126,126,0.3); color: var(--red);   background: rgba(224,126,126,0.06); }
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; animation: ma-pulse 2s ease-in-out infinite;
}
@keyframes ma-pulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }

/* Toolbar row */
.tool-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 14px; flex-wrap: wrap;
}
.tool-bar-left, .tool-bar-right { display: flex; align-items: center; gap: 8px; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(12,15,20,0.25);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: ma-spin 0.8s linear infinite;
}
@keyframes ma-spin { to { transform: rotate(360deg); } }

/* Progress bar */
.progress-wrap   { width: 100%; height: 3px; background: var(--border2); border-radius: 99px; overflow: hidden; }
.progress-fill   { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.2s ease; }

/* File info bar */
.file-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 4px; margin-top: 14px;
  transition: background 0.25s, border-color 0.25s;
}
.file-bar-item { font-family: var(--ff-mono); font-size: 11px; color: var(--muted); }
.file-bar-item span { color: var(--text); }

/* ═══════════════════════════════════════════════════════════
   INFO SECTIONS
═══════════════════════════════════════════════════════════ */
.info-section    { padding: 56px 0; border-top: 1px solid var(--border); transition: border-color 0.25s; }
.content-section { padding: 48px 0; border-top: 1px solid var(--border); transition: border-color 0.25s; }

.section-label {
  font-family: var(--ff-mono); font-size: 11px; color: var(--accent);
  letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 10px;
}

.info-section h2,
.content-section h2 {
  font-family: var(--ff-serif); font-size: clamp(22px,3.5vw,32px);
  font-weight: 700; color: var(--text); line-height: 1.2;
  margin-bottom: 28px; transition: color 0.25s;
}

/* Steps grid */
.steps-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 14px;
}
.step-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 6px; padding: 20px; transition: background 0.25s, border-color 0.25s;
}
.step-num   { font-family: var(--ff-mono); font-size: 11px; color: var(--accent); letter-spacing: 0.1em; margin-bottom: 8px; }
.step-title { font-size: 15px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.step-desc  { font-size: 13px; color: var(--muted); line-height: 1.55; }

/* Tips box */
.tips-box {
  background: var(--bg2); border: 1px solid var(--border); border-left: 2px solid var(--accent);
  border-radius: 4px; padding: 16px 18px;
  transition: background 0.25s, border-color 0.25s;
}
.tips-title { font-size: 11px; font-weight: 500; color: var(--accent); font-family: var(--ff-mono); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }
.tips-list  { list-style: none; display: flex; flex-direction: column; gap: 5px; }
.tips-list li { font-size: 13px; color: var(--muted); padding-left: 16px; position: relative; line-height: 1.5; }
.tips-list li::before { content: '→'; position: absolute; left: 0; color: var(--faint); font-size: 11px; top: 1px; }

/* FAQ */
.faq-list { display: flex; flex-direction: column; gap: 1px; }
.faq-item {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 6px;
  overflow: hidden; transition: border-color 0.2s, background 0.25s;
}
.faq-item.open { border-color: var(--border2); }
.faq-q {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; cursor: pointer; font-size: 14px; font-weight: 500;
  color: var(--text); gap: 12px; user-select: none;
}
.faq-q:hover { color: var(--accent); }
.faq-arrow { color: var(--faint); font-size: 12px; flex-shrink: 0; transition: transform 0.2s; }
.faq-item.open .faq-arrow { transform: rotate(180deg); }
.faq-a {
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s ease, padding 0.2s;
  font-size: 14px; color: var(--muted); line-height: 1.65; padding: 0 18px;
}
.faq-item.open .faq-a { max-height: 300px; padding: 0 18px 16px; }

/* Prose grid */
.prose-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 620px) { .prose-grid { grid-template-columns: 1fr; } }
.prose p { font-size: 14px; color: var(--muted); line-height: 1.75; margin-bottom: 14px; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--text); font-weight: 500; }

/* Stats grid */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr));
  gap: 1px; background: var(--border); border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden;
}
.stat-cell { background: var(--bg2); padding: 16px 14px; transition: background 0.25s; }
.stat-label { font-family: var(--ff-mono); font-size: 10px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.stat-value { font-family: var(--ff-serif); font-size: 22px; color: var(--accent); line-height: 1; }
.stat-value.savings { color: var(--green); }

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATION
═══════════════════════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  z-index: 9999; pointer-events: none;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px; border-radius: 6px;
  background: var(--bg2); border: 1px solid var(--border2);
  box-shadow: 0 16px 48px var(--shadow);
  font-size: 13px; font-weight: 500; color: var(--text);
  transition: transform 0.25s, opacity 0.25s;
  min-width: 240px; max-width: 420px; opacity: 0;
}
.toast.visible { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast-icon { font-size: 14px; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════ */
footer.site-footer {
  padding: 32px 0; border-top: 1px solid var(--border);
  transition: border-color 0.25s;
}
.footer-inner {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted);
}
.footer-logo { font-family: var(--ff-mono); color: var(--accent); }
.footer-nav  { display: flex; gap: 16px; }
.footer-nav a { color: var(--muted); transition: color 0.2s; }
.footer-nav a:hover { color: var(--text); }
.footer-copy { font-family: var(--ff-mono); font-size: 11px; }

/* ═══════════════════════════════════════════════════════════
   TOOL AREA  (outer wrapper between header and info sections)
═══════════════════════════════════════════════════════════ */
.tool-area { padding: 0 0 64px; }

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════════════════════ */
@keyframes fadeUp { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } }
.fade-up { animation: fadeUp 0.45s ease both; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE HELPERS
═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .tool-bar { flex-direction: column; align-items: flex-start; }
  .tool-bar-right { width: 100%; justify-content: flex-end; }
}

/*
 * ══════════════════════════════════════════════════════════
 *  THEME SCRIPT — copy into every tool page
 * ══════════════════════════════════════════════════════════
 *
 *  <script>
 *  (function() {
 *    const html = document.documentElement;
 *    const btn  = document.getElementById('themeBtn');
 *    const icon = document.getElementById('themeIcon');
 *    const ICONS = { dark: '☀', light: '☾' };
 *    const KEY   = 'ma-theme';
 *
 *    function applyTheme(t) {
 *      html.setAttribute('data-theme', t);
 *      icon.textContent = ICONS[t];
 *      btn.setAttribute('aria-label', t === 'dark' ? 'Switch to light mode' : 'Switch to dark mode');
 *      try { localStorage.setItem(KEY, t); } catch(e) {}
 *    }
 *
 *    function initTheme() {
 *      let s; try { s = localStorage.getItem(KEY); } catch(e) {}
 *      if (s === 'light' || s === 'dark') { applyTheme(s); return; }
 *      applyTheme(window.matchMedia('(prefers-color-scheme:dark)').matches ? 'dark' : 'light');
 *    }
 *
 *    btn.addEventListener('click', () => {
 *      applyTheme(html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark');
 *    });
 *    window.matchMedia('(prefers-color-scheme:dark)').addEventListener('change', e => {
 *      let s; try { s = localStorage.getItem(KEY); } catch(e) {}
 *      if (!s) applyTheme(e.matches ? 'dark' : 'light');
 *    });
 *    initTheme();
 *  })();
 *  </script>
 * ══════════════════════════════════════════════════════════
 */
