/* ==========================================================
   CoolFileTools - Main Stylesheet
   External CSS shared across all tool pages
   ========================================================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

/* ==========================================================
   CSS Custom Properties - Theme 1: Modern Gradient (Default)
   ========================================================== */
:root,
[data-theme="1"] {
  --color-primary: #6366f1;
  --color-primary-dark: #4f46e5;
  --color-primary-light: #a5b4fc;
  --color-accent: #06b6d4;
  --color-bg: #f8f7ff;
  --color-bg-secondary: #ffffff;
  --color-bg-card: #ffffff;
  --color-text: #1e1b4b;
  --color-text-muted: #6b7280;
  --color-border: #e0e0f0;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(99,102,241,0.08);
  --shadow: 0 4px 16px rgba(99,102,241,0.12);
  --shadow-lg: 0 8px 32px rgba(99,102,241,0.18);
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --header-bg: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  --btn-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
  --hero-text: #ffffff;
}

/* Theme 2: Minimal Clean */
[data-theme="2"] {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #bfdbfe;
  --color-accent: #0ea5e9;
  --color-bg: #f9fafb;
  --color-bg-secondary: #f3f4f6;
  --color-bg-card: #ffffff;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-success: #059669;
  --color-warning: #d97706;
  --color-error: #dc2626;
  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --header-bg: #ffffff;
  --btn-gradient: #2563eb;
  --hero-text: #111827;
}

/* Theme 3: Dark Mode */
[data-theme="3"] {
  --color-primary: #a78bfa;
  --color-primary-dark: #8b5cf6;
  --color-primary-light: #4c1d95;
  --color-accent: #34d399;
  --color-bg: #0f0f1a;
  --color-bg-secondary: #1a1a2e;
  --color-bg-card: #1e1e30;
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-border: #2d2d44;
  --color-success: #34d399;
  --color-warning: #fbbf24;
  --color-error: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --header-bg: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  --btn-gradient: linear-gradient(135deg, #7c3aed, #a78bfa);
  --hero-text: #e2e8f0;
}

/* Theme 4: Playful Rounded */
[data-theme="4"] {
  --color-primary: #f59e0b;
  --color-primary-dark: #d97706;
  --color-primary-light: #fde68a;
  --color-accent: #ec4899;
  --color-bg: #fffbf0;
  --color-bg-secondary: #fff8e7;
  --color-bg-card: #ffffff;
  --color-text: #292524;
  --color-text-muted: #78716c;
  --color-border: #fde68a;
  --color-success: #84cc16;
  --color-warning: #f97316;
  --color-error: #e11d48;
  --radius: 20px;
  --radius-sm: 14px;
  --radius-lg: 32px;
  --shadow-sm: 0 2px 6px rgba(245,158,11,0.1);
  --shadow: 0 4px 20px rgba(245,158,11,0.15);
  --shadow-lg: 0 8px 40px rgba(245,158,11,0.2);
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --header-bg: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #ec4899 100%);
  --btn-gradient: linear-gradient(135deg, #f59e0b, #ec4899);
  --hero-text: #292524;
}

/* Theme 5: Professional Corporate */
[data-theme="5"] {
  --color-primary: #1e3a5f;
  --color-primary-dark: #152b47;
  --color-primary-light: #4a7cbf;
  --color-accent: #c8962a;
  --color-bg: #f5f6f8;
  --color-bg-secondary: #eef0f4;
  --color-bg-card: #ffffff;
  --color-text: #1a2332;
  --color-text-muted: #5a6475;
  --color-border: #d0d5de;
  --color-success: #2d7a4f;
  --color-warning: #c8962a;
  --color-error: #c0392b;
  --radius: 4px;
  --radius-sm: 2px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 2px 10px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --header-bg: linear-gradient(135deg, #1e3a5f 0%, #2a4f7c 100%);
  --btn-gradient: #1e3a5f;
  --hero-text: #ffffff;
}

/* Theme 6: Creative Colorful */
[data-theme="6"] {
  --color-primary: #e11d48;
  --color-primary-dark: #be123c;
  --color-primary-light: #fda4af;
  --color-accent: #7c3aed;
  --color-bg: #fff0f3;
  --color-bg-secondary: #ffe4e8;
  --color-bg-card: #ffffff;
  --color-text: #1a0a0e;
  --color-text-muted: #6b4b52;
  --color-border: #fecdd3;
  --color-success: #15803d;
  --color-warning: #ea580c;
  --color-error: #b91c1c;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 28px;
  --shadow-sm: 0 2px 6px rgba(225,29,72,0.1);
  --shadow: 0 4px 20px rgba(225,29,72,0.14);
  --shadow-lg: 0 8px 40px rgba(225,29,72,0.2);
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --header-bg: linear-gradient(135deg, #e11d48 0%, #7c3aed 50%, #f97316 100%);
  --btn-gradient: linear-gradient(135deg, #e11d48, #7c3aed);
  --hero-text: #ffffff;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

img { max-width: 100%; height: auto; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==========================================================
   Layout
   ========================================================== */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
}

.container-wide {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

main {
  flex: 1;
  padding: 40px 0 60px;
}

/* ==========================================================
   Site Header
   ========================================================== */
.site-header {
  background: var(--header-bg);
  padding: 18px 0;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 100;
}

.site-header .container-wide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.site-logo-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.site-logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--hero-text);
  letter-spacing: -0.02em;
  opacity: 0.95;
}

.site-header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.site-header-nav a {
  color: var(--hero-text);
  opacity: 0.82;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: opacity 0.2s, background 0.2s;
  white-space: nowrap;
}

.site-header-nav a:hover {
  opacity: 1;
  background: rgba(255,255,255,0.15);
  text-decoration: none;
}

/* ==========================================================
   Tool Header / Hero (inside each tool page)
   ========================================================== */
.tool-hero {
  text-align: center;
  padding: 36px 20px 28px;
}

.tool-hero-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 12px;
  display: block;
}

.tool-hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.tool-hero p {
  font-size: 1rem;
  color: var(--color-text-muted);
  max-width: 520px;
  margin: 0 auto;
}

/* ==========================================================
   Cards & Panels
   ========================================================== */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.card + .card { margin-top: 20px; }

/* ==========================================================
   Upload / Drop Zone
   ========================================================== */
.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  background: var(--color-bg-secondary);
  position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-bg-card);
  box-shadow: var(--shadow);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-zone-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}

.drop-zone h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
}

.drop-zone p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* ==========================================================
   Buttons
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--btn-gradient);
  color: #ffffff;
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  box-shadow: var(--shadow-lg);
  filter: brightness(1.05);
  color: #ffffff;
}

