/* Xelta-Effects Studio - Design System */
:root {
  --bg-primary: #07080c;
  --bg-secondary: #0d0f17;
  --bg-surface: #141724;
  --bg-surface-elevated: #1a1e2e;
  --bg-glass: rgba(20, 24, 38, 0.75);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  --border-focus: #8b5cf6;

  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

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

.bg-glow-1 {
  top: -100px;
  left: 15%;
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
}

.bg-glow-2 {
  top: 300px;
  right: 5%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
}

.bg-glow-3 {
  bottom: 10%;
  left: 30%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
}

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

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

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

.brand-badge {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.logo-symbol {
  color: var(--accent-cyan);
  font-size: 18px;
  animation: pulse-glow 3s infinite alternate;
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.5px;
  color: #fff;
}

.logo-sub {
  color: var(--accent-purple);
  font-weight: 600;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.nav-link:hover {
  color: #fff;
}

.user-meta-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.credit-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.credit-val {
  color: #38bdf8;
  font-family: var(--font-display);
  font-size: 14px;
}

.btn-topup-mini {
  background: var(--accent-purple);
  color: #fff;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-topup-mini:hover {
  transform: scale(1.15);
  background: #7c3aed;
}

.btn-profile-badge {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 30px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* Main Content */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px;
  position: relative;
  z-index: 1;
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 40px 0 30px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 30px;
  font-size: 12px;
  font-weight: 600;
  color: #c4b5fd;
  margin-bottom: 20px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: #a855f7;
  border-radius: 50%;
  box-shadow: 0 0 10px #a855f7;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(135deg, #a78bfa 0%, #38bdf8 50%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  max-width: 680px;
  margin: 0 auto 36px;
  color: var(--text-secondary);
  font-size: 16px;
}

/* Controls Bar */
.controls-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 960px;
  margin: 0 auto;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 580px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.6;
}

.search-input-wrapper input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 30px;
  padding: 14px 20px 14px 46px;
  color: #fff;
  font-size: 15px;
  transition: var(--transition-fast);
  outline: none;
}

.search-input-wrapper input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.cat-tab {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.cat-tab:hover {
  border-color: var(--border-hover);
  color: #fff;
}

.cat-tab.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(6, 182, 212, 0.25));
  border-color: var(--accent-purple);
  color: #fff;
  box-shadow: 0 2px 12px rgba(139, 92, 246, 0.25);
}

/* Presets Grid */
.presets-section {
  margin-top: 30px;
}

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

.presets-count-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.badge-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}

/* Preset Card */
.preset-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.preset-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan));
  opacity: 0;
  transition: var(--transition-fast);
}

.preset-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.preset-card:hover::before {
  opacity: 1;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-cat {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-cyan);
}

.card-slots-pill {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--text-muted);
}

.card-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 18px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 12px;
}

.card-cost {
  font-size: 12px;
  font-weight: 600;
  color: #c4b5fd;
}

.card-arrow {
  color: var(--accent-purple);
  font-size: 16px;
  transition: var(--transition-fast);
}

.preset-card:hover .card-arrow {
  transform: translateX(4px);
}

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

.studio-modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 1060px;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  z-index: 10;
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Studio Layout */
.studio-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: 100%;
}

.studio-sidebar {
  padding: 32px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

.preset-meta-header {
  margin-bottom: 24px;
}

.meta-tag-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.category-badge {
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.slot-badge {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
}

.studio-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
}

.studio-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.config-group {
  margin-bottom: 20px;
}

.config-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.ratio-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
}

.btn-ratio {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-ratio:hover {
  border-color: var(--border-hover);
  color: #fff;
}

.btn-ratio.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--accent-purple);
  color: #fff;
}

.custom-prompt-input {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: var(--transition-fast);
}

.custom-prompt-input:focus {
  border-color: var(--accent-purple);
}

.studio-action-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 20px;
}

.cost-breakdown {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-bottom: 12px;
}

.cost-label {
  color: var(--text-muted);
}

.cost-value {
  color: #38bdf8;
  font-weight: 700;
}

.btn-generate-main {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-purple), #7c3aed);
  border: none;
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
  transition: var(--transition-smooth);
}

.btn-generate-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
}

.btn-generate-main:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Studio Main Panel */
.studio-main-panel {
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
}

.slots-header {
  margin-bottom: 24px;
}

.slots-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.slots-subtext {
  font-size: 13px;
  color: var(--text-secondary);
}

.dynamic-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

/* Slot Card & Dropzone */
.slot-card {
  background: var(--bg-surface);
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
  min-height: 220px;
  justify-content: center;
}

.slot-card:hover {
  border-color: var(--accent-purple);
  background: var(--bg-surface-elevated);
}

.slot-card.has-image {
  border-style: solid;
  border-color: var(--accent-emerald);
}

.slot-preview-img {
  max-width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.slot-badge-tag {
  background: rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.slot-label {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.slot-why {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.slot-file-input {
  display: none;
}

/* Progress Hero */
.progress-hero {
  text-align: center;
  padding: 40px 20px;
}

.spinner-large {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(139, 92, 246, 0.2);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 24px;
}

.progress-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.progress-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

.progress-bar-track {
  width: 100%;
  max-width: 440px;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 10px;
  overflow: hidden;
  margin: 0 auto 12px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan));
  border-radius: 10px;
  transition: width 0.4s ease;
}

.progress-percentage-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Video Player State */
.result-player-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.player-wrapper {
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-subtle);
  background: #000;
}

.player-wrapper video {
  width: 100%;
  height: auto;
  display: block;
}

.result-actions-bar {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-hover);
}

/* History Drawer */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
}

.drawer-card {
  width: 420px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  height: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

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

.drawer-body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.history-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.history-item-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-surface-elevated);
}

.history-thumb {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #000;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-hover);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: slide-in 0.25s ease;
}

.toast.success { border-color: var(--accent-emerald); }
.toast.error { border-color: var(--accent-pink); }

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

@keyframes pulse-glow {
  from { filter: drop-shadow(0 0 2px var(--accent-cyan)); }
  to { filter: drop-shadow(0 0 8px var(--accent-purple)); }
}

@keyframes slide-in {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 900px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }
  .hero-title {
    font-size: 38px;
  }
}
