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

:root {
  --orange: #f3931b;
  --orange-hover: #e08315;
  --teal: #1b9ad7;
  --teal-hover: #178bbe;
  --dark: #0a0a1a;
  --card-bg: rgba(255, 255, 255, 0.07);
  --card-border: rgba(255, 255, 255, 0.12);
  --card-glow: rgba(243, 147, 27, 0.08);
  --text-primary: #f0f0f5;
  --text-secondary: rgba(240, 240, 245, 0.6);
  --text-muted: rgba(240, 240, 245, 0.35);
  --danger: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
}

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

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--dark);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Animated gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(243, 147, 27, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 90%, rgba(27, 154, 215, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(100, 50, 180, 0.08) 0%, transparent 70%);
  animation: bgShift 12s ease-in-out infinite alternate;
  z-index: 0;
  pointer-events: none;
}

@keyframes bgShift {
  0% {
    background:
      radial-gradient(ellipse 80% 60% at 20% 10%, rgba(243, 147, 27, 0.15) 0%, transparent 60%),
      radial-gradient(ellipse 60% 80% at 80% 90%, rgba(27, 154, 215, 0.12) 0%, transparent 60%),
      radial-gradient(ellipse 50% 50% at 50% 50%, rgba(100, 50, 180, 0.08) 0%, transparent 70%);
  }
  100% {
    background:
      radial-gradient(ellipse 80% 60% at 70% 80%, rgba(243, 147, 27, 0.12) 0%, transparent 60%),
      radial-gradient(ellipse 60% 80% at 20% 20%, rgba(27, 154, 215, 0.15) 0%, transparent 60%),
      radial-gradient(ellipse 50% 50% at 60% 40%, rgba(100, 50, 180, 0.1) 0%, transparent 70%);
  }
}

/* Container */
.container {
  position: relative;
  z-index: 1;
  max-width: 580px;
  margin: 0 auto;
  padding: 48px 20px 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 36px;
}

h1 {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--orange) 0%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 400;
  margin-top: 6px;
  letter-spacing: 0.01em;
}

/* Warning Banner */
.warning-banner {
  background: rgba(254, 243, 205, 0.1);
  color: #ffc107;
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
  backdrop-filter: blur(8px);
}

/* Card — Glassmorphism */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 32px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