.btn-secondary {
  background: var(--color-bg-secondary);
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-success {
  background: var(--color-success);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16,185,129,0.25);
}

.btn-success:hover {
  filter: brightness(1.05);
  color: #ffffff;
}

.btn-lg {
  padding: 15px 36px;
  font-size: 1.05rem;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================
   Form Elements
   ========================================================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  background: var(--color-bg-secondary);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.form-control::placeholder { color: var(--color-text-muted); }

select.form-control { cursor: pointer; }

/* Range Slider */
.range-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.form-range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--color-border);
  outline: none;
  cursor: pointer;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: transform 0.15s;
}

.form-range::-webkit-slider-thumb:hover { transform: scale(1.15); }

.range-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-primary);
  min-width: 40px;
  text-align: right;
}

/* ==========================================================
   Progress & Status
   ========================================================== */
.progress-bar-wrap {
  background: var(--color-border);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin: 12px 0;
}

.progress-bar {
  height: 100%;
  background: var(--btn-gradient);
  border-radius: 99px;
  transition: width 0.4s ease;
  width: 0%;
}

.status-msg {
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin: 12px 0;
}

.status-msg.success {
  background: rgba(16,185,129,0.1);
  color: var(--color-success);
  border-left: 3px solid var(--color-success);
}

.status-msg.error {
  background: rgba(239,68,68,0.1);
  color: var(--color-error);
  border-left: 3px solid var(--color-error);
}

.status-msg.info {
  background: rgba(99,102,241,0.08);
  color: var(--color-primary);
  border-left: 3px solid var(--color-primary);
}

/* ==========================================================
   Stats / Info Rows
   ========================================================== */
.stats-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.stat-item {
  flex: 1;
  min-width: 100px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-align: center;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-primary);
  font-family: var(--font-mono);
}

/* ==========================================================
   File List (PDF merger style)
   ========================================================== */
.file-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
}

.file-item-icon { font-size: 1.2rem; flex-shrink: 0; }

