/* style.css */
:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --secondary: #10B981;
  --bg-color: #F9FAFB;
  --surface: #FFFFFF;
  --text-main: #111827;
  --text-muted: #6B7280;
  --border-color: #E5E7EB;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] {
  --primary: #6366F1;
  --primary-hover: #818CF8;
  --bg-color: #111827;
  --surface: #1F2937;
  --text-main: #F9FAFB;
  --text-muted: #9CA3AF;
  --border-color: #374151;
  --glass-bg: rgba(31, 41, 55, 0.7);
  --glass-border: rgba(255, 255, 255, 0.05);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

ul {
  list-style: none;
}

/* Header & Navigation */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-main);
  font-weight: 500;
  transition: color 0.2s;
}

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

#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-main);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Main Layout */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 4rem 1rem;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -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 2rem;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-size: 1rem;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.39);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

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

/* App Interface */
.app-container {
  background: var(--surface);
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-bottom: 4rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-color);
  align-items: center;
}

.toolbar select {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background-color: var(--surface);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 500px;
}

.editor-pane {
  display: flex;
  flex-direction: column;
}

.editor-pane:first-child {
  border-right: 1px solid var(--border-color);
}

.pane-header {
  padding: 1rem 1.5rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pane-actions button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.pane-actions button:hover {
  background: var(--border-color);
  color: var(--text-main);
}

textarea, .output-content {
  flex: 1;
  width: 100%;
  padding: 1.5rem;
  border: none;
  resize: none;
  background: transparent;
  color: var(--text-main);
  font-size: 1rem;
  line-height: 1.6;
  font-family: inherit;
  outline: none;
}

.output-content {
  overflow-y: auto;
}

.output-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 1rem;
}

.stats-bar {
  display: flex;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-color);
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Loading Animation */
.loader {
  display: none;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Sections */
.section-title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 3rem;
  font-weight: 700;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.feature-card {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  text-align: center;
  transition: transform 0.2s;
}

.feature-card:hover {
  transform: translateY(-5px);
}

.feature-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1.5rem;
  color: var(--primary);
}

.feature-card h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.feature-card p {
  color: var(--text-muted);
}

/* FAQ */
.faq-list {
  max-width: 800px;
  margin: 0 auto 4rem;
}

.faq-item {
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 0;
}

.faq-question {
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-answer {
  margin-top: 1rem;
  color: var(--text-muted);
  display: none;
}

.faq-item.active .faq-answer {
  display: block;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

.faq-icon {
  transition: transform 0.2s;
}

/* Footer */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border-color);
  padding: 4rem 2rem 2rem;
  margin-top: 4rem;
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 3rem;
}

.footer-col h4 {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-col a {
  color: var(--text-muted);
}

.footer-col a:hover {
  color: var(--primary);
}

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Media Queries */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
  }
  
  .nav-links.active {
    display: flex;
  }

  .mobile-menu-btn {
    display: block;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .editor-pane:first-child {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .hero h1 {
    font-size: 2.25rem;
  }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--text-main);
  color: var(--bg-color);
  padding: 1rem 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Blog List */
.blog-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.blog-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s;
}

.blog-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

.blog-card-content {
  padding: 1.5rem;
}

.blog-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.blog-title {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.blog-excerpt {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.read-more {
  color: var(--primary);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Content Pages (Blog Post, Privacy, etc) */
.content-page {
  max-width: 800px;
  margin: 0 auto;
}

.content-page h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

.content-page h2 {
  font-size: 1.75rem;
  margin: 2rem 0 1rem;
}

.content-page h3 {
  font-size: 1.25rem;
  margin: 1.5rem 0 1rem;
}

.content-page p {
  margin-bottom: 1.5rem;
  color: var(--text-main);
}

.content-page ul, .content-page ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
  color: var(--text-main);
}

.content-page li {
  margin-bottom: 0.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-main);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Global Responsive Fixes */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

img, video, iframe {
  max-width: 100%;
  height: auto;
}

* {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Ensure padding doesn't cause overflow on mobile */
@media (max-width: 768px) {
  main {
    padding: 1rem;
  }
  
  .content-page {
    padding: 2rem 1rem !important;
  }
  
  .hero {
    padding: 2rem 1rem;
  }
  
  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }
  
  .hero-buttons .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .features-grid, .faq-list, .footer-grid {
    padding: 0 1rem;
  }
  
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .stats-bar {
    flex-direction: column;
    gap: 0.5rem;
  }

  section {
    padding: 3rem 1rem !important;
  }
}
