/* Apple Design System Inspired Styles */
:root {
  --ios-blue: #007AFF;
  --ios-green: #34C759;
  --ios-red: #FF3B30;
  --ios-orange: #FF9500;
  --ios-gray: #8E8E93;
  --ios-light-gray: #F2F2F7;
  --ios-separator: #C6C6C8;
  --ios-label: #000000;
  --ios-secondary-label: #8E8E93;
  --ios-system-background: #FFFFFF;
  --ios-secondary-background: #F2F2F7;
  
  --sf-rounded: 12px;
  --sf-rounded-small: 8px;
  --sf-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --sf-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background-color: #F2F2F7;
  color: var(--ios-label);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 20px;
}

header {
  text-align: center;
  margin-bottom: 48px;
}

h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ios-label);
  margin-bottom: 8px;
}

.subtitle {
  font-size: 17px;
  color: var(--ios-secondary-label);
  font-weight: 400;
}

.upload-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

.upload-card {
  background: var(--ios-system-background);
  border-radius: var(--sf-rounded);
  padding: 24px;
  box-shadow: var(--sf-shadow);
  transition: all 0.3s ease;
}

.upload-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sf-shadow-hover);
}

.upload-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--ios-label);
  margin-bottom: 12px;
}

.file-input-wrapper {
  position: relative;
  overflow: hidden;
  display: inline-block;
  width: 100%;
}

.file-input {
  position: absolute;
  left: -9999px;
}

.file-input-button {
  display: block;
  width: 100%;
  padding: 12px 20px;
  background: var(--ios-blue);
  color: white;
  border-radius: var(--sf-rounded-small);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-input-button:hover {
  background: #0056CC;
}

.file-input-button:active {
  transform: scale(0.98);
}

.controls {
  background: var(--ios-system-background);
  border-radius: var(--sf-rounded);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--sf-shadow);
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.control-group {
  display: flex;
  flex-direction: column;
}

.control-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ios-secondary-label);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--ios-secondary-background);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  background: var(--ios-system-background);
  border: 2px solid var(--ios-blue);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(0.9);
}

.slider-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--ios-label);
  min-width: 40px;
}

.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  flex: 1;
  min-width: 100px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--sf-rounded-small);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

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

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

.btn-primary:hover:not(:disabled) {
  background: #0056CC;
}

.btn-secondary {
  background: var(--ios-secondary-background);
  color: var(--ios-label);
}

.btn-secondary:hover:not(:disabled) {
  background: #E5E5EA;
}

.btn-danger {
  background: var(--ios-red);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #D70015;
}

.btn.active {
  background: var(--ios-blue);
  color: white;
}

.canvas-container {
  background: var(--ios-system-background);
  border-radius: var(--sf-rounded);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--sf-shadow);
}

.canvas-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

#canvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--sf-rounded-small);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.instructions {
  text-align: center;
  margin-bottom: 24px;
}

.instructions p {
  font-size: 15px;
  color: var(--ios-secondary-label);
}

.status {
  text-align: center;
  font-size: 15px;
  color: var(--ios-secondary-label);
  padding: 12px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --ios-system-background: #1C1C1E;
    --ios-secondary-background: #2C2C2E;
    --ios-label: #FFFFFF;
    --ios-secondary-label: #8E8E93;
    --ios-light-gray: #2C2C2E;
  }
  
  body {
    background-color: #000000;
  }
}

/* Responsive design */
@media (max-width: 600px) {
  .container {
    padding: 40px 16px;
  }
  
  .upload-section {
    grid-template-columns: 1fr;
  }
  
  .controls-grid {
    grid-template-columns: 1fr;
  }
  
  h1 {
    font-size: 28px;
  }
}
