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

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #252525;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --accent: #667eea;
  --accent-hover: #7c93f5;
  --border: #333;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}

.app-header {
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--accent);
}

.logo h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.tagline {
  font-size: 14px;
  color: var(--text-secondary);
}

.app-main {
  display: flex;
  height: calc(100vh - 60px);
}

/* Sidebar */
.sidebar {
  width: 320px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.upload-section {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  margin-bottom: 24px;
}

.upload-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.upload-tip {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
  opacity: 0.7;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

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

.control-group h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.gradient-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.gradient-swatch {
  aspect-ratio: 1;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.gradient-swatch:hover {
  transform: scale(1.05);
}

.gradient-swatch.active {
  border-color: var(--accent);
}

.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.color-row label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 60px;
}

.color-row input[type="color"] {
  width: 40px;
  height: 32px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.range-row label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 70px;
}

.range-row input[type="range"] {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
}

.range-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.range-row input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--accent-hover);
  transform: scale(1.1);
}

.range-value {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 40px;
  text-align: right;
}

.theme-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.theme-btn {
  flex: 1;
  aspect-ratio: 1;
  background: var(--bg-tertiary);
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

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

.theme-btn.active {
  border-color: var(--accent);
}

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

.theme-dot.dark {
  background: #1a1a1a;
  border: 2px solid #333;
}

.theme-dot.light {
  background: #f5f5f5;
  border: 2px solid #ddd;
}

.theme-dot.windows {
  background: #0078d4;
}

.theme-dot.none {
  background: transparent;
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
}

.text-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.text-row label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 60px;
}

.text-row input[type="text"] {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  transition: all 0.2s;
}

.text-row input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

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

.toggle-row label {
  font-size: 13px;
  color: var(--text-secondary);
}

.toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

.btn-download {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-download:hover {
  background: var(--accent-hover);
}

/* Preview Area */
.preview-area {
  flex: 1;
  background: #0d0d0d;
  overflow: auto;
  position: relative;
}

.preview-scroll {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.preview-canvas {
  display: inline-block;
  padding: 40px;
  border-radius: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  transition: all 0.3s;
}

.preview-canvas.checkerboard {
  background-image:
    linear-gradient(135deg, #667eea 0%, #764ba2 100%),
    linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 100% 100%, 20px 20px, 20px 20px, 20px 20px, 20px 20px;
  background-position: 0 0, 0 0, 0 10px, 10px -10px, -10px 0;
}

.preview-canvas.no-window.checkerboard {
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 20px 20px, 20px 20px, 20px 20px, 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.preview-canvas.exporting.checkerboard {
  background-image:
    linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.preview-canvas.drag-over {
  outline: 3px dashed var(--accent);
  outline-offset: -10px;
}

/* Window Styles */
.window {
  width: 700px;
  background: #1a1a1a;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  transition: all 0.3s;
}

.window-header {
  height: 40px;
  background: #2a2a2a;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.traffic-lights {
  display: flex;
  gap: 8px;
}

.traffic-lights span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.tl-close {
  background: #ff5f57;
}

.tl-minimize {
  background: #ffbd2e;
}

.tl-maximize {
  background: #28ca42;
}

.window-title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: #a0a0a0;
}

.window-spacer {
  width: 52px;
}

.window-urlbar {
  background: #1a1a1a;
  padding: 8px 16px;
  border-bottom: 1px solid #333;
}

.urlbar-inner {
  background: #2a2a2a;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #a0a0a0;
}

.urlbar-lock {
  color: #28ca42;
  flex-shrink: 0;
}

.window-body {
  background: white;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.drop-zone {
  text-align: center;
  color: #666;
  padding: 60px 40px;
}

.drop-icon {
  margin-bottom: 16px;
  color: #999;
}

.drop-zone p {
  font-size: 14px;
}

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

/* Light theme */
.window.theme-light {
  background: #ffffff;
}

.window.theme-light .window-header {
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
}

.window.theme-light .window-title {
  color: #333;
}

.window.theme-light .window-urlbar {
  background: #ffffff;
  border-bottom-color: #e0e0e0;
}

.window.theme-light .urlbar-inner {
  background: #f5f5f5;
}

/* Windows theme */
.window.theme-windows .window-header {
  background: #0078d4;
  height: 32px;
}

.window.theme-windows .traffic-lights {
  gap: 0;
}

.window.theme-windows .traffic-lights span {
  width: 0;
  height: 0;
}

.window.theme-windows .window-title {
  color: white;
  font-size: 12px;
}

/* Responsive */
@media (max-width: 1024px) {
  .app-main {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    max-height: 50vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .preview-area {
    min-height: 50vh;
  }
}
