:root {
  --bg-dark: #090d16;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(28, 36, 56, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(99, 102, 241, 0.4);
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --primary-hover: #4f46e5;
  --secondary: #ec4899;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-gold: #f59e0b;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

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

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

/* Ambient Background Glows */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.18), transparent 70%);
  top: -100px;
  left: 10%;
}

.glow-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.14), transparent 70%);
  bottom: -150px;
  right: 5%;
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  background: rgba(9, 13, 22, 0.8);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 28px;
}

.header-container {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  font-size: 28px;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.brand-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #ec4899, #8b5cf6);
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
}

.brand-tagline {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lang-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-md);
}

.lang-dropdown {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.lang-dropdown option {
  background: #1e293b;
  color: #fff;
}

/* Main Studio Layout */
.studio-layout {
  position: relative;
  z-index: 10;
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 28px;
  min-height: calc(100vh - 80px);
}

/* Sidebar Controls */
.studio-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.panel-header h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.step-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
  padding: 2px 8px;
  border-radius: 12px;
}

/* Forms */
.form-group {
  margin-bottom: 14px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group label .req {
  color: #f43f5e;
}

.form-group label .opt {
  font-size: 11px;
  color: #64748b;
  font-weight: 400;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  font-size: 16px;
  pointer-events: none;
}

input[type="text"],
textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.input-with-icon input {
  padding-left: 38px;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(0, 0, 0, 0.45);
}

textarea {
  resize: vertical;
  min-height: 54px;
  line-height: 1.4;
}

.form-row {
  display: flex;
  gap: 12px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* Themes Grid */
.themes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.theme-card {
  background: rgba(0, 0, 0, 0.25);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.theme-card.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 16px var(--primary-glow);
}

.theme-preview {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.theme1-thumb { background: linear-gradient(135deg, #fdba74, #fca5a5); }
.theme2-thumb { background: linear-gradient(135deg, #38bdf8, #818cf8); }
.theme3-thumb { background: linear-gradient(135deg, #fde047, #f472b6); }
.theme4-thumb { background: linear-gradient(135deg, #d4af37, #161f30); border: 1px solid #d4af37; }
.theme5-thumb { background: linear-gradient(135deg, #4f46e5, #db2777); }

.theme-info {
  display: flex;
  flex-direction: column;
}

.theme-name {
  font-size: 13px;
  font-weight: 600;
}

.theme-badge {
  font-size: 10px;
  color: #38bdf8;
  font-weight: 500;
}

.theme-badge.dark { color: #818cf8; }
.theme-badge.sweet { color: #f472b6; }
.theme-badge.gold { color: #fbbf24; }
.theme-badge.party { color: #ec4899; }

/* Media Upload Section */
.media-upload-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.upload-box label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.upload-area {
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.upload-thumbnail {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.logo-thumb {
  border-radius: 6px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.logo-placeholder-icon {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text-muted);
}

.upload-actions {
  display: flex;
  gap: 6px;
}

.btn-mini {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-mini:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-subtle {
  background: transparent;
  color: var(--text-muted);
}

/* Right Studio Preview */
.studio-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preview-title-group h3 {
  font-size: 18px;
  font-weight: 700;
}

.status-indicator {
  font-size: 12px;
  color: #10b981;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-indicator .dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Stage Frame Wrapper - 100% Crisp Native Canvas */
.stage-wrapper {
  background: #020617;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8), 0 20px 40px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  width: 100%;
}

.stage-frame {
  width: 100%;
  max-width: 1024px;
  aspect-ratio: 1024 / 520;
  position: relative;
  overflow: hidden;
  border-radius: 40px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 40px;
}

/* Export Toolbar */
.export-toolbar {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.export-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-badge {
  font-size: 12px;
  font-weight: 600;
  color: #38bdf8;
}

.resolution-text {
  font-size: 11px;
  color: var(--text-muted);
}

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

/* Buttons */
button {
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  border: none;
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px var(--primary-glow);
  transition: all 0.25s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
  background: linear-gradient(135deg, #4f46e5, #4338ca);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--border-subtle);
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.btn-whatsapp {
  background: #25d366;
  color: #fff;
  border: none;
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
  transition: all 0.25s ease;
}

.btn-whatsapp:hover {
  background: #20ba5a;
  transform: translateY(-2px);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.05);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: #111827;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 450px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  animation: modalPop 0.3s ease-out;
}

.modal-wide {
  max-width: 720px;
  text-align: left;
}

@keyframes modalPop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.modal-title-group h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-title-group p {
  font-size: 13px;
  color: var(--text-muted);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-body h4 {
  font-size: 14px;
  color: #38bdf8;
  margin: 16px 0 8px 0;
}

.code-box {
  background: #030712;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: monospace;
  font-size: 13px;
  margin-bottom: 12px;
}

.code-kw { color: #f43f5e; font-weight: bold; }
.code-url { color: #34d399; }

.json-code {
  background: #030712;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  overflow-x: auto;
  font-size: 12px;
  color: #e2e8f0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* Progress Spinner & Bar */
.loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 16px auto;
  animation: spin 1s linear infinite;
}

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

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin: 20px 0 8px 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #ec4899);
  transition: width 0.2s ease;
}

.progress-percent {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

/* Responsive */
@media (max-width: 1100px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }
}
