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

:root {
  /* Premium Light Theme */
  --bg-app: #FAFAFC;
  --bg-card: #FFFFFF;
  --bg-input: #F3F4F6;
  --bg-input-focus: #FFFFFF;
  
  /* Text */
  --text-heading: #09090B;
  --text-body: #1F2937;
  --text-muted: #6B7280;
  
  /* Accents */
  --accent-primary: #18181B;
  --accent-gradient: linear-gradient(135deg, #FF6B6B, #845EC2, #00C9A7);
  
  /* Shadows & Borders */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 30px 60px -12px rgba(0, 0, 0, 0.08), 0 18px 36px -18px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 40px 80px -12px rgba(0, 0, 0, 0.12), 0 20px 40px -16px rgba(0, 0, 0, 0.06);
  --border-light: rgba(0, 0, 0, 0.06);
}

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

body {
  min-height: 100vh;
  color: var(--text-body);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  overflow-x: hidden;
  line-height: 1.6;
}

/* Stunning Mesh Gradient Background */
body::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 700px;
  background-image: 
    radial-gradient(at 20% 0%, rgba(255, 107, 107, 0.15) 0px, transparent 50%),
    radial-gradient(at 80% 0%, rgba(132, 94, 194, 0.15) 0px, transparent 50%),
    radial-gradient(at 50% 20%, rgba(0, 201, 167, 0.1) 0px, transparent 50%);
  filter: blur(80px);
  z-index: -1;
  pointer-events: none;
  animation: meshFlow 20s ease-in-out infinite alternate;
}

@keyframes meshFlow {
  0% { transform: scale(1) translateY(0); }
  100% { transform: scale(1.1) translateY(-30px); }
}

.shell {
  position: relative;
  width: min(1200px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 80px 0;
  z-index: 1;
}

/* --- Typography & Hero --- */

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 56px;
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  display: inline-block;
  margin-bottom: 16px;
  color: #845EC2;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

h1 {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(48px, 6vw, 76px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--text-heading);
  margin-bottom: 20px;
}

.subtitle {
  max-width: 640px;
  color: var(--text-muted);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.7;
}

.badge {
  padding: 8px 16px;
  border-radius: 99px;
  background: #FFFFFF;
  color: var(--text-heading);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-light);
}
.badge::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10B981;
}

/* --- Layout --- */

.grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(440px, 1.3fr);
  gap: 40px;
  align-items: stretch;
}

/* --- Premium Cards --- */

.card {
  background: var(--bg-card);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(0, 0, 0, 0.03);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  animation: fadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
  overflow: hidden;
}

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

.form-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 24px;
  padding: 40px;
}

.preview-card {
  display: flex;
  flex-direction: column;
  padding: 40px;
  min-height: 720px;
}

.card-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-head h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.card-head p {
  color: var(--text-muted);
  font-size: 15px;
}

/* --- Forms & Inputs --- */

.field {
  display: grid;
  gap: 10px;
}

.span-2 {
  grid-column: span 2;
}

