:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg-color: #0f172a;
  --panel-bg: rgba(30, 41, 59, 0.7);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --font-main: 'Inter', system-ui, sans-serif;
  --radius-lg: 16px;
  --radius-md: 8px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-main);
  background: var(--bg-color);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.15), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(168, 85, 247, 0.15), transparent 25%);
  color: var(--text-main);
  /* height and overflow removed for landing page scroll */
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 800px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  position: relative;
  background: var(--panel-bg);
}

/* Panels Container */
.panels-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Panels */
.panel {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-border) transparent;
}
.panel::-webkit-scrollbar {
  width: 6px;
}
.panel::-webkit-scrollbar-thumb {
  background: var(--panel-border);
  border-radius: 4px;
}

#editor-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--panel-border);
  max-width: 50%;
}

#preview-panel {
  background: #1e293b;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-top: 80px; /* Space for the absolute toolbar on desktop */
}

/* Forms */
.form-section {
  margin-bottom: 32px;
  background: rgba(15, 23, 42, 0.4);
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--panel-border);
}

.form-section h2 {
  font-size: 1.25rem;
  margin-bottom: 16px;
  font-weight: 600;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.input-field {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.textarea {
  resize: vertical;
  min-height: 100px;
}

.array-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  position: relative;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.item-header h4 {
  font-size: 1rem;
  color: #cbd5e1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.btn-outline {
  width: 100%;
  background: transparent;
  border: 1px dashed var(--panel-border);
  color: var(--primary);
  padding: 12px;
}

.btn-outline:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--primary);
}

.btn-icon {
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}

.btn-icon:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* Sticky Footer Toolbar */
.sticky-footer {
  position: absolute;
  top: 24px;
  right: 24px;
  width: calc(50% - 48px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--panel-border);
}

/* Preview Area */
.preview-container {
  flex: 1;
  background: transparent;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
}

#svg-preview {
  width: 100%;
  max-width: 210mm; /* exact A4 proportions */
  aspect-ratio: 210 / 297;
  background: white;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  border-radius: 4px;
  overflow: hidden;
}

#svg-preview svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Status / Loading */
.status-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: #fbbf24;
}
.status-ready {
  color: #34d399;
}
.status-error {
  color: #ef4444;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Ad Containers */
.ad-container {
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  text-align: center;
  padding: 10px;
}

.ad-slot-sidebar {
  width: 300px;
  height: 250px;
  margin: 32px auto 0 auto;
}

.ad-slot-banner {
  width: 80%;
  height: 120px;
  margin: 32px auto;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-wrapper {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: white;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.app-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(to right, #f8fafc, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Mobile Tabs */
.mobile-tabs {
  display: none;
  background: rgba(15, 23, 42, 0.9);
  padding: 12px 16px;
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 600;
  padding: 12px;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.tab-btn.active {
  color: var(--primary);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

/* Mobile Layout */
@media (max-width: 768px) {
  .mobile-tabs {
    display: flex;
  }
  
  .panels-container {
    flex-direction: column;
  }
  
  #editor-panel {
    max-width: 100%;
    border-right: none;
    display: none;
    padding-bottom: 90px;
  }
  
  .app-container {
    height: 90vh; /* Adjust height for mobile */
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  #preview-panel {
    display: none;
    padding-top: 16px;
    padding-bottom: 90px;
  }
  
  #editor-panel.active, 
  #preview-panel.active {
    display: flex;
  }
  
  /* Make toolbar a sticky footer on mobile */
  .sticky-footer {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--panel-border);
    border-bottom: none;
    padding: 16px 20px;
  }
  
  .ad-slot-banner {
    max-width: 320px;
    height: 50px;
  }
}

/* Landing Page Styles */
.main-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  z-index: 1000;
}

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

.nav-brand svg {
  color: var(--primary);
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 24px;
  font-weight: 500;
  transition: var(--transition);
}

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

.hero-section {
  text-align: center;
  padding: 80px 20px;
  max-width: 800px;
  margin: 0 auto;
}

.hero-section h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 24px;
  background: linear-gradient(to right, #f8fafc, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.hero-section p {
  font-size: 1.25rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

.hero-btn {
  font-size: 1.1rem;
  padding: 14px 28px;
  border-radius: 30px;
  text-decoration: none;
}

.features-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto 80px auto;
  padding: 0 20px;
}

.feature {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: var(--transition);
}

.feature:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  background: rgba(30, 41, 59, 0.8);
}

.feature h3 {
  font-size: 1.25rem;
  color: #e2e8f0;
  margin-bottom: 12px;
}

.feature p {
  color: var(--text-muted);
  line-height: 1.5;
}

.generator-section {
  padding: 30px 20px;
}

.main-footer {
  text-align: center;
  padding: 40px 20px;
  border-top: 1px solid var(--panel-border);
  color: var(--text-muted);
  font-size: 0.9rem;
  background: rgba(15, 23, 42, 0.9);
}

.main-footer p a {
  color: var(--text-main);
}

@media (max-width: 768px) {
  .hero-section h1 { font-size: 2rem; }
  .hero-section p { font-size: 1rem; }
  .nav-links { display: none; }
}

/* Micro Tool Article Section */
.micro-tool-section {
  position: relative;
  max-width: 1000px;
  margin: 4rem auto;
  padding: 3rem 2rem;
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px -5px rgba(99, 102, 241, 0.15);
  overflow: hidden;
}

.micro-tool-content {
  position: relative;
  z-index: 2;
  color: var(--text-muted);
  line-height: 1.8;
  font-size: 1.05rem;
}

.micro-tool-content h2 {
  font-size: 2rem;
  color: #f8fafc;
  margin-bottom: 1.5rem;
  background: linear-gradient(to right, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.micro-tool-content h3 {
  font-size: 1.3rem;
  color: #e2e8f0;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.micro-tool-content p {
  margin-bottom: 1rem;
}

/* Vector Animations */
.vector-shape {
  position: absolute;
  z-index: 1;
  opacity: 0.15;
}

.shape-1 {
  top: -20px;
  right: -20px;
  animation: float-slow 6s ease-in-out infinite;
}

.shape-2 {
  bottom: 20px;
  left: -20px;
  animation: pulse-slow 4s ease-in-out infinite;
}

.shape-3 {
  top: 50%;
  right: 10%;
  animation: float-slow 8s ease-in-out infinite reverse;
}

@keyframes float-slow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

@keyframes pulse-slow {
  0%, 100% { transform: scale(1); opacity: 0.1; }
  50% { transform: scale(1.1); opacity: 0.25; }
}

