:root {
  --bg-color: #050505;
  --bg-gradient: radial-gradient(circle at 50% -20%, #1a1a2e 0%, #050505 100%);
  --panel-bg: rgba(255, 255, 255, 0.02);
  --panel-border: rgba(255, 255, 255, 0.06);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #facc15; /* Premium Gold */
  --primary-hover: #eab308;
  --primary-glow: rgba(250, 204, 21, 0.4);
  --secondary: #1e293b;
  --success: #22c55e;
  --success-glow: rgba(34, 197, 94, 0.3);
  --danger: #ef4444;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Background Glows */
.bg-glow {
  position: absolute;
  top: -200px;
  left: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  filter: blur(100px);
  z-index: -1;
  opacity: 0.5;
  animation: floatGlow 10s ease-in-out infinite alternate;
}
.bg-glow.secondary {
  top: auto;
  bottom: -200px;
  left: auto;
  right: -200px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, transparent 70%);
  animation-delay: -5s;
}

@keyframes floatGlow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Topbar */
.topbar {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4vw;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand-logo-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.9);
  padding: 4px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 0 12px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  transition: var(--transition);
}
.brand-logo-wrapper:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 255, 255, 0.2);
}
.brand-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.brand-text h1 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 20px;
  margin: 0 0 2px;
  background: linear-gradient(90deg, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-text p {
  font-size: 12px;
  color: var(--primary);
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}
.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  color: var(--success);
}
.dot-pulse {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Glass Panels */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
}

.container {
  width: min(1300px, 92vw);
  margin: 40px auto 60px;
}

/* Hero */
.hero {
  padding: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent);
  pointer-events: none;
}
.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--primary);
  font-weight: 600;
}
.hero h2 {
  font-family: var(--font-heading);
  font-size: 32px;
  line-height: 1.3;
  margin: 12px 0;
  font-weight: 700;
}
.hero p {
  color: var(--text-muted);
  font-size: 15px;
  margin: 0;
  max-width: 500px;
}
.hero-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 30px;
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.05);
}
.badge-icon {
  font-size: 24px;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(360px, 1fr);
  gap: 30px;
}
.workspace, .preview-panel {
  display: grid;
  gap: 24px;
  align-content: start;
}

/* Common Card Styling */
.upload-card, .overlay-card, .settings-card, .action-card, .preview-card, .info-card {
  padding: 30px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.section-header.mb-sm {
  margin-bottom: 16px;
}
.title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.title-wrap h3 {
  font-family: var(--font-heading);
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.step-badge {
  font-size: 12px;
  font-weight: 800;
  background: rgba(255,255,255,0.1);
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
}
.step-badge.highlight {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  animation: pulseText 2s infinite;
}
@keyframes pulseText {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.count-badge {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(0,0,0,0.2);
  padding: 6px 12px;
  border-radius: 99px;
}
.count-badge.outline {
  border: 1px solid rgba(255,255,255,0.1);
}

/* Dropzones */
.interactive {
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
  background: rgba(0,0,0,0.2);
}
.interactive:hover, .interactive.drag {
  border-color: var(--primary);
  background: rgba(250, 204, 21, 0.03);
}

.dropzone {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
.drop-icon-wrapper {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  display: grid;
  place-items: center;
  color: var(--primary);
  margin-bottom: 8px;
  transition: var(--transition);
}
.interactive:hover .drop-icon-wrapper {
  transform: scale(1.1);
  background: var(--primary);
  color: #000;
  box-shadow: 0 0 20px var(--primary-glow);
}
.dropzone strong {
  font-size: 18px;
  font-weight: 600;
}
.dropzone span {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
}
.overlay-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px;
  margin-top: 10px;
  max-height: 180px;
  overflow-y: auto;
}
.overlay-item {
  background: rgba(0,0,0,0.3);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.overlay-item:hover {
  border-color: rgba(250, 204, 21, 0.5);
  background: rgba(250, 204, 21, 0.05);
}
.overlay-item.selected {
  border-color: var(--primary);
  background: rgba(250, 204, 21, 0.1);
  box-shadow: 0 0 15px rgba(250, 204, 21, 0.2);
}
.overlay-item img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}
.overlay-item span {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  word-break: break-all;
}
.loading-overlays {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
  grid-column: 1 / -1;
}

/* Buttons */
.btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.outline-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text-main);
}
.outline-btn:hover {
  background: rgba(255,255,255,0.1);
}
.secondary-btn {
  background: rgba(255,255,255,0.1);
  color: var(--text-main);
}
.secondary-btn:hover {
  background: rgba(255,255,255,0.15);
}
.primary-btn {
  background: var(--primary);
  color: #000;
}
.primary-btn:hover {
  background: var(--primary-hover);
}
.glow-btn:not(:disabled):hover {
  box-shadow: 0 0 25px var(--primary-glow);
  transform: translateY(-2px);
}
.success-btn {
  background: var(--success);
  color: #fff;
}
.success-btn:not(:disabled):hover {
  box-shadow: 0 0 25px var(--success-glow);
  transform: translateY(-2px);
}

/* Thumbs */
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.1);
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}
.thumb:hover img {
  transform: scale(1.1);
}
.thumb .x {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 0;
  background: rgba(0,0,0,0.7);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: var(--transition);
}
.thumb:hover .x {
  opacity: 1;
}
.thumb .x:hover {
  background: var(--danger);
}
.empty-state {
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: rgba(0,0,0,0.1);
}

