/* CSS Variables */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --accent-primary: #00d9ff;
  --accent-secondary: #7b2cbf;
  --accent-gradient: linear-gradient(135deg, #00d9ff 0%, #7b2cbf 100%);
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #6b6b80;
  --success: #00ff88;
  --error: #ff4757;
  --warning: #ffa502;
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --radius: 16px;
  --radius-sm: 8px;
}

/* Reset */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* App Container */
.app {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  padding: 40px 20px;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.8;
}

.note {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Main Content */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Upload Section */
.upload-section {
  width: 100%;
}

.dropzone {
  background: var(--bg-card);
  border: 2px dashed var(--accent-primary);
  border-radius: var(--radius);
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.dropzone:hover::before,
.dropzone.dragover::before {
  opacity: 0.05;
}

.dropzone-content {
  position: relative;
  z-index: 1;
}

.dropzone-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  filter: grayscale(0);
}

.dropzone h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.dropzone p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.file-button {
  display: inline-block;
  background: var(--accent-gradient);
  color: white;
  padding: 12px 32px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.file-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(0, 217, 255, 0.3);
}

.file-button input {
  display: none;
}

.file-hint {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* File Info Section */
.file-info {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.file-info h3 {
  margin-bottom: 20px;
  font-size: 1.2rem;
  color: var(--accent-primary);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.info-item {
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: var(--radius-sm);
}

.info-item .label {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.info-item .value {
  display: block;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.1rem;
  word-break: break-all;
}

/* Options */
.options {
  margin-bottom: 24px;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.option-row label {
  color: var(--text-secondary);
  font-weight: 500;
}

.option-row input[type="number"] {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  width: 120px;
  transition: border-color 0.2s ease;
}

.option-row input[type="number"]:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.option-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 8px;
}

/* Convert Button */
.convert-button {
  width: 100%;
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.convert-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 217, 255, 0.4);
}

.convert-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Status Section */
.status-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.status-section h3 {
  margin-bottom: 16px;
  font-size: 1.2rem;
  color: var(--warning);
}

.progress-container {
  background: var(--bg-secondary);
  border-radius: 100px;
  height: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  background: var(--accent-gradient);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 100px;
}

.status-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Download Section */
.download-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--success);
}

.download-section h3 {
  margin-bottom: 20px;
  font-size: 1.3rem;
  color: var(--success);
}

.download-button {
  display: inline-block;
  background: linear-gradient(135deg, #00ff88 0%, #00d9ff 100%);
  color: #0f0f1a;
  padding: 16px 40px;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.download-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 255, 136, 0.4);
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px;
  margin-top: auto;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 3D Viewer Section */
.viewer-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.viewer-section h3 {
  margin-bottom: 16px;
  font-size: 1.2rem;
  color: var(--accent-primary);
}

.viewer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}

.viewer-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.viewer-btn:hover {
  background: var(--accent-primary);
  color: var(--bg-primary);
}

.viewer-btn.active {
  background: var(--accent-primary);
  color: var(--bg-primary);
}

.color-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.color-picker label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.color-picker input[type="color"] {
  width: 40px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
}

.color-picker input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker input[type="color"]::-webkit-color-swatch {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.viewer-container {
  width: 100%;
  height: 400px;
  background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-color);
}

.viewer-container canvas {
  width: 100% !important;
  height: 100% !important;
}

.viewer-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.file-info,
.status-section,
.download-section {
  animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 600px) {
  .header h1 {
    font-size: 1.8rem;
  }
  
  .dropzone {
    padding: 40px 20px;
  }
  
  .dropzone-icon {
    font-size: 3rem;
  }
  
  .dropzone h2 {
    font-size: 1.2rem;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
  
  .option-row {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .option-row input[type="number"] {
    width: 100%;
  }
}
