@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

/* Base styles */
body {
  color: #e5e7eb;
  background: radial-gradient(ellipse at top left, #0f1419 0%, #0a0a0a 50%, #000000 100%);
  min-height: 100vh;
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
}

.app-container {
  display: flex;
  height: 100vh;
  position: relative;
}

/* Main canvas area */
.canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow: auto;
  position: relative;
}

.canvas-wrapper {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#preview-canvas {
  max-width: 100%;
  max-height: calc(100vh - 4rem);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border-radius: 0.5rem;
}

/* Drop zone */
.drop-zone {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 600px;
  width: 90%;
  background: linear-gradient(135deg, rgba(20, 20, 20, 0.6) 0%, rgba(15, 15, 15, 0.8) 100%);
  backdrop-filter: blur(10px);
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drop-zone:hover {
  border-color: rgba(59, 130, 246, 0.3);
  background: linear-gradient(135deg, rgba(20, 20, 20, 0.8) 0%, rgba(15, 15, 15, 0.9) 100%);
  transform: translate(-50%, -50%) translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.drop-zone.drag-over {
  border-color: rgba(59, 130, 246, 0.5);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
}

.drop-zone h2 {
  font-size: 1.5rem;
  font-weight: 300;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.drop-zone p {
  font-size: 0.875rem;
  color: #8b92a0;
  margin-bottom: 0.5rem;
}

.drop-zone code {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-family: monospace;
  font-size: 0.875rem;
}

.drop-zone.hidden {
  display: none;
}

/* Sidebar (controls + export) */
.sidebar {
  width: 320px;
  background: linear-gradient(135deg, rgba(20, 20, 20, 0.95) 0%, rgba(15, 15, 15, 0.98) 100%);
  backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Control panel */
.control-panel {
  flex: 1;
  padding: 1.5rem;
  padding-bottom: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.control-panel h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Section headers and separators */
.section-header {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #93bbfc;
  margin-bottom: 1rem;
  margin-top: 1.5rem;
  text-transform: uppercase;
}

.section-header:first-child {
  margin-top: 0;
}

.section-separator {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
  margin: 1.5rem 0;
}

.control-group {
  margin-bottom: 1.5rem;
}

.control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: #cbd5e1;
}

.control-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #93bbfc;
  background: rgba(59, 130, 246, 0.1);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
}

/* Slider styling */
input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 12px rgba(59, 130, 246, 0.6);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  transition: all 0.2s;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 12px rgba(59, 130, 246, 0.6);
}

input[type="range"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input[type="range"]:disabled::-webkit-slider-thumb {
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.3);
}

input[type="range"]:disabled::-moz-range-thumb {
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.3);
}

/* Checkbox styling */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border-radius: 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  transition: all 0.2s;
}

input[type="checkbox"]:checked {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: #3b82f6;
}

input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

/* Color picker styling */
input[type="color"] {
  width: 100%;
  height: 40px;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  padding: 0.25rem;
  transition: all 0.2s;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 0.375rem;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 0.375rem;
}

input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 0.375rem;
}

input[type="color"]:hover {
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.02);
}

/* Background grid */
.background-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

/* Custom gradient input */
.custom-gradient-wrapper {
  margin-top: 0.75rem;
}

.custom-gradient-input {
  width: 100%;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #e5e7eb;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.2s;
}

.custom-gradient-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

.custom-gradient-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

/* Gradient direction controls */
.gradient-direction-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.gradient-direction-btn {
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.75rem;
  text-align: center;
  font-family: inherit;
}

.gradient-direction-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.gradient-direction-btn.active {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  color: #93bbfc;
}

/* Gradient color pickers */
.gradient-color-pickers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.gradient-color-pickers input[type="color"] {
  height: 50px;
}

/* Gradient swap button */
.gradient-swap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #93bbfc;
  margin-left: 0.5rem;
}

.gradient-swap-btn:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.1);
  transform: rotate(180deg);
}

