/* Global CSS variables based on your screenshots */
:root {
  --bg-color: #ffffff;
  --text-primary: #1a202c;
  --text-secondary: #718096;
  --border-color: #e2e8f0;
  --accent-orange: #f97316; /* Matched from footer & buttons */
  --accent-blue: #1e3a8a; /* Matched from 'Got it' button */
  --footer-bg: #ecece6; /* Matched from footer screenshot */
  --font-family: system-ui, -apple-system, sans-serif;
  --transition: all 0.2s ease;
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --bg-color: #0f172a;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-color: #1e293b;
  --footer-bg: #0b1120;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-family); background-color: var(--bg-color); color: var(--text-primary); line-height: 1.5; }
a { text-decoration: none; color: inherit; }

/* === Header & Mega Menu === */
.header { border-bottom: 1px solid var(--border-color); position: relative; z-index: 100; background: var(--bg-color); }
.nav-container { max-width: 1200px; margin: 0 auto; padding: 1rem; display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 0.5rem; }
.logo-icon { color: var(--accent-orange); }

.nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-link { font-weight: 500; cursor: pointer; color: var(--text-secondary); transition: var(--transition); }
.nav-link:hover { color: var(--accent-orange); }

/* Mega Menu Dropdown */
.dropdown { position: relative; }
.dropdown-content {
  visibility: hidden; opacity: 0; position: absolute; top: 100%; left: -200px; 
  background: var(--bg-color); border: 1px solid var(--border-color);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); border-radius: 0.5rem;
  padding: 1.5rem; display: flex; gap: 2rem; min-width: 600px;
  transform: translateY(10px); transition: var(--transition);
}
.dropdown:hover .dropdown-content { visibility: visible; opacity: 1; transform: translateY(0); }
.dropdown-col h4 { margin-bottom: 1rem; font-size: 1rem; color: var(--text-primary); }
.dropdown-col a { display: block; padding: 0.3rem 0; color: var(--text-secondary); font-size: 0.9rem; }
.dropdown-col a:hover { color: var(--accent-orange); }

/* === Hero & Search === */
.hero { text-align: center; padding: 5rem 1rem; max-width: 800px; margin: 0 auto; }
.hero h1 { font-size: 3rem; font-weight: 800; margin-bottom: 1rem; color: #2d3748; }
.hero p { font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 2.5rem; }
.search-box {
  position: relative; max-width: 600px; margin: 0 auto;
}
.search-box input {
  width: 100%; padding: 1.2rem 1.5rem; font-size: 1.1rem;
  border: 1px solid var(--border-color); border-radius: 2rem;
  outline: none; transition: var(--transition);
}
.search-box input:focus { border-color: var(--accent-orange); box-shadow: 0 0 0 3px rgba(249,115,22,0.1); }
.search-box svg { position: absolute; right: 1.5rem; top: 50%; transform: translateY(-50%); color: var(--text-secondary); width: 24px; height: 24px; }

/* === Tool Cards Grid === */
.tools-section { max-width: 1200px; margin: 0 auto; padding: 2rem 1rem; }
.category-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; font-size: 1.5rem; }
.badge { background: #e2e8f0; color: var(--text-primary); font-size: 0.8rem; padding: 0.2rem 0.6rem; border-radius: 1rem; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; margin-bottom: 3rem; }
.card {
  border: 1px solid var(--border-color); border-radius: 0.5rem; padding: 1.5rem;
  transition: var(--transition); background: var(--bg-color); cursor: pointer;
}
.card:hover { border-color: var(--text-secondary); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text-primary); }
.card p { font-size: 0.9rem; color: var(--text-secondary); }

