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

:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --secondary: #ec4899;
  --bg-color: #f8fafc;
  --surface: rgba(255, 255, 255, 0.7);
  --surface-solid: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: rgba(226, 232, 240, 0.8);
  --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
  --glass-border: 1px solid rgba(255, 255, 255, 0.3);
  --radius: 16px;
  --transition: all 0.3s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg-color);
  background-image: 
    radial-gradient(at 0% 0%, hsla(253,16%,7%,0.05) 0, transparent 50%), 
    radial-gradient(at 50% 0%, hsla(225,39%,30%,0.05) 0, transparent 50%), 
    radial-gradient(at 100% 0%, hsla(339,49%,30%,0.05) 0, transparent 50%);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

ul {
  list-style: none;
}

/* Glassmorphism Classes */
.glass {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

header.scrolled {
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-weight: 500;
  color: var(--text-muted);
}

.nav-links a:hover, .nav-links a.active {
  color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  font-size: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-main);
}

/* Main Content */
main {
  flex: 1;
  margin-top: 80px;
}

/* Hero Section */
.hero {
  padding: 120px 0 80px;
  text-align: center;
}

.hero h1 {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 40px;
}

.hero-btns {
  display: flex;
  gap: 16px;
  justify-content: center;
}

/* Features */
.features {
  padding: 80px 0;
}
.section-title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 60px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 32px;
}
.feature-card {
  padding: 32px;
  text-align: left;
}
.feature-icon {
  font-size: 2rem;
  margin-bottom: 16px;
  color: var(--primary);
}
.feature-card h3 {
  margin-bottom: 12px;
  font-size: 1.25rem;
}
.feature-card p {
  color: var(--text-muted);
}

/* Tool Layout */
.tool-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 32px;
  padding: 40px 0;
  min-height: 800px;
}

.tool-sidebar, .tool-main {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.9);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.editor-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: rgba(255,255,255,0.5);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  flex-wrap: wrap;
}
.toolbar-btn {
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}
.toolbar-btn:hover {
  background: var(--bg-color);
  color: var(--primary);
}

.editor-content {
  min-height: 500px;
  padding: 24px;
  background: white;
  border-radius: 0 0 var(--radius) var(--radius);
  outline: none;
}

.editor-content:focus {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.tool-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stats-bar {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Footer */
footer {
  background: white;
  border-top: 1px solid var(--border);
  padding: 80px 0 40px;
  margin-top: 80px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 60px;
}
.footer-col h4 {
  font-size: 1.1rem;
  margin-bottom: 24px;
}
.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.footer-col a {
  color: var(--text-muted);
}
.footer-col a:hover {
  color: var(--primary);
}
.footer-bottom {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 992px) {
  .tool-layout {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 80px;
    left: 0;
    width: 100%;
    background: white;
    flex-direction: column;
    padding: 24px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
  }
  .nav-links.active {
    display: flex;
  }
  .mobile-toggle {
    display: block;
  }
  .hero h1 {
    font-size: 2.5rem;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* Page Headers */
.page-header {
  padding: 80px 0 40px;
  text-align: center;
}
.page-header h1 {
  font-size: 3rem;
  margin-bottom: 16px;
}
.page-header p {
  color: var(--text-muted);
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Content Pages */
.content-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 0 80px;
}
.content-section h2 {
  margin: 32px 0 16px;
}
.content-section p {
  margin-bottom: 16px;
  color: var(--text-muted);
}

/* FAQ */
.faq-item {
  margin-bottom: 16px;
}
.faq-q {
  width: 100%;
  text-align: left;
  padding: 20px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}
.faq-a {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  color: var(--text-muted);
}
.faq-item.active .faq-a {
  padding: 20px;
  max-height: 500px;
}

.animation-fade-in {
  animation: fadeIn 0.8s ease forwards;
  opacity: 0;
}
.animation-slide-up {
  animation: slideUp 0.8s ease forwards;
  opacity: 0;
  transform: translateY(30px);
}
@keyframes fadeIn {
  to { opacity: 1; }
}
@keyframes slideUp {
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive Fixes added by Agent */
html, body {
  overflow-x: hidden;
  width: 100%;
}

.toc-mobile-toggle {
  display: none;
  margin-bottom: 24px;
  width: 100%;
}

.toc-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}
.toc-overlay.active {
  display: block;
}

@media (max-width: 1024px) {
  /* Tool Layout & Blog Layout */
  .blog-layout {
    display: flex !important;
    flex-direction: column !important;
  }
  
  .toc-mobile-toggle {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
  }

  .blog-layout aside {
    position: fixed !important;
    top: 0 !important;
    left: -100% !important;
    width: 300px !important;
    height: 100vh !important;
    background: white !important;
    z-index: 1000 !important;
    transition: left 0.3s ease !important;
    padding: 80px 24px 24px !important;
    box-shadow: 2px 0 20px rgba(0,0,0,0.1) !important;
    overflow-y: auto !important;
  }
  
  .blog-layout aside.active {
    left: 0 !important;
  }
  
  .blog-layout aside .glass {
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
  }
}

@media (max-width: 768px) {
  /* Override ALL inline grids with explicit column templates */
  div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }

  .page-header h1, .hero h1 {
    font-size: 2.2rem !important;
  }
  
  .content-section {
    padding: 24px 0 40px !important;
  }
  
  .container {
    padding: 0 16px !important;
  }
  
  svg, img {
    max-width: 100%;
    height: auto;
  }

  .hero-btns {
    flex-direction: column !important;
  }
  
  .btn {
    width: 100% !important;
    margin-bottom: 12px;
  }

  /* Fix stats bar on tool page */
  .stats-bar {
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .tool-actions {
    flex-direction: column !important;
  }
  .tool-actions button {
    width: 100% !important;
    margin-left: 0 !important;
  }
  
  /* Blog Prev/Next links */
  div[style*="justify-content: space-between; gap: 24px;"] {
    flex-direction: column !important;
  }
  
  /* Make 2-column inline forms 1-column */
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  
  /* Resources specific fixes */
  div[style*="width: 250px; height: 320px"] {
    width: 100% !important;
    max-width: 300px !important;
    margin: 0 auto !important;
    height: 320px !important;
  }
}

@media (max-width: 480px) {
  .page-header h1 {
    font-size: 1.8rem !important;
  }
  h2 {
    font-size: 1.5rem !important;
  }
  h3 {
    font-size: 1.2rem !important;
  }
  
  .feature-card, .glass {
    padding: 20px !important;
  }
  
  .form-control {
    font-size: 16px !important; /* prevent zoom on iOS */
  }
}