/* Section Label */
.section-label {
  display: block;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Model Selector */
.model-selector {
  margin-bottom: 20px;
}

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

.model-select {
  width: 100%;
  padding: 12px 14px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.model-select:hover,
.model-select:focus {
  border-color: var(--orange);
  background: rgba(255, 255, 255, 0.08);
}

.model-select option {
  background: #1a1a2e;
  color: var(--text-primary);
}

/* Drop Zone */
.drop-zone {
  position: relative;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  padding: 44px 24px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
}

.drop-zone:hover {
  border-color: rgba(243, 147, 27, 0.5);
  background: rgba(243, 147, 27, 0.04);
}

.drop-zone.drag-over {
  border-color: var(--orange);
  background: rgba(243, 147, 27, 0.08);
  box-shadow: 0 0 24px rgba(243, 147, 27, 0.15);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.drop-zone-icon {
  color: var(--text-muted);
  transition: color 0.3s ease, transform 0.3s ease;
}

.drop-zone:hover .drop-zone-icon {
  color: var(--orange);
  transform: translateY(-2px);
}

.drop-zone.drag-over .drop-zone-icon {
  color: var(--orange);
  transform: translateY(-4px);
}

.drop-zone-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drop-zone-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.drop-zone-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-preview {
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  word-break: break-all;
  overflow-wrap: break-word;
}

/* Buttons */
.buttons {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  min-height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.btn svg {
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(135deg, var(--orange) 0%, #e88a10 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(243, 147, 27, 0.3);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(243, 147, 27, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-reset {
  background: rgba(27, 154, 215, 0.12);
  color: var(--teal);
  border: 1px solid rgba(27, 154, 215, 0.25);
}

.btn-reset:hover:not(:disabled) {
  background: rgba(27, 154, 215, 0.2);
  border-color: rgba(27, 154, 215, 0.4);
}

.btn-download {
  display: flex;
  width: 100%;
  background: linear-gradient(135deg, var(--teal) 0%, #1585bf 100%);
  color: white;
  margin-top: 16px;
  box-shadow: 0 4px 16px rgba(27, 154, 215, 0.3);
}

.btn-download:hover {
  box-shadow: 0 6px 24px rgba(27, 154, 215, 0.45);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Progress */
.progress {
  margin-top: 24px;
  animation: fadeIn 0.3s ease;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

#progressPercent {
  font-weight: 700;
  color: var(--orange);
}

.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

.bar {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--teal));
  border-radius: 8px;
  transition: width 0.4s ease;
  position: relative;
}

.bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Status */
.status {
  color: var(--text-secondary);
  margin-top: 12px;
  min-height: 20px;
  font-size: 13px;
}

/* Output */
.output-placeholder {
  margin-top: 24px;
  padding: 48px 24px;
  border: 2px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  text-align: center;
}

.output-placeholder p {
  color: var(--text-muted);
  font-size: 13px;
}

.preview {
  max-width: 100%;
  display: block;
  margin-top: 24px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: fadeIn 0.4s ease;
}

/* Footer */
.footer {
  text-align: center;
  margin-top: auto;
  padding-top: 32px;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: var(--orange);
}

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

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Backdrop-filter fallback for unsupported browsers */
@supports not (backdrop-filter: blur(1px)) {
  .card {
    background: rgba(20, 20, 40, 0.92);
  }
  .warning-banner {
    background: rgba(50, 40, 10, 0.9);
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Tablet */
@media (max-width: 768px) {
  .container {
    max-width: 100%;
    padding: 36px 24px 28px;
  }

  h1 {
    font-size: 32px;
  }

  .card {
    padding: 28px 24px;
  }
}

/* Smartphone */
@media (max-width: 640px) {
  body::before {
    animation: none;
    background:
      radial-gradient(ellipse 80% 60% at 30% 20%, rgba(243, 147, 27, 0.12) 0%, transparent 60%),
      radial-gradient(ellipse 60% 80% at 70% 80%, rgba(27, 154, 215, 0.1) 0%, transparent 60%);
  }

  .container {
    padding: 20px 16px 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .header {
    margin-bottom: 20px;
  }

  h1 {
    font-size: 26px;
  }

  .subtitle {
    font-size: 13px;
  }

  .card {
    padding: 20px 16px;
    border-radius: 14px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .section-label {
    font-size: 14px;
    margin-bottom: 12px;
  }

  .drop-zone {
    padding: 32px 16px;
    border-radius: 12px;
  }

  .drop-zone-icon {
    width: 36px;
    height: 36px;
  }

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

  .drop-zone-subtitle {
    font-size: 12px;
  }

  .buttons {
    flex-direction: column;
    gap: 8px;
  }

  .btn {
    width: 100%;
    padding: 12px 18px;
  }

  .btn-download {
    width: 100%;
    text-align: center;
  }

  .output-placeholder {
    padding: 28px 16px;
  }

  .preview {
    border-radius: 10px;
  }

  .progress-info {
    font-size: 12px;
  }

  .footer {
    padding-top: 24px;
    font-size: 11px;
  }
}

/* Small phones */
@media (max-width: 380px) {
  .container {
    padding: 16px 12px 12px;
  }

  h1 {
    font-size: 22px;
  }

  .card {
    padding: 16px 14px;
    border-radius: 12px;
  }

  .drop-zone {
    padding: 24px 12px;
  }

  .drop-zone-icon {
    width: 30px;
    height: 30px;
  }

  .btn {
    min-height: 42px;
    font-size: 13px;
  }
}

/* Landscape phone */
@media (max-height: 500px) and (orientation: landscape) {
  .container {
    padding-top: 12px;
    min-height: auto;
  }

  .header {
    margin-bottom: 12px;
  }

  .drop-zone {
    padding: 20px 16px;
  }

  .drop-zone-icon {
    width: 28px;
    height: 28px;
  }

  .output-placeholder {
    padding: 20px 16px;
  }
}