/* === Footer === */
.footer { background-color: var(--footer-bg); padding: 3rem 1rem 1rem; border-top: 1px solid var(--border-color); margin-top: 4rem; }
.footer-top { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; border-bottom: 1px solid #dcdce6; padding-bottom: 1.5rem; margin-bottom: 1.5rem; }
.footer-top-logo { font-size: 1.5rem; font-weight: bold; display: flex; align-items: center; gap: 0.5rem; }
.footer-top-text { color: var(--text-secondary); font-size: 0.95rem; max-width: 400px; text-align: right; }
.footer-grid { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 2rem; }
.footer-col h4 { color: var(--accent-orange); text-transform: uppercase; letter-spacing: 1px; font-size: 0.85rem; margin-bottom: 1.2rem; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.8rem; }
.footer-col a { color: var(--text-primary); font-size: 0.95rem; transition: var(--transition); }
.footer-col a:hover { color: var(--accent-orange); }
.footer-bottom { max-width: 1200px; margin: 3rem auto 0; padding-top: 1.5rem; border-top: 1px solid #dcdce6; display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-secondary); }
.footer-bottom-links { display: flex; gap: 1.5rem; }

/* === Bookmark Toast === */
.bookmark-toast {
  position: fixed; bottom: 2rem; right: 2rem; background: var(--bg-color); border: 1px solid var(--border-color);
  border-radius: 0.5rem; box-shadow: 0 10px 25px rgba(0,0,0,0.1); width: 320px;
  transform: translateY(150%); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); z-index: 1000; overflow: hidden;
}
.bookmark-toast.show { transform: translateY(0); }
.toast-content { padding: 1.5rem; display: flex; gap: 1rem; align-items: flex-start; }
.toast-icon { background: #f1f5f9; padding: 0.5rem; border-radius: 0.5rem; color: var(--text-secondary); }
.toast-text h4 { font-size: 1.1rem; margin-bottom: 0.2rem; color: var(--text-primary); }
.toast-text p { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1rem; }
.btn-orange { background: var(--accent-orange); color: white; border: none; padding: 0.6rem 1.2rem; border-radius: 0.4rem; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.btn-orange:hover { background: #ea580c; }
.btn-blue { background: var(--accent-blue); color: white; border: none; padding: 0.5rem 1rem; border-radius: 0.4rem; font-weight: 600; cursor: pointer; }
.shortcut-box { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.key { background: white; border: 1px solid var(--border-color); padding: 0.2rem 0.5rem; border-radius: 0.3rem; font-family: monospace; font-weight: bold; box-shadow: 0 2px 0 var(--border-color); }
.toast-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; font-size: 1.2rem; color: var(--text-secondary); cursor: pointer; }
.progress-bar { height: 4px; background: var(--accent-orange); width: 100%; transform-origin: left; }
.progress-bar.animate { animation: shrink 10s linear forwards; }
@keyframes shrink { from { width: 100%; } to { width: 0%; } }
/* === Icon Buttons === */
.icon-group { display: flex; gap: 0.5rem; align-items: center; }
.icon-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-secondary); transition: var(--transition); display: flex; align-items: center; justify-content: center; padding: 0.5rem; border-radius: 0.25rem; }
.icon-btn:hover { color: var(--accent-orange); background-color: rgba(0,0,0,0.05); }
[data-theme="dark"] .icon-btn:hover { background-color: rgba(255,255,255,0.1); }
.hamburger { display: none; font-size: 1.5rem; }

/* === Tool Page Workspace === */
.tool-workspace { background-color: var(--footer-bg); padding: 4rem 1rem; border-bottom: 1px solid var(--border-color); }
.tool-header { text-align: center; margin-bottom: 2rem; }
.tool-header h1 { font-size: 2.5rem; margin-bottom: 0.5rem; color: #2d3748; }
.tool-header p { color: var(--text-secondary); font-size: 1.1rem; }
.tool-container { max-width: 900px; margin: 0 auto; background: var(--bg-color); border: 1px solid var(--border-color); border-radius: 0.75rem; padding: 2rem; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); position: relative; }

/* === State A: Upload Zone === */
.upload-zone { border: 2px dashed var(--border-color); border-radius: 0.5rem; padding: 3rem 1rem; text-align: center; transition: var(--transition); background: #f8fafc; margin-bottom: 2rem; }
.upload-zone.dragover { border-color: var(--accent-orange); background: rgba(249, 115, 22, 0.05); }
.upload-zone.hidden { display: none; }
.upload-icon { color: var(--text-secondary); margin-bottom: 1rem; }
.upload-zone h3 { margin-bottom: 0.5rem; color: var(--text-primary); }
.upload-zone p { color: var(--text-secondary); margin-bottom: 1rem; font-size: 0.9rem; }
.browse-btn { display: inline-block; cursor: pointer; }

/* === State B: Tool Interface & Disabled Logic === */
.tool-interface { transition: var(--transition); }
/* The magic class that handles UX State A */
.tool-interface.disabled-state { opacity: 0.4; pointer-events: none; filter: grayscale(100%); }

.waveform-box { width: 100%; height: 150px; background: #1e293b; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; margin-bottom: 1.5rem; color: white; overflow: hidden; }
.tool-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; background: #f1f5f9; padding: 1rem; border-radius: 0.5rem; }
.control-group { display: flex; flex-direction: column; gap: 0.5rem; }
.control-group label { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; }
.time-input { padding: 0.5rem; border: 1px solid var(--border-color); border-radius: 0.25rem; font-family: monospace; font-size: 1.1rem; width: 120px; text-align: center; }
.playback-controls { display: flex; gap: 1rem; }
.playback-controls .btn-icon { background: var(--bg-color); border: 1px solid var(--border-color); width: 45px; height: 45px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.playback-controls .btn-icon:hover { color: var(--accent-orange); border-color: var(--accent-orange); }
.export-section { text-align: center; border-top: 1px solid var(--border-color); padding-top: 1.5rem; }
.export-btn { font-size: 1.1rem; padding: 0.75rem 2rem; }

/* === SEO Content Section === */
.seo-content { padding: 4rem 1rem; background: var(--bg-color); }
.seo-container { max-width: 900px; margin: 0 auto; }
.seo-container h2 { font-size: 2rem; margin-bottom: 2rem; color: #2d3748; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; margin-bottom: 3rem; }
.step-card { background: #f8fafc; padding: 2rem; border-radius: 0.5rem; border: 1px solid var(--border-color); }
.step-number { background: var(--accent-orange); color: white; width: 35px; height: 35px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; margin-bottom: 1rem; font-size: 1.2rem; }
.step-card h4 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.seo-divider { border: 0; border-top: 1px solid var(--border-color); margin: 3rem 0; }
.features-list { list-style: none; margin-bottom: 3rem; }
.features-list li { margin-bottom: 1rem; padding-left: 1.5rem; position: relative; }
.features-list li::before { content: '✓'; position: absolute; left: 0; color: var(--accent-orange); font-weight: bold; }
.faq-box h4 { margin-bottom: 0.5rem; font-size: 1.1rem; margin-top: 1.5rem; }
.faq-box p { color: var(--text-secondary); margin-bottom: 1rem; }

/* === Dark Mode Legibility Fixes === */
[data-theme="dark"] .tool-container { background: var(--bg-color); border-color: var(--border-color); }
[data-theme="dark"] .tool-controls, [data-theme="dark"] .step-card { background: #1e293b; color: var(--text-primary); border-color: var(--border-color); }
[data-theme="dark"] .time-input { background: #0f172a; color: var(--text-primary); border: 1px solid #334155; }
[data-theme="dark"] .control-group label { color: #94a3b8; }
[data-theme="dark"] .tool-header h1, [data-theme="dark"] .seo-container h2 { color: var(--text-primary); }
[data-theme="dark"] .playback-controls .btn-icon { background: #0f172a; color: var(--text-primary); }

/* === Layout Adjustments === */
.extended-container { max-width: 1100px; /* Increased from 900px */ }
.time-input { width: 100px; } /* Slightly smaller to fit new boxes */

/* === Redesigned Mega Menu === */
.mega-menu-card { background: #ffffff; border-radius: 1.5rem; padding: 2.5rem 3rem; box-shadow: 0 20px 40px rgba(0,0,0,0.1); display: flex; gap: 3rem; border: 1px solid rgba(0,0,0,0.05); }
[data-theme="dark"] .mega-menu-card { background: #1e293b; border-color: #334155; box-shadow: 0 20px 40px rgba(0,0,0,0.5); }
.dropdown-col h4 { font-size: 0.8rem; letter-spacing: 1px; color: #94a3b8; margin-bottom: 1.5rem; text-transform: uppercase; }
.dropdown-col a { display: flex; align-items: center; gap: 0.75rem; font-weight: 500; margin-bottom: 1.25rem; color: var(--text-primary); transition: color 0.2s; }
.dropdown-col a:hover { color: var(--accent-orange); }
.menu-icon { background: #e0f2fe; color: #0284c7; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 0.9rem; }
[data-theme="dark"] .menu-icon { background: #0f172a; }

/* === Language Modal === */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 10000; backdrop-filter: blur(4px); }
.modal-overlay.hidden { display: none; }
.modal-card { background: var(--bg-color); width: 90%; max-width: 700px; border-radius: 1rem; padding: 2rem; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); border: 1px solid var(--border-color); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.close-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-secondary); }
.modal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.lang-option { background: none; border: 1px solid transparent; padding: 0.75rem 1rem; display: flex; align-items: center; gap: 0.75rem; border-radius: 0.5rem; cursor: pointer; color: var(--text-primary); font-size: 1rem; transition: background 0.2s; text-align: left; }
.lang-option:hover { background: rgba(0,0,0,0.05); }
[data-theme="dark"] .lang-option:hover { background: rgba(255,255,255,0.05); }
.lang-option.active { border: 1px solid #3b82f6; color: #3b82f6; background: rgba(59, 130, 246, 0.05); }
.lang-code { border: 1px solid var(--border-color); border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; color: var(--text-secondary); }

/* === Waveform Drag Handles === */
.waveform-wrapper { position: relative; width: 100%; height: 150px; margin-bottom: 1.5rem; }
.waveform-box { width: 100%; height: 100%; background: #0f172a; border-radius: 0.5rem; overflow: hidden; }
.trim-ui-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.trim-ui-overlay:not(.hidden) { pointer-events: auto; }
.trim-region { position: absolute; top: 0; left: 0; height: 100%; background: rgba(249, 115, 22, 0.2); border-top: 2px solid var(--accent-orange); border-bottom: 2px solid var(--accent-orange); cursor: grab; }
.drag-handle { position: absolute; top: 0; width: 15px; height: 100%; background: var(--accent-orange); cursor: ew-resize; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.drag-handle::after { content: ''; width: 2px; height: 20px; background: white; border-radius: 1px; }
.left-handle { left: -7.5px; }
.right-handle { right: -7.5px; }

/* === Fix Mega Menu Off-Screen Overflow === */
@media (min-width: 769px) {
  .dropdown-content.mega-menu-card {
    left: auto;        /* Clear default left alignment */
    right: 0;          /* Anchor to the right edge of the Tools link */
    transform: none;   /* Remove any centering math */
  }
}
/* === Mobile Menu & Mega Menu Fixes === */
@media (max-width: 768px) {
  /* Show the hamburger icon */
  .hamburger { display: block; }
  
  /* Hide the nav by default, stack it vertically */
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 70px; /* Drops down just below the header */
    left: 0;
    width: 100%;
    background: var(--bg-color);
    padding: 1.5rem;
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
    z-index: 9999; /* Ensures it goes OVER the Autotune tool */
    border-bottom: 1px solid var(--border-color);
  }
  
  /* The class the JS adds when clicked */
  .nav-links.active {
    display: flex;
  }
  
  /* Crush the Mega Menu into a single mobile column */
  .mega-menu-card {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    box-shadow: none;
    border: 1px solid var(--border-color);
    margin-top: 1rem;
    border-radius: 0.5rem;
  }

  /* Dark mode support for the mobile dropdown */
  [data-theme="dark"] .nav-links { background: #0f172a; }
}
@media (max-width: 768px) {
  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
  }
  
  .footer-bottom-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}
.trust-pill {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1.1rem;
  border-radius: 2rem;
}