:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #8b5cf6;
  --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --surface: #1e293b;
  --surface-hover: #334155;
  --border: #334155;
  --text: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.header-left, .header-center, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-icon:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.device-toggle {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 4px;
}

.device-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.device-btn:hover {
  color: var(--text);
}

.device-btn.active {
  background: var(--gradient);
  color: white;
}

.btn-primary, .btn-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

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

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

.btn-full {
  width: 100%;
  justify-content: center;
}

/* Main Content */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.sections-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.section-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: grab;
  transition: all 0.2s;
}

.section-item:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.section-item.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--gradient);
  border-radius: var(--radius);
  color: white;
  flex-shrink: 0;
}

.section-info {
  flex: 1;
  min-width: 0;
}

.section-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
}

.section-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.add-section-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.add-section-btn:hover {
  transform: scale(1.1);
}

/* Canvas */
.canvas-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.section-count {
  font-size: 12px;
  color: var(--text-muted);
}

.canvas-wrapper {
  flex: 1;
  overflow: auto;
  padding: 24px;
  display: flex;
  justify-content: center;
  background: var(--bg);
}

.canvas {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transition: width 0.3s ease;
  min-height: 600px;
}

.canvas.desktop {
  width: 100%;
  max-width: 1200px;
}

.canvas.tablet {
  width: 768px;
}

.canvas.mobile {
  width: 375px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 500px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
}

.canvas-sections {
  min-height: 100%;
}

/* Canvas Sections */
.canvas-section {
  position: relative;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.canvas-section:hover {
  border-color: var(--primary-light);
}

.canvas-section.selected {
  border-color: var(--primary);
}

.section-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
}

.canvas-section:hover .section-controls {
  opacity: 1;
}

.section-control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.section-control-btn:hover {
  background: var(--primary-dark);
}

.section-control-btn.delete {
  background: var(--danger);
}

.section-control-btn.delete:hover {
  background: #dc2626;
}

.drag-handle {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: grab;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
}

.canvas-section:hover .drag-handle {
  opacity: 1;
}

.drag-handle:active {
  cursor: grabbing;
}

/* Section Types */
.section-hero {
  padding: 80px 40px;
  text-align: center;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
}

.section-hero h1 {
  font-size: 48px;
  font-weight: 800;
  margin-bottom: 16px;
}

.section-hero p {
  font-size: 20px;
  opacity: 0.9;
  margin-bottom: 32px;
}

.section-hero .hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 32px;
  background: white;
  color: var(--primary);
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius);
  text-decoration: none;
}

.section-features {
  padding: 80px 40px;
  background: #f8fafc;
}

.section-features h2 {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 48px;
  color: #1e293b;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.feature-card {
  text-align: center;
  padding: 32px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.feature-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--gradient);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
}

.feature-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #1e293b;
}

.feature-card p {
  font-size: 14px;
  color: #64748b;
}

.section-testimonials {
  padding: 80px 40px;
  background: white;
}

.section-testimonials h2 {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 48px;
  color: #1e293b;
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.testimonial-card {
  padding: 24px;
  background: #f8fafc;
  border-radius: var(--radius-lg);
}

.testimonial-text {
  font-size: 16px;
  line-height: 1.6;
  color: #334155;
  margin-bottom: 16px;
  font-style: italic;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.testimonial-avatar {
  width: 48px;
  height: 48px;
  background: var(--gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
}

.testimonial-info h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.testimonial-info p {
  font-size: 12px;
  color: #64748b;
}

.section-pricing {
  padding: 80px 40px;
  background: #f8fafc;
}

.section-pricing h2 {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 48px;
  color: #1e293b;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.pricing-card {
  padding: 32px;
  background: white;
  border-radius: var(--radius-lg);
  text-align: center;
  border: 2px solid #e2e8f0;
}

.pricing-card.popular {
  border-color: var(--primary);
  transform: scale(1.05);
}

.pricing-card h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #1e293b;
}

.pricing-price {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary);
  margin: 16px 0;
}

.pricing-price span {
  font-size: 16px;
  font-weight: 400;
  color: #64748b;
}

.pricing-features {
  list-style: none;
  margin: 24px 0;
  text-align: left;
}

.pricing-features li {
  padding: 8px 0;
  color: #334155;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pricing-features li::before {
  content: "✓";
  color: var(--success);
  font-weight: 600;
}

.pricing-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.section-faq {
  padding: 80px 40px;
  background: white;
}

.section-faq h2 {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 48px;
  color: #1e293b;
}

.faq-list {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  border-bottom: 1px solid #e2e8f0;
  padding: 20px 0;
}

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
}

.faq-answer {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.6;
  color: #64748b;
}

.section-cta {
  padding: 80px 40px;
  text-align: center;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
}

.section-cta h2 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 16px;
}

.section-cta p {
  font-size: 18px;
  opacity: 0.9;
  margin-bottom: 32px;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 32px;
  background: white;
  color: var(--primary);
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius);
  text-decoration: none;
}

.section-footer {
  padding: 40px;
  background: #1e293b;
  color: white;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-brand h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.footer-brand p {
  font-size: 14px;
  color: #94a3b8;
}

.footer-links h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-links ul {
  list-style: none;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: white;
}

.footer-bottom {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #334155;
  text-align: center;
  font-size: 12px;
  color: #64748b;
}

/* Properties Panel */
.properties-panel {
  width: 300px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.panel-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.no-selection {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  text-align: center;
  color: var(--text-muted);
}

.no-selection svg {
  margin-bottom: 12px;
  opacity: 0.3;
}

.no-selection p {
  font-size: 14px;
}

.prop-group {
  margin-bottom: 20px;
}

.prop-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.prop-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s;
}

.prop-input:focus {
  outline: none;
  border-color: var(--primary);
}

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

.prop-color {
  display: flex;
  gap: 8px;
}

.prop-color input[type="color"] {
  width: 48px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: transparent;
}

.prop-color input[type="text"] {
  flex: 1;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-content.modal-lg {
  max-width: 900px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

/* Templates Grid */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.template-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}

.template-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.template-preview {
  height: 150px;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 32px;
}

.template-info {
  padding: 16px;
  background: var(--surface);
}

.template-info h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.template-info p {
  font-size: 12px;
  color: var(--text-muted);
}

/* Export */
.export-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.export-tab {
  flex: 1;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.export-tab:hover {
  background: var(--surface-hover);
}

.export-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.export-code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  max-height: 300px;
  overflow: auto;
}

.export-code pre {
  margin: 0;
}

.export-code code {
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 12px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
}

/* Publish */
.publish-features {
  margin-bottom: 24px;
}

.publish-feature {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.publish-feature h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.publish-feature p {
  font-size: 12px;
  color: var(--text-muted);
}

.signup-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.signup-form input {
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
}

.signup-form input:focus {
  outline: none;
  border-color: var(--primary);
}

.form-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Drag and Drop */
.drag-over {
  background: rgba(99, 102, 241, 0.1);
  border: 2px dashed var(--primary) !important;
}

.drop-indicator {
  height: 4px;
  background: var(--primary);
  margin: 4px 0;
  border-radius: 2px;
}
