/* ===================================================================
   PixMorph Studio Pro - Core Design System & Tokens
   =================================================================== */

:root {
  /* Color Palette - Dark Luxe Studio */
  --bg-darkest: #090a0f;
  --bg-dark: #0f1219;
  --bg-surface: #171b26;
  --bg-surface-elevated: #1f2433;
  --bg-surface-glass: rgba(23, 27, 38, 0.85);
  --bg-input: #12151e;
  --bg-hover: #262c3e;
  --bg-active: #313950;

  /* Borders & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-light: rgba(255, 255, 255, 0.12);
  --border-focus: #6366f1;
  --border-radius-xs: 4px;
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --border-radius-xl: 24px;
  --border-radius-pill: 9999px;

  /* Brand Accents */
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --secondary: #06b6d4;
  --secondary-glow: rgba(6, 182, 212, 0.3);
  --accent-pink: #ec4899;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-purple: #a855f7;

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --grad-accent: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --grad-warm: linear-gradient(135deg, #f43f5e 0%, #fb923c 100%);
  --grad-magic: linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #06b6d4 100%);
  --grad-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);

  /* Text & Inks */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;
  --text-inverse: #090a0f;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Outfit', 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.65);
  --shadow-glow: 0 0 24px var(--primary-glow);

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);

  /* Canvas Checkerboard */
  --checker-light: #202636;
  --checker-dark: #161a25;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-darkest);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Layout App Shell */
#app {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Top App Header */
.app-header {
  height: 56px;
  min-height: 56px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
  user-select: none;
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.brand-logo:hover {
  transform: translateY(-1px);
}

.brand-logo:hover .logo-icon {
  box-shadow: 0 0 22px rgba(16, 174, 177, 0.45), 0 2px 10px rgba(0, 0, 0, 0.5);
  transform: scale(1.06);
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1px;
  box-shadow: 0 0 16px rgba(16, 174, 177, 0.35), 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: all var(--transition-fast);
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-icon img,
.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.15;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  white-space: nowrap;
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 70%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tagline {
  font-family: var(--font-sans);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #10aeb1;
  white-space: nowrap;
  opacity: 0.95;
  margin-top: 1px;
}

.brand-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary-light);
  padding: 2px 6px;
  border-radius: var(--border-radius-xs);
  border: 1px solid rgba(99, 102, 241, 0.4);
}

/* Navigation Tabs (Studio / Batch / AI Hub / Templates) */
.nav-tabs {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  padding: 3px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-subtle);
  gap: 2px;
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab-btn.active {
  color: #ffffff;
  background: var(--bg-surface-elevated);
  box-shadow: var(--shadow-sm);
}

.nav-tab-btn.active svg {
  color: var(--primary-light);
}

/* Header Action Controls */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--border-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-icon-only {
  padding: 7px;
  width: 34px;
  height: 34px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}
.btn-ghost:active {
  background: rgba(255, 255, 255, 0.1);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-light);
}
.btn-secondary:hover {
  background: var(--bg-surface-elevated);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 10px var(--primary-glow);
}
.btn-primary:hover {
  background: var(--primary-light);
  box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-magic {
  background: var(--grad-magic);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(139, 92, 246, 0.4);
}
.btn-magic:hover {
  opacity: 0.95;
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.6);
}

/* Modals & Overlays */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 11, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(8px);
  transition: transform var(--transition-spring);
}

.modal-overlay.open .modal-container {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.success {
  border-left: 3px solid var(--accent-emerald);
}
.toast.info {
  border-left: 3px solid var(--secondary);
}
.toast.warn {
  border-left: 3px solid var(--accent-amber);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