.field span {
  color: var(--text-heading);
  font-size: 14px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 2px solid transparent;
  border-radius: 16px;
  background: var(--bg-input);
  color: var(--text-body);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

input,
select {
  height: 56px;
  padding: 0 18px;
}

textarea {
  min-height: 180px;
  padding: 18px;
  resize: vertical;
  line-height: 1.6;
}

input:hover,
select:hover,
textarea:hover {
  background: #E5E7EB;
}

input:focus,
select:focus,
textarea:focus {
  background: var(--bg-input-focus);
  border-color: #845EC2;
  box-shadow: 0 0 0 4px rgba(132, 94, 194, 0.15), var(--shadow-sm);
}

input::placeholder,
textarea::placeholder {
  color: #9CA3AF;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10L12 15L17 10' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 48px;
  cursor: pointer;
}

.secret-row {
  display: grid;
  grid-template-columns: 1fr 56px;
  gap: 12px;
}

.icon-button {
  border: none;
  border-radius: 16px;
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.2s;
}

.icon-button:hover {
  background: #E5E7EB;
  color: var(--text-heading);
}

/* --- Info Tips & Checkbox --- */

.tips {
  padding: 16px 20px;
  border-radius: 16px;
  background: #F8FAFC;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  gap: 12px;
  border: 1px solid var(--border-light);
}

.tips strong {
  font-weight: 600;
  color: var(--text-heading);
}

.remember-key {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}

.remember-key input[type="checkbox"] {
  appearance: none;
  width: 24px;
  height: 24px;
  border: 2px solid #D1D5DB;
  border-radius: 8px;
  background: #FFFFFF;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.remember-key input[type="checkbox"]:hover {
  border-color: #845EC2;
}

.remember-key input[type="checkbox"]:checked {
  background: var(--accent-gradient);
  border-color: transparent;
}

.remember-key input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 5px; height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg);
}

/* --- Buttons --- */

.actions {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

button {
  border: none;
  border-radius: 16px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.primary {
  flex: 2;
  height: 60px;
  background: var(--accent-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.5);
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.02em;
}

.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.6);
  background: #27272A;
}

.primary:active {
  transform: translateY(1px);
}

.secondary {
  flex: 1;
  height: 60px;
  background: var(--bg-input);
  color: var(--text-body);
}

.secondary:hover {
  background: #E5E7EB;
  transform: translateY(-2px);
}

.secondary.danger {
  color: #DC2626;
  background: #FEF2F2;
}

.secondary.danger:hover {
  background: #FEE2E2;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* --- Download Link --- */

.download {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 20px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  background: #F0FDF4;
  color: #16A34A;
  transition: all 0.2s;
}

.download:not(.disabled):hover {
  background: #DCFCE7;
  transform: translateY(-1px);
}

.download.disabled {
  opacity: 0.4;
  pointer-events: none;
  background: var(--bg-input);
  color: var(--text-muted);
}

/* --- Preview Area --- */

.preview {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
  border-radius: 20px;
  background: #F9FAFB;
  border: 1px dashed #E5E7EB;
  overflow: hidden;
  transition: all 0.3s;
}

.preview:hover {
  border-color: #D1D5DB;
}

/* Elegant Empty State */
.empty {
  text-align: center;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
  color: #D1D5DB;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.empty h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--text-heading);
  letter-spacing: -0.02em;
}

.empty p {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 280px;
  line-height: 1.6;
}

#previewImage {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.5s ease;
  background: white;
}

#previewImage:not([hidden]) {
  opacity: 1;
}

/* Premium Loading Shimmer */
.preview.loading {
  border-style: solid;
  border-color: transparent;
  background: linear-gradient(90deg, #F9FAFB 25%, #F3F4F6 50%, #F9FAFB 75%);
  background-size: 200% 100%;
  animation: shimmerLight 2s infinite linear;
}

.preview.loading .empty {
  opacity: 0.3;
}

@keyframes shimmerLight {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Result Info --- */

.info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.info div {
  padding: 16px 20px;
  background: var(--bg-input);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.info strong {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-heading);
}

/* --- Toast Notification --- */

.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  padding: 16px 24px;
  background: var(--text-heading);
  border-radius: 16px;
  color: #FFFFFF;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast:not([hidden]) {
  transform: translateY(0);
  opacity: 1;
}

/* --- Responsive Design --- */

@media (max-width: 1024px) {
  .shell {
    padding: 60px 0;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .preview-card {
    min-height: 500px;
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 32px 0;
    width: calc(100vw - 32px);
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 40px;
  }

  h1 {
    font-size: 40px;
  }

  .form-card {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .preview-card {
    padding: 24px;
  }

  .span-2 {
    grid-column: span 1;
  }

  .actions {
    flex-direction: column;
  }
  
  .card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .info {
    grid-template-columns: 1fr;
  }
}
