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

body {
  font-family: 'Space Grotesk', sans-serif;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
  min-height: 100vh;
  color: #e0e0e0;
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: rgba(20, 20, 35, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  backdrop-filter: blur(10px);
}

.header-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.app-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.title-icon {
  font-size: 1.5rem;
}

.app-subtitle {
  font-size: 0.9rem;
  color: #888;
  font-style: italic;
}

.sin-counter {
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
}

.counter-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.8);
}

.counter-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.counter-max {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
}

.main-content {
  flex: 1;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 2rem;
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.mode-toggle-section {
  background: rgba(30, 30, 50, 0.8);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #888;
  margin-bottom: 1rem;
}

.mode-toggle {
  width: 100%;
  background: #1a1a2e;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
}

.mode-label {
  flex: 1;
  text-align: center;
  padding: 0.75rem;
  font-weight: 500;
  z-index: 1;
  transition: color 0.3s ease;
}

.mode-slider {
  position: absolute;
  width: calc(50% - 0.5rem);
  height: calc(100% - 0.5rem);
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 50px;
  left: 0.25rem;
  transition: transform 0.3s ease;
}

.mode-toggle.frontend .mode-slider {
  transform: translateX(100%);
  background: linear-gradient(135deg, #11998e, #38ef7d);
}

.mode-toggle.backend .backend-label {
  color: #fff;
}

.mode-toggle.frontend .frontend-label {
  color: #fff;
}

.quick-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.action-btn {
  flex: 1;
  min-width: 100px;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn.chaos {
  background: linear-gradient(135deg, #ff4757, #c44569);
  color: #fff;
}

.action-btn.clean {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: #fff;
}

.action-btn.random {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: #fff;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.sins-section {
  background: rgba(30, 30, 50, 0.8);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  flex: 1;
  overflow-y: auto;
}

.sins-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sin-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  color: #aaa;
}

.sin-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.sin-toggle.active {
  background: rgba(255, 71, 87, 0.15);
  border-color: rgba(255, 71, 87, 0.4);
  color: #ff6b81;
}

.sin-icon {
  font-size: 1.25rem;
}

.sin-label {
  flex: 1;
  font-size: 0.9rem;
}

.sin-indicator {
  font-size: 1rem;
  font-weight: 700;
}

.sin-toggle.active .sin-indicator {
  color: #ff4757;
}

.sin-toggle:not(.active) .sin-indicator {
  color: #38ef7d;
}

.preview-section {
  background: rgba(30, 30, 50, 0.6);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
}

.preview-header {
  background: #2d2d3a;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.browser-dots {
  display: flex;
  gap: 0.5rem;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27ca3f; }

.url-bar {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #888;
}

.url-icon {
  font-size: 0.75rem;
}

.preview-content {
  flex: 1;
  background: #fff;
  overflow: auto;
  transition: opacity 0.3s ease;
}

.preview-content.transitioning {
  opacity: 0.5;
}

.preview-label {
  background: #1a1a2e;
  padding: 0.75rem 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #666;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Backend Preview Styles */
.backend-preview {
  background: #fff;
  color: #000;
  min-height: 400px;
}

.backend-preview h1 {
  font-weight: bold;
}

.backend-preview input {
  font-size: inherit;
  font-family: inherit;
}

.backend-preview button {
  font-family: inherit;
}

.backend-preview table {
  margin: 10px 0;
}

.backend-preview td {
  border: 1px solid #000;
}

/* Frontend Preview Styles */
.frontend-preview {
  padding: 2rem;
  min-height: 400px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.frontend-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.frontend-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.frontend-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 0.25rem;
}

.frontend-subtitle {
  font-size: 0.9rem;
  color: #888;
}

.frontend-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.frontend-input {
  flex: 1;
  padding: 0.875rem 1rem;
  border: 2px solid #eee;
  border-radius: 12px;
  font-size: 1rem;
  font-family: 'Space Grotesk', sans-serif;
  transition: border-color 0.2s;
}

.frontend-input:focus {
  outline: none;
  border-color: #667eea;
}

.frontend-button {
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.frontend-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.frontend-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.frontend-stat {
  flex: 1;
  background: #f8f9fa;
  padding: 1.25rem;
  border-radius: 16px;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: #333;
}

.stat-label {
  font-size: 0.8rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.frontend-times {
  display: flex;
  justify-content: space-around;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 12px;
  margin-bottom: 1rem;
}

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

.time-icon {
  font-size: 1.25rem;
}

.time-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: #555;
}

.frontend-footer {
  text-align: center;
  color: #aaa;
  font-size: 0.8rem;
}

.app-footer {
  background: rgba(20, 20, 35, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(10px);
}

.footer-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #38ef7d;
  background: rgba(56, 239, 125, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid rgba(56, 239, 125, 0.3);
}

.footer-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: #667eea;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: #764ba2;
}

/* Responsive */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }
  
  .preview-section {
    min-height: 500px;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 1rem;
  }
  
  .app-title {
    font-size: 1.25rem;
  }
  
  .main-content {
    padding: 1rem;
    gap: 1rem;
  }
  
  .quick-actions {
    flex-direction: column;
  }
  
  .action-btn {
    width: 100%;
  }
  
  .frontend-preview {
    padding: 1rem;
  }
  
  .frontend-card {
    padding: 1.5rem;
  }
  
  .app-footer {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
}