.control-label a {
  display: inline-flex;
  align-items: center;
  color: #93bbfc;
  text-decoration: none;
  transition: all 0.2s;
}

.control-label a:hover {
  color: #a8c7ff;
  transform: scale(1.1);
}

.control-label a svg {
  display: block;
}

.background-option {
  aspect-ratio: 1;
  border-radius: 0.5rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.background-option:hover {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.background-option.active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.background-option span {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  padding: 0.25rem;
  text-align: center;
  font-size: 0.625rem;
  color: #e5e7eb;
}

/* Background presets */
.bg-cool {
  background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
}

.bg-beach {
  background: linear-gradient(135deg, #14b8a6 0%, #0891b2 100%);
}

.bg-custom {
  background: conic-gradient(from 90deg at 50% 50%, #667eea 0deg, #764ba2 90deg, #f093fb 180deg, #667eea 360deg);
}

.bg-rose {
  background: linear-gradient(135deg, #f43f5e 0%, #ec4899 100%);
}

.bg-love {
  background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
}

.bg-flower {
  background: linear-gradient(135deg, #f9a8d4 0%, #fbbf24 100%);
}

.bg-sky {
  background: linear-gradient(135deg, #38bdf8 0%, #e0f2fe 100%);
}

.bg-none {
  background:
    linear-gradient(45deg, #2a2a2a 25%, transparent 25%),
    linear-gradient(-45deg, #2a2a2a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2a2a 75%),
    linear-gradient(-45deg, transparent 75%, #2a2a2a 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: #1a1a1a;
}

.bg-solid {
  background: #667eea;
}

/* Ratio buttons */
.ratio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.ratio-btn {
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.75rem;
  text-align: center;
}

.ratio-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.ratio-btn.active {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  color: #93bbfc;
}

/* Export section (sticky at bottom) */
.export-section {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, rgba(15, 15, 15, 0.98) 0%, rgba(10, 10, 10, 0.99) 100%);
  backdrop-filter: blur(10px);
}

.export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.export-btn {
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.813rem;
  font-weight: 500;
  text-align: center;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}

.export-btn-primary {
  border: 1px solid rgba(59, 130, 246, 0.3);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.08) 100%);
  color: #93bbfc;
}

.export-btn-primary:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0.15) 100%);
  border-color: rgba(59, 130, 246, 0.5);
  color: #a8c7ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.export-btn-secondary {
  grid-column: 1 / -1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
}

.export-btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.export-btn svg {
  flex-shrink: 0;
}

/* Legacy button styles (keep for compatibility) */
.export-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.button {
  padding: 0.75rem 1rem;
  border-radius: 0.625rem;
  border: 1px solid rgba(59, 130, 246, 0.2);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  color: #93bbfc;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.button:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.1) 100%);
  border-color: rgba(59, 130, 246, 0.5);
  color: #a8c7ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.25);
}

.button-secondary {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
}

.button-secondary:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #e5e7eb;
}

/* Footer */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 1rem;
  color: #6b7280;
  background: linear-gradient(180deg, transparent 0%, rgba(10, 10, 10, 0.3) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.75rem;
  pointer-events: none;
}

.footer a {
  color: #d1d5db;
  text-decoration: underline;
  pointer-events: all;
  transition: color 0.2s;
}

.footer a:hover {
  color: #93bbfc;
}

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

  .sidebar {
    width: 100%;
    max-height: 40vh;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }

  .control-panel {
    max-height: calc(40vh - 80px);
  }

  .canvas-area {
    flex: 1;
    min-height: 60vh;
  }

  .footer {
    display: none;
  }
}

/* Utility classes */
.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.gap-2 {
  gap: 0.5rem;
}

/* Animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.control-group {
  animation: fadeInUp 0.3s ease-out;
}

.section-header {
  animation: fadeInUp 0.2s ease-out;
}

.section-separator {
  animation: fadeInUp 0.2s ease-out;
}
