:root {
  --primary: #4F46E5;
  --secondary: #2563EB;
  --accent: #06B6D4;
  --bg: #F8FAFC;
  --text: #0F172A;
  --text-light: #475569;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --success: #10B981;
  --error: #EF4444;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] {
  --bg: #0F172A;
  --text: #F8FAFC;
  --text-light: #94A3B8;
  --surface: #1E293B;
  --border: #334155;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
  overflow-x: hidden;
}

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

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 { font-size: 3rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.5rem; }

p {
  color: var(--text-light);
  margin-bottom: 1rem;
}

/* Navigation */
.navbar {
  position: sticky;
  top: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 100;
}

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

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

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

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

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

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

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle {
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: var(--border);
  color: var(--text);
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: white;
}

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

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

.btn-block {
  width: 100%;
}

/* Hero Section */
.hero {
  padding: 100px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 80vw;
  height: 80vw;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.1) 0%, rgba(255,255,255,0) 70%);
  z-index: -1;
  border-radius: 50%;
}

.hero h1 {
  font-size: 3.5rem;
  max-width: 800px;
  margin: 0 auto 1.5rem;
  background: linear-gradient(to right, var(--text), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.25rem;
  max-width: 600px;
  margin: 0 auto 2.5rem;
}

.hero-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 64px;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 40px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 80px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

/* Sections */
.section {
  padding: 80px 0;
}

.section-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 48px;
}

/* Features */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 32px;
}

.feature-card {
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.3s;
}

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

.feature-icon {
  width: 48px;
  height: 48px;
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

/* Format Cards */
.formats {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.format-card {
  background: var(--surface);
  padding: 16px 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-weight: 600;
  color: var(--text);
}

/* Tool Interface */
.tool-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 32px;
  margin-top: 40px;
  align-items: start;
}

.tool-sidebar {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.tool-group {
  margin-bottom: 24px;
}

.tool-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.select-box {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}

.toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

/* Switch Component */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
  border-radius: 24px;
}
.slider-toggle:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider-toggle {
  background-color: var(--primary);
}
input:checked + .slider-toggle:before {
  transform: translateX(20px);
}
[data-theme="dark"] .slider-toggle { background-color: var(--border); }

/* Upload Area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 64px 24px;
  text-align: center;
  background: var(--surface);
  transition: all 0.3s;
  cursor: pointer;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 500px;
}

.upload-area.dragover {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}

.upload-icon {
  width: 64px;
  height: 64px;
  color: var(--text-light);
  margin-bottom: 24px;
}

.file-input {
  display: none;
}

/* Preview Area */
.preview-area {
  display: none;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  min-height: 500px;
}

.slider-container {
  position: relative;
  width: 100%;
  height: 500px;
  overflow: hidden;
  background: #000;
}

.slider-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.img-after {
  clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
  filter: contrast(1.1) saturate(1.2);
}

.compare-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  z-index: 10;
}

.slider-line {
  position: absolute;
  top: 0;
  left: 50%;
  bottom: 0;
  width: 4px;
  background: white;
  z-index: 5;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.slider-btn {
  width: 32px;
  height: 32px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.slider-btn svg { width: 20px; height: 20px; fill: var(--primary); }

.preview-overlay {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  padding: 12px 24px;
  border-radius: 30px;
  display: flex;
  gap: 24px;
  z-index: 20;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}

.info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.info-label { font-size: 0.75rem; color: var(--text-light); text-transform: uppercase; font-weight: 600;}
.info-val { font-weight: 700; color: var(--text); }

/* Loading State */
.loading-state {
  display: none;
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 30;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
}
.toast {
  background: var(--surface);
  color: var(--text);
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  margin-top: 12px;
  transform: translateX(120%);
  transition: transform 0.3s;
  display: flex;
  align-items: center;
  gap: 12px;
}
.toast.show { transform: translateX(0); }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }

/* FAQ */
.faq-list {
  max-width: 800px;
  margin: 0 auto;
}
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.faq-question {
  padding: 20px 24px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
  color: var(--text);
}
.faq-answer {
  padding: 0 24px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  color: var(--text-light);
}
.faq-item.active .faq-answer {
  padding: 0 24px 20px;
  max-height: 500px;
}
.faq-icon { transition: transform 0.3s; }
.faq-item.active .faq-icon { transform: rotate(180deg); }

/* Article */
.article-content {
  max-width: 800px;
  margin: 0 auto;
  background: var(--surface);
  padding: 48px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.article-content h2 { margin-top: 2rem; }
.article-content ul { list-style: disc; padding-left: 1.5rem; margin-bottom: 1rem; color: var(--text-light); }

/* Form */
.form-group {
  margin-bottom: 24px;
}
.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
}
.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
}
textarea.form-control {
  min-height: 150px;
  resize: vertical;
}

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

/* Responsive */
@media (max-width: 992px) {
  .tool-layout { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .nav-links, .nav-actions .btn { display: none; }
  .mobile-menu-btn { display: block; }
  .hero h1 { font-size: 2.5rem; }
  .stats { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .nav-links.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 72px;
    left: 0;
    width: 100%;
    background: var(--surface);
    padding: 24px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
}


/* Info Panel Layout Fixes */
.preview-layout {
  display: flex;
  flex-direction: row;
  height: 100%;
}
.preview-area .slider-container {
  flex: 1;
  position: relative;
  min-height: 500px;
}
.info-panel {
  width: 250px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.info-panel-title {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text);
}
.info-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.info-label {
  font-size: 0.8rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.info-val {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 992px) {
  .preview-layout {
    flex-direction: column;
  }
  .info-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 24px 16px;
  }
  .info-panel-title {
    width: 100%;
    text-align: center;
    margin-bottom: 16px;
  }
  .info-item {
    align-items: center;
    flex: 1 1 30%;
  }
}