.file-item-name {
  flex: 1;
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item-size {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.file-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.file-item-remove:hover {
  color: var(--color-error);
  background: rgba(239,68,68,0.08);
}

/* ==========================================================
   Image Preview
   ========================================================== */
.preview-area {
  display: none;
  gap: 16px;
  margin-top: 20px;
}

.preview-area.visible { display: flex; flex-wrap: wrap; }

.preview-box {
  flex: 1;
  min-width: 220px;
  text-align: center;
}

.preview-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  display: block;
}

.preview-img-wrap {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ==========================================================
   Affiliate / Promo Banner
   ========================================================== */
.affiliate-banner {
  background: linear-gradient(135deg, var(--color-bg-card), var(--color-bg-secondary));
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.affiliate-banner-text {
  flex: 1;
  min-width: 200px;
}

.affiliate-banner-text strong {
  display: block;
  font-size: 0.95rem;
  color: var(--color-text);
  margin-bottom: 4px;
}

.affiliate-banner-text span {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

/* ==========================================================
   Homepage Cards (index.html)
   ========================================================== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.tool-card {
  background: var(--color-bg-card);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  text-decoration: none;
  color: var(--color-text);
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.tool-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  text-decoration: none;
  color: var(--color-text);
}

.tool-card-icon {
  font-size: 2.8rem;
  line-height: 1;
}

.tool-card h3 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tool-card p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.tool-card .badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(99,102,241,0.1);
  color: var(--color-primary);
  margin-top: 4px;
}

/* Homepage Hero */
.home-hero {
  text-align: center;
  padding: 56px 20px 48px;
}

.home-hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--color-text);
  margin-bottom: 14px;
  line-height: 1.15;
}

.home-hero h1 span {
  color: var(--color-primary);
}

.home-hero p {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  max-width: 540px;
  margin: 0 auto 28px;
  line-height: 1.65;
}

.home-features {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.home-features span::before {
  content: '✓ ';
  color: var(--color-success);
}

/* ==========================================================
   Footer
   ========================================================== */
.site-footer {
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding: 28px 0;
  text-align: center;
  margin-top: auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--color-primary); text-decoration: none; }

.footer-copy {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ==========================================================
   Utilities
   ========================================================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.w-full { width: 100%; }
.font-mono { font-family: var(--font-mono); }

/* Spinning loader */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 640px) {
  .container, .container-wide { padding: 0 16px; }
  .card { padding: 20px 16px; }
  main { padding: 28px 0 48px; }
  .site-header-nav a { padding: 5px 9px; font-size: 0.82rem; }
  .tools-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .stats-row { gap: 10px; }
  .affiliate-banner { flex-direction: column; text-align: center; }
  .home-hero { padding: 36px 16px 32px; }
}

@media (max-width: 400px) {
  .tools-grid { grid-template-columns: 1fr; }
}


/* ============================================================
   SITE-WIDE DROPDOWN NAV
   ============================================================ */
:root {
  --nav-height: 60px;
  --nav-bg: var(--color-bg);
  --nav-border-color: var(--color-border);
  --nav-text: var(--color-text);
  --nav-text-muted: var(--color-text-secondary);
  --nav-accent: var(--color-primary);
  --nav-accent-bg: color-mix(in srgb, var(--color-primary) 10%, transparent);
  --nav-dropdown-bg: var(--color-bg);
  --nav-dropdown-shadow: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
  --nav-radius: 12px;
  --nav-tr: 180ms cubic-bezier(.4,0,.2,1);
}

/* Wrapper */
.cft-nav {
  position: sticky;
  top: 0;
  z-index: 500;
  height: var(--nav-height);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border-color);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background var(--nav-tr), border-color var(--nav-tr);
}

.cft-nav__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Logo */
.cft-nav__logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 12px;
}

.cft-nav__logo-icon {
  width: 32px;
  height: 32px;
  background: var(--nav-accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: transform var(--nav-tr);
  flex-shrink: 0;
}
.cft-nav__logo:hover .cft-nav__logo-icon {
  transform: rotate(-8deg) scale(1.1);
}

.cft-nav__logo-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--nav-text);
  letter-spacing: -0.02em;
  line-height: 1;
}
.cft-nav__logo-text em {
  font-style: normal;
  color: var(--nav-accent);
}

/* Desktop link list */
.cft-nav__links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.cft-nav__item { position: relative; }

