/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #e0e5ec;
  --surface: #e8edf4;
  --surface-raised: #edf2f9;
  --shadow-dark: #b8bec9;
  --shadow-light: #ffffff;
  --text-primary: #2d3748;
  --text-secondary: #718096;
  --text-muted: #a0aec0;
  --accent: #667eea;
  --accent-2: #764ba2;
  --accent-soft: rgba(102, 126, 234, 0.12);
  --success: #48bb78;
  --error: #fc8181;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  /* Neumorphic shadows */
  --neu-shadow: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
  --neu-shadow-sm: 4px 4px 10px var(--shadow-dark), -4px -4px 10px var(--shadow-light);
  --neu-shadow-lg: 10px 10px 24px var(--shadow-dark), -10px -10px 24px var(--shadow-light);
  --neu-inset: inset 4px 4px 10px var(--shadow-dark), inset -4px -4px 10px var(--shadow-light);
  --neu-pressed: inset 3px 3px 8px var(--shadow-dark), inset -3px -3px 8px var(--shadow-light);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Nunito', sans-serif;
  background-color: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ===== BACKGROUND BLOBS ===== */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #c3d0e8, #dde3ee);
  top: -120px;
  right: -100px;
}

.blob-2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #d4c5f9, #e0ddf5);
  bottom: 80px;
  left: -100px;
}

/* ===== APP WRAPPER ===== */
.app-wrapper {
  position: relative;
  z-index: 1;
  max-width: 540px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 36px;
  padding-top: 8px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 4px 4px 10px rgba(102, 126, 234, 0.35), -2px -2px 8px rgba(255,255,255,0.7);
}

.logo-text-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.logo-sub {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
  margin-top: 2px;
}

.header-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 6px 12px;
  border-radius: 100px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: var(--neu-shadow-sm);
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  margin-bottom: 32px;
  animation: fadeUp 0.6s ease both;
}

.hero-title {
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--neu-shadow-lg);
  padding: 28px 24px;
  margin-bottom: 20px;
  animation: fadeUp 0.5s ease both;
}

.input-card { animation-delay: 0.1s; }
.result-card { animation-delay: 0s; }
.error-card { animation-delay: 0s; }

/* ===== INPUT AREA ===== */
.input-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

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

.neu-input {
  flex: 1;
  background: var(--bg);
  border: none;
  outline: none;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--neu-inset);
  transition: box-shadow 0.2s ease;
  min-width: 0;
}

.neu-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.neu-input:focus {
  box-shadow: var(--neu-inset), 0 0 0 2px rgba(102, 126, 234, 0.25);
}

/* ===== BUTTONS ===== */
.neu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  touch-action: manipulation;
  user-select: none;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  padding: 14px 20px;
  font-size: 0.9rem;
  white-space: nowrap;
  box-shadow: 4px 4px 12px rgba(102, 126, 234, 0.4), -2px -2px 8px rgba(255,255,255,0.6);
  min-width: 100px;
}

.primary-btn:hover {
  box-shadow: 6px 6px 16px rgba(102, 126, 234, 0.5), -2px -2px 10px rgba(255,255,255,0.7);
  transform: translateY(-1px);
}

.primary-btn:active {
  box-shadow: 2px 2px 6px rgba(102, 126, 234, 0.35), -1px -1px 4px rgba(255,255,255,0.5);
  transform: translateY(1px);
}

.primary-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.download-btn {
  background: linear-gradient(135deg, var(--success), #38a169);
  color: white;
  padding: 14px 28px;
  font-size: 0.95rem;
  box-shadow: 4px 4px 12px rgba(72, 187, 120, 0.4), -2px -2px 8px rgba(255,255,255,0.6);
  width: 100%;
}

.download-btn:hover {
  box-shadow: 6px 6px 16px rgba(72, 187, 120, 0.5), -2px -2px 10px rgba(255,255,255,0.7);
  transform: translateY(-1px);
}

.download-btn:active {
  box-shadow: 2px 2px 6px rgba(72, 187, 120, 0.35);
  transform: translateY(1px);
}

.ghost-btn {
  background: var(--bg);
  color: var(--accent);
  padding: 12px 24px;
  font-size: 0.9rem;
  box-shadow: var(--neu-shadow-sm);
  margin-top: 4px;
}

.ghost-btn:hover { transform: translateY(-1px); }
.ghost-btn:active { box-shadow: var(--neu-pressed); transform: translateY(0); }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--neu-shadow-sm);
  color: var(--text-secondary);
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.icon-btn:hover { color: var(--text-primary); }
.icon-btn:active { box-shadow: var(--neu-pressed); }

/* ===== TYPE CHIPS ===== */
.type-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 6px 12px;
  border-radius: 100px;
  box-shadow: var(--neu-shadow-sm);
}

/* ===== LOADING CARD ===== */
.loading-card {
  text-align: center;
}

.loader-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.neu-spinner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--neu-shadow);
  position: relative;
}

.neu-spinner::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  animation: spin 0.9s linear infinite;
}

.loading-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ===== RESULT CARD ===== */
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.result-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 12px;
  border-radius: 100px;
  box-shadow: var(--neu-shadow-sm);
}

.media-preview {
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--neu-shadow);
  margin-bottom: 18px;
  background: var(--bg);
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-preview img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 400px;
  object-fit: cover;
}

.media-preview video {
  width: 100%;
  max-height: 400px;
  display: block;
  border-radius: var(--radius-lg);
}

.media-placeholder {
  padding: 32px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.meta-row {
  margin-bottom: 16px;
}

.meta-item {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.download-row {
  display: flex;
  gap: 10px;
}

/* ===== ERROR CARD ===== */
.error-card {
  text-align: center;
  border: 1.5px solid rgba(252, 129, 129, 0.2);
}

.error-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--neu-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--error);
}

.error-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.error-msg {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ===== HOW IT WORKS ===== */
.how-section {
  margin-top: 12px;
  animation: fadeUp 0.6s ease 0.3s both;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-left: 4px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.step-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--neu-shadow-sm);
  padding: 20px 14px;
  text-align: center;
}

.step-num {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  line-height: 1;
}

.step-text {
  font-size: 0.775rem;
  color: var(--text-secondary);
  font-weight: 600;
  line-height: 1.45;
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  margin-top: 36px;
  animation: fadeUp 0.6s ease 0.4s both;
}

.footer p {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.footer-note {
  margin-top: 4px;
  font-size: 0.72rem !important;
  opacity: 0.7;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.slide-in {
  animation: slideIn 0.3s ease both;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 400px) {
  .app-wrapper { padding: 20px 16px 40px; }
  .steps-grid { grid-template-columns: 1fr; }
  .input-row { flex-direction: column; }
  .primary-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