/* Overlay Drop */
.overlay-drop {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
}
.overlay-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.3);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.1);
}
.overlay-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.overlay-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.overlay-copy strong {
  font-size: 16px;
}
.overlay-copy span {
  font-size: 12px;
  color: var(--text-muted);
}

/* Settings */
.control-group {
  margin-bottom: 24px;
}
.control-group:last-child {
  margin-bottom: 0;
}
.control-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.label-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Ratio Grid */
.ratio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 10px;
}
.ratio-btn {
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 12px 0;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-body);
  transition: var(--transition);
}
.ratio-btn:hover {
  border-color: rgba(255,255,255,0.3);
  color: var(--text-main);
}
.ratio-btn.active {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
  box-shadow: 0 4px 15px var(--primary-glow);
}

.custom-ratio {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.custom-ratio input, .modern-input {
  width: 100%;
  height: 48px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}
.custom-ratio input:focus, .modern-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.2);
}
.times {
  color: var(--text-muted);
}
.hidden {
  display: none !important;
}

/* Select */
.custom-select-wrapper select {
  appearance: none;
  cursor: pointer;
}
.custom-select-wrapper {
  position: relative;
}
.custom-select-wrapper::after {
  content: '▼';
  font-size: 10px;
  color: var(--text-muted);
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
select option {
  background: #111827;
  color: #fff;
}

/* Range Inputs */
.range-group .range-val {
  color: var(--primary);
  font-family: monospace;
  font-size: 14px;
}
.modern-range {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  outline: none;
}
.modern-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 10px var(--primary-glow);
  transition: transform 0.1s;
}
.modern-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Action Card */
.neon-border {
  position: relative;
}
.neon-border::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px; bottom: -1px;
  background: linear-gradient(45deg, transparent, var(--primary), transparent);
  z-index: -1;
  border-radius: inherit;
  opacity: 0.3;
}
.status-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.status-info strong {
  font-size: 16px;
}
.status-info span {
  font-size: 12px;
  color: var(--text-muted);
}
.gradient-text {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(90deg, var(--primary), #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.progress-bar-wrap {
  margin: 24px 0;
}
.progress-bar-track {
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
  transition: width 0.3s ease;
}
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Preview */
.preview-stage {
  width: 100%;
  background: #000;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.8);
  border: 1px solid rgba(255,255,255,0.05);
}
.preview-stage.ratio-16-9 { aspect-ratio: 16/9; }
.preview-stage.ratio-9-16 { aspect-ratio: 9/16; }
.preview-stage.ratio-4-5 { aspect-ratio: 4/5; }
.preview-stage.ratio-5-4 { aspect-ratio: 5/4; }
.preview-stage.ratio-2-3 { aspect-ratio: 2/3; }
.preview-stage.ratio-3-2 { aspect-ratio: 3/2; }
.preview-stage.ratio-1-1 { aspect-ratio: 1/1; }
.preview-stage.ratio-3-4 { aspect-ratio: 3/4; }
.preview-stage.ratio-4-3 { aspect-ratio: 4/3; }

.preview-stage img {
  position: absolute;
  max-width: 100%;
  max-height: 100%;
}
.preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
}
.pulse-ring {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  animation: ripple 2s infinite linear;
}
@keyframes ripple {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

.preview-specs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}
.spec-item {
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.spec-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
}
.spec-value {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Info Card */
.info-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
}
.info-icon {
  width: 32px;
  height: 32px;
  background: rgba(250, 204, 21, 0.1);
  color: var(--primary);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.info-text strong {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
}
.info-text p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

/* Footer */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--panel-border);
  margin-top: 40px;
}
.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.footer-logo-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #ffffff;
  padding: 4px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: var(--transition);
  overflow: hidden;
  opacity: 0.9;
}
.footer-logo-wrapper:hover {
  opacity: 1;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
}
.footer-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.footer p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* Results & Single Photo Downloads */
.results-section {
  animation: fadeIn 0.4s ease;
}
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}
.result-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
}
.result-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}
.result-thumb {
  width: 100%;
  height: 130px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.result-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.result-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: ltr;
  text-align: right;
}
.result-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  font-family: var(--font-body);
}
.result-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Responsive */
@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .preview-panel { order: -1; }
  .ratio-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 640px) {
  .hero { padding: 30px 20px; flex-direction: column; text-align: center; gap: 20px; }
  .grid-2 { grid-template-columns: 1fr; }
  .ratio-grid { grid-template-columns: repeat(3, 1fr); }
  .actions { grid-template-columns: 1fr; }
  .overlay-drop { flex-direction: column; text-align: center; }
  .upload-card, .overlay-card, .settings-card, .action-card, .preview-card { padding: 20px; }
  .header-actions .status-pill { display: none; }
}