.cft-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--nav-text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--nav-tr), color var(--nav-tr);
  cursor: pointer;
  border: none;
  background: transparent;
  outline: none;
  line-height: 1;
  font-family: inherit;
}
.cft-nav__link:hover,
.cft-nav__link[aria-expanded="true"] {
  background: var(--nav-accent-bg);
  color: var(--nav-accent);
}
.cft-nav__link.cft-nav-active {
  color: var(--nav-accent);
  font-weight: 700;
}

/* Caret */
.cft-nav__caret {
  width: 13px;
  height: 13px;
  fill: currentColor;
  opacity: .7;
  flex-shrink: 0;
  transition: transform var(--nav-tr);
}
.cft-nav__link[aria-expanded="true"] .cft-nav__caret {
  transform: rotate(180deg);
}

/* Dropdown panel */
.cft-nav__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  min-width: 240px;
  background: var(--nav-dropdown-bg);
  border: 1px solid var(--nav-border-color);
  border-radius: var(--nav-radius);
  box-shadow: var(--nav-dropdown-shadow);
  padding: 8px;
  list-style: none;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--nav-tr), transform var(--nav-tr);
}
.cft-nav__dropdown.cft-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
/* Arrow notch */
.cft-nav__dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: var(--nav-dropdown-bg);
  border-left: 1px solid var(--nav-border-color);
  border-top: 1px solid var(--nav-border-color);
}

.cft-nav__dd-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 8px;
  text-decoration: none;
  transition: background var(--nav-tr);
}
.cft-nav__dd-item:hover { background: var(--nav-accent-bg); }

.cft-nav__dd-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--nav-accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
  transition: background var(--nav-tr);
}
.cft-nav__dd-item:hover .cft-nav__dd-icon {
  background: var(--nav-accent);
}

.cft-nav__dd-label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--nav-text);
  line-height: 1.2;
}
.cft-nav__dd-sub {
  font-size: .75rem;
  color: var(--nav-text-muted);
  margin-top: 1px;
}

/* Right-side actions slot */
.cft-nav__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Hamburger */
.cft-nav__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  border-radius: 8px;
  transition: background var(--nav-tr);
}
.cft-nav__burger:hover { background: var(--nav-accent-bg); }
.cft-nav__burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--nav-text);
  border-radius: 2px;
  transform-origin: center;
  transition: transform var(--nav-tr), opacity var(--nav-tr), background var(--nav-tr);
}
.cft-nav__burger.cft-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.cft-nav__burger.cft-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.cft-nav__burger.cft-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
.cft-nav__mobile {
  display: none;
  position: fixed;
  inset: var(--nav-height) 0 0 0;
  background: var(--nav-bg);
  border-top: 1px solid var(--nav-border-color);
  padding: 12px 16px 40px;
  overflow-y: auto;
  z-index: 499;
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(.4,0,.2,1);
}
.cft-nav__mobile.cft-open { transform: translateX(0); }

.cft-nav__mob-head {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--nav-text-muted);
  padding: 10px 8px 5px;
}
.cft-nav__mob-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 8px;
  border-radius: 9px;
  text-decoration: none;
  transition: background var(--nav-tr);
}
.cft-nav__mob-link:hover { background: var(--nav-accent-bg); }
.cft-nav__mob-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--nav-accent-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
}
.cft-nav__mob-text {
  font-size: .9rem;
  font-weight: 600;
  color: var(--nav-text);
}
.cft-nav__mob-divider {
  height: 1px;
  background: var(--nav-border-color);
  margin: 6px 0;
}

@media (max-width: 700px) {
  .cft-nav__links { display: none; }
  .cft-nav__burger { display: flex; }
  .cft-nav__mobile { display: block; }
}
@media (min-width: 701px) {
  .cft-nav__mobile { display: none !important; }
}

/* ── Nav dropdown group labels & dividers ── */
.cft-nav__dd-group-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--nav-text-muted);
  padding: 8px 10px 3px;
  pointer-events: none;
}
.cft-nav__dd-group-label:not(:first-child) {
  margin-top: 2px;
}
.cft-nav__dd-divider {
  height: 1px;
  background: var(--nav-border-color);
  margin: 4px 8px;
}

/* Taller dropdown to fit all tools — scrollable on short screens */
.cft-nav__dropdown {
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  min-width: 270px;
}

/* ── Homepage tool category headings ── */
.tools-category-heading {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.2px;
  margin: 40px 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--color-border);
}
.tools-category-heading:first-of-type {
  margin-top: 0;
}
