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

:root {
  /* Color system */
  --bg-deep: #0a0a0f;
  --bg-surface: #12121c;
  --bg-surface-elevated: #1e1e2d;
  --bg-surface-active: #2a2a3d;
  
  --primary: #7c5cfc;
  --primary-glow: rgba(124, 92, 252, 0.35);
  --primary-hover: #9175ff;
  
  --accent: #00d4aa;
  --accent-glow: rgba(0, 212, 170, 0.25);
  --accent-hover: #1bf5c8;

  --danger: #ff4d6a;
  --danger-hover: #ff6b83;
  --danger-glow: rgba(255, 77, 106, 0.25);
  
  --text-primary: #f5f5fa;
  --text-secondary: #9494b8;
  --text-muted: #626280;
  
  --border-color: #232335;
  --border-hover: #34344e;
  --border-focus: #5544aa;

  /* Dimensions & Spacing */
  --header-height: 64px;
  --sidebar-width: 80px;
  --properties-width: 300px;
  --timeline-height: 140px;
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  
  --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-surface-elevated);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Button & UI element styling */
button, select, input {
  font-family: inherit;
  font-size: 14px;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all var(--transition-fast);
  min-height: 44px; /* Touch friendly */
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #6340f7 100%);
  box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--primary-glow);
  background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
}
.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px var(--primary-glow);
}

/* Secondary Button */
.btn-secondary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-surface-active);
  border-color: var(--border-hover);
}

/* Accent Button */
.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #00b08d 100%);
  box-shadow: 0 4px 12px var(--accent-glow);
  color: var(--bg-deep);
}
.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--accent-glow);
  background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
}

/* Danger Button */
.btn-danger {
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(255, 77, 106, 0.3);
  color: var(--danger);
}
.btn-danger:hover {
  background: rgba(255, 77, 106, 0.1);
  border-color: var(--danger);
}

/* Icon-only Button */
.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  font-size: 20px;
}
.btn-icon:hover {
  background: var(--bg-surface-active);
  border-color: var(--border-hover);
}
.btn-icon.active {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* App Layout Grid */
.app-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
}

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

.app-logo {
  font-size: 28px;
  animation: float 4s ease-in-out infinite;
}

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

.app-title {
  font-weight: 800;
  font-size: 20px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.project-details {
  display: flex;
  align-items: center;
  gap: 16px;
}

.project-name-input {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  width: 160px;
  transition: all var(--transition-fast);
}
.project-name-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
  width: 220px;
}

.autosave-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-xl);
  font-weight: 500;
  background: rgba(148, 148, 184, 0.1);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}
.autosave-badge.saving {
  background: rgba(124, 92, 252, 0.15);
  color: var(--primary-hover);
}
.autosave-badge.saved {
  background: rgba(0, 212, 170, 0.15);
  color: var(--accent);
}

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

/* Main workspace container */
.app-workspace {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Left sidebar - Asset Categories & Tool list */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 8px;
  z-index: 5;
}

.sidebar-tab {
  width: 60px;
  height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-normal);
  position: relative;
}
.sidebar-tab:hover {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}
.sidebar-tab.active {
  color: var(--primary-hover);
  background: var(--bg-surface-elevated);
}
.sidebar-tab.active::after {
  content: '';
  position: absolute;
  left: 0;
  top: 15px;
  bottom: 15px;
  width: 4px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}
.sidebar-tab .icon {
  font-size: 22px;
  margin-bottom: 2px;
}
.sidebar-tab .label {
  font-size: 10px;
  font-weight: 500;
}

/* Left Drawer for Category content (sliding panel) */
.sidebar-drawer {
  position: absolute;
  left: var(--sidebar-width);
  top: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-surface-elevated);
  border-right: 1px solid var(--border-color);
  z-index: 4;
  transform: translateX(-100%);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
}
.sidebar-drawer.open {
  transform: translateX(0);
}
.drawer-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drawer-title {
  font-size: 16px;
  font-weight: 700;
}
.drawer-close {
  font-size: 18px;
  color: var(--text-secondary);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.drawer-close:hover {
  background: var(--bg-surface-active);
  color: var(--text-primary);
}
.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

/* Asset Item card representation */
.asset-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-fast);
}
.asset-card:hover:not(.locked) {
  border-color: var(--primary);
  background: var(--bg-surface-active);
}
.asset-card.locked {
  opacity: 0.6;
  cursor: not-allowed;
}
.asset-card.locked::before {
  content: '🔒 Coming Soon';
  position: absolute;
  right: -24px;
  top: 10px;
  background: var(--danger);
  color: white;
  font-size: 8px;
  font-weight: 700;
  padding: 2px 24px;
  transform: rotate(45deg);
}
.asset-thumbnail {
  width: 44px;
  height: 44px;
  background: var(--bg-deep);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 1px solid var(--border-color);
}
.asset-info {
  flex: 1;
}
.asset-name {
  font-weight: 600;
  font-size: 13px;
}
.asset-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Central Editor Frame */
.editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  position: relative;
}

/* Canvas Area */
.canvas-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px;
}

canvas {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 4/3;
  touch-action: none; /* Crucial for touch dragging */
  transition: box-shadow var(--transition-normal);
}
canvas.preview-mode {
  outline: 4px solid var(--accent);
  box-shadow: 0 0 30px var(--accent-glow);
}

/* Canvas overlay notifications */
.canvas-overlay-message {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 212, 170, 0.9);
  color: var(--bg-deep);
  font-weight: 700;
  padding: 6px 16px;
  border-radius: var(--radius-xl);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  animation: pulse-glow 1.5s infinite alternate;
  z-index: 3;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 5px rgba(0, 212, 170, 0.5); }
  100% { box-shadow: 0 0 20px rgba(0, 212, 170, 0.9); }
}

/* Right properties panel */
.properties-panel {
  width: var(--properties-width);
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  z-index: 5;
  transition: transform var(--transition-normal);
}

.panel-section {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}
.panel-section:last-child {
  border: none;
}
.panel-section-title {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.property-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.property-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.property-control {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  width: 100%;
}
.property-control:focus {
  border-color: var(--primary);
}

.color-presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.color-preset-btn {
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition-fast);
}
.color-preset-btn.active {
  border-color: var(--text-primary);
  box-shadow: 0 0 8px rgba(255,255,255,0.3);
}

/* Joint properties list styling */
.joint-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}
.joint-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}
.joint-item:hover {
  background: var(--bg-surface-active);
}
.joint-item.active {
  background: rgba(124, 92, 252, 0.1);
  border-color: var(--primary);
  color: var(--primary-hover);
}
.joint-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
}
.joint-item.active .joint-color-dot {
  background-color: var(--primary);
}

/* Bottom Timeline */
.timeline-panel {
  height: var(--timeline-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 10px 20px;
  gap: 20px;
  z-index: 10;
  overflow: hidden;
}

.timeline-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 220px;
}

.timeline-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline-settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fps-container {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.fps-select {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
}

.onionskin-container {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}
.onionskin-container input {
  cursor: pointer;
  accent-color: var(--primary);
}

/* Frames List Container */
.frames-scroller {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  padding: 0 10px;
  border-left: 1px solid var(--border-color);
}

.frame-card {
  width: 90px;
  height: calc(100% - 10px);
  background: var(--bg-surface-elevated);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
  position: relative;
  transition: all var(--transition-fast);
}
.frame-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-surface-active);
}
.frame-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
  background: rgba(124, 92, 252, 0.05);
}

.frame-number {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.frame-card.active .frame-number {
  color: var(--primary-hover);
}

.frame-preview-mini {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.frame-mini-svg {
  width: 100%;
  height: 100%;
  max-height: 48px;
}

.frame-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 77, 106, 0.1);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.frame-card:hover .frame-delete-btn {
  opacity: 1;
}
.frame-delete-btn:hover {
  background: var(--danger);
  color: white;
}

/* Toast Notification Overlay */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-surface-elevated);
  border-left: 4px solid var(--primary);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  font-size: 14px;
  font-weight: 600;
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast.info {
  border-left-color: var(--primary);
}
.toast.success {
  border-left-color: var(--accent);
}
.toast.error {
  border-left-color: var(--danger);
}

/* Custom modal styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 15, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 440px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}
.modal-overlay.open .modal-card {
  transform: scale(1);
}
.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}
.modal-body {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 24px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Responsive Overrides */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 68px;
    --properties-width: 250px;
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  
  .app-workspace {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    height: 60px;
    flex-direction: row;
    justify-content: space-around;
    padding: 0 10px;
    border-right: none;
    border-top: 1px solid var(--border-color);
    order: 2; /* Move toolbar below canvas */
  }
  .sidebar-tab {
    width: auto;
    height: 100%;
    flex: 1;
    border-radius: 0;
  }
  .sidebar-tab.active::after {
    left: 15px;
    right: 15px;
    top: auto;
    bottom: 0;
    width: auto;
    height: 4px;
    border-radius: 4px 4px 0 0;
  }

  .sidebar-drawer {
    left: 0;
    bottom: 60px; /* Above bottom tabs */
    top: auto;
    width: 100%;
    height: 220px;
    transform: translateY(100%);
    border-right: none;
    border-top: 1px solid var(--border-color);
  }
  .sidebar-drawer.open {
    transform: translateY(0);
  }

  .properties-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 250px;
    border-left: none;
    border-top: 1px solid var(--border-color);
    transform: translateY(100%);
    z-index: 8;
  }
  .properties-panel.open-mobile {
    transform: translateY(0);
  }

  .timeline-panel {
    order: 3;
    height: auto;
    min-height: 120px;
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    gap: 10px;
  }
  
  .timeline-controls {
    flex-direction: row;
    justify-content: space-between;
    min-width: 100%;
  }

  .frames-scroller {
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding: 8px 0 0 0;
    height: 70px;
  }
  .frame-card {
    height: 100%;
  }
}

/* Floating Canvas Toolbar */
.canvas-toolbar {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(18, 18, 28, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.canvas-tool-btn {
  font-size: 13px;
  font-weight: 700;
  height: 36px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  background: transparent;
  transition: all var(--transition-fast);
}

.canvas-tool-btn:hover:not(:disabled) {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.canvas-tool-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.canvas-tool-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.canvas-tool-divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 4px;
}

/* Segmented Mode Toggle Control */
.mode-toggle {
  display: flex;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 3px;
  border-radius: var(--radius-md);
  margin-top: 4px;
}

.mode-toggle-btn {
  flex: 1;
  height: 36px;
  min-height: 36px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.mode-toggle-btn:hover {
  color: var(--text-primary);
}

.mode-toggle-btn.active {
  background: var(--bg-surface-active);
  color: var(--primary-hover);
  border: 1px solid var(--border-color);
}

/* Pose actions grid inside Right panel */
.pose-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.btn-sm {
  font-size: 12px;
  height: 36px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
}

/* Onion settings styling */
.onion-settings-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  background: var(--bg-surface-elevated);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.onion-settings-panel .property-group {
  margin-bottom: 0;
}

/* Empty drawer category style */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  gap: 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-color);
  height: 100%;
}

.empty-state-icon {
  font-size: 40px;
  opacity: 0.8;
  animation: float 5s ease-in-out infinite;
}

.empty-state-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.empty-state-desc {
  font-size: 12px;
  line-height: 1.5;
}

/* Collapsed timeline styling overrides */
.timeline-panel {
  transition: all var(--transition-normal);
}

.timeline-panel.collapsed {
  height: 52px;
  min-height: 52px;
  overflow: hidden;
  padding: 6px 20px;
}

.timeline-panel.collapsed .frames-scroller {
  display: none;
}

.timeline-panel.collapsed .timeline-actions-row {
  display: none;
}

.timeline-panel.collapsed .timeline-controls {
  flex-direction: row;
  min-width: 100%;
  align-items: center;
  justify-content: space-between;
}

.timeline-panel.collapsed #timeline-collapse-btn span {
  transform: rotate(180deg);
}

#timeline-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-height: 32px;
  border-radius: var(--radius-sm);
}

/* Ground Grid Overlay toggling opacity on canvas */
.canvas-wrapper canvas {
  transition: all var(--transition-normal);
}

/* Character Layers / List panel */
.character-list-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

.character-layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.character-layer-item:hover {
  background: var(--bg-surface-active);
  border-color: var(--border-hover);
}

.character-layer-item.active {
  background: rgba(124, 92, 252, 0.1);
  border-color: var(--primary);
}

.character-layer-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 8px;
}

.character-layer-item.active .character-layer-name {
  color: var(--primary-hover);
}

.character-layer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.character-layer-btn {
  width: 28px;
  height: 28px;
  min-height: 28px;
  border-radius: var(--radius-sm);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-secondary);
  background: transparent;
  transition: all var(--transition-fast);
}

.character-layer-btn:hover {
  background: var(--bg-surface-active);
  color: var(--text-primary);
}

.character-layer-btn.active {
  color: var(--primary-hover);
}

.character-layer-btn.locked-active {
  color: var(--danger);
}

/* Transform grid formatting */
.transform-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.transform-input {
  text-align: center;
  font-weight: 600;
}

/* Segmented mode override for 3 columns */
.mode-toggle {
  display: flex;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 3px;
  border-radius: var(--radius-md);
  margin-top: 4px;
}

.mode-toggle-btn {
  flex: 1;
  height: 36px;
  min-height: 36px;
  font-size: 12px;
  font-weight: 700;
}

/* Floating Selected Item Badge inside Toolbar */
.selected-item-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* Selected item right panel summary */
.selected-item-summary-card {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-surface-elevated);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  text-align: center;
}

.selected-item-title-text {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-hover);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Style controls grid customisation */
.style-controls-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.style-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.style-control-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.color-picker-input {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  width: 50px;
  height: 26px;
  padding: 0;
  border-radius: 4px;
  cursor: pointer;
  background: none;
}

.color-picker-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-input::-webkit-color-swatch {
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.style-control-row-full {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.style-control-row-full label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Layer Reordering actions columns */
.layer-ordering-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.layer-ordering-actions-grid .btn-secondary {
  padding: 4px 2px;
  font-size: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--radius-sm);
  min-height: 40px;
}

.layer-ordering-actions-grid .btn-secondary span {
  font-size: 12px;
}

/* Rig Mode Toggle styling */
.rig-mode-toggle {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
  display: flex;
}

.rig-mode-toggle .mode-toggle-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 6px 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  flex: 1;
}

.rig-mode-toggle .mode-toggle-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.rig-mode-toggle .mode-toggle-btn.active {
  background: var(--primary);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(124, 92, 252, 0.2);
}

.help-text {
  line-height: 1.4;
  margin-top: 5px;
  font-size: 10px;
  color: var(--text-muted);
}

/* Quick Poses Preset styling */
.pose-actions-grid .btn-secondary {
  font-size: 12px;
  padding: 8px;
  min-height: 38px;
}

.pose-actions-grid .btn-primary {
  font-size: 12px;
  padding: 8px;
  min-height: 38px;
}


/* ==========================================================
   TWEENING PHASE 1 — Timeline Enhancements
   ========================================================== */

/* Tween badge on frame cards */
.frame-card .tween-badge {
  position: absolute;
  top: 4px;
  right: 22px;
  font-size: 11px;
  line-height: 1;
  opacity: 0.9;
  pointer-events: none;
}

/* Duration label on frame cards */
.frame-card .duration-label {
  position: absolute;
  bottom: 4px;
  left: 6px;
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.2px;
  pointer-events: none;
  line-height: 1;
}

/* Tween progress bar — thin strip at bottom of card during playback */
.frame-card .tween-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: width 0.08s linear;
  pointer-events: none;
}

/* Playhead frame highlight during playback */
.frame-card.playhead {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.frame-card.playhead .frame-number {
  color: var(--accent);
}

/* Tween-enabled frame card subtle glow */
.frame-card.has-tween {
  border-color: rgba(124, 92, 252, 0.4);
}

/* ==========================================================
   TWEENING PHASE 1 — Timeline Divider
   ========================================================== */

.timeline-divider-v {
  width: 1px;
  height: 28px;
  background: var(--border-color);
  margin: 0 4px;
  flex-shrink: 0;
}

/* Compact playback control buttons */
.tl-ctrl-btn {
  padding: 6px 10px;
  font-size: 14px;
  min-height: 32px;
  gap: 4px;
}

.tl-ctrl-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* ==========================================================
   TWEENING PHASE 1 — Frame Settings Panel
   ========================================================== */

.frame-settings-panel {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  min-height: 0;
  overflow: hidden;
}

.frame-settings-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.frame-settings-section-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.frame-settings-icon {
  font-size: 12px;
  line-height: 1;
}

.frame-settings-note {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}

.frame-settings-help {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
  max-width: 200px;
}

/* Off / On toggle row */
.tween-toggle-row {
  display: flex;
  gap: 3px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.tween-toggle-btn {
  flex: 1;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  border: none;
  transition: all var(--transition-fast);
  min-height: 26px;
}

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

.tween-toggle-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 6px var(--primary-glow);
}

/* A Little / Smooth / Extra Smooth level row */
.tween-level-row {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
}

.tween-level-btn {
  flex: 1;
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
  min-height: 26px;
  white-space: nowrap;
}

.tween-level-btn:hover {
  border-color: var(--primary);
  color: var(--text-primary);
}

.tween-level-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 6px var(--primary-glow);
}

/* Duration preset row */
.duration-preset-row {
  display: flex;
  gap: 3px;
}

.duration-preset-btn {
  flex: 1;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
  min-height: 26px;
}

.duration-preset-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.duration-preset-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 800;
}

/* Advanced accordion section */
.frame-settings-advanced {
  border-left: 1px solid var(--border-color);
  padding-left: 12px;
}

.frame-settings-advanced-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-height: 0;
}

.frame-settings-advanced-btn:hover {
  color: var(--text-primary);
}

.advanced-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.advanced-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--text-muted);
}

.advanced-row label {
  min-width: 68px;
  font-weight: 600;
}

/* ==========================================================
   TWEENING PHASE 1 — Canvas Overlay Update
   ========================================================== */

/* Preview mode badge on canvas overlay — make it cleaner */
.canvas-overlay-message {
  background: linear-gradient(
    135deg,
    rgba(124, 92, 252, 0.92),
    rgba(0, 212, 170, 0.85)
  );
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.2px;
  backdrop-filter: blur(8px);
}

/* Loop button active state */
#btn-loop.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* ==========================================================
   EXPORT DIALOG MODAL STYLING
   ========================================================== */

.export-modal-card {
  width: 90%;
  max-width: 680px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.export-summary {
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  border-left: 4px solid var(--primary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.export-summary p {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin: 0;
}

.export-summary p strong {
  color: var(--text-primary);
}

.export-layout {
  display: flex;
  gap: 20px;
  margin-top: 4px;
}

.export-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-formats {
  border-right: 1px solid var(--border-color);
  padding-right: 20px;
}

.export-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.export-format-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-format-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
}

.export-format-btn .icon {
  font-size: 22px;
  line-height: 1;
}

.export-format-btn .details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.export-format-btn .details strong {
  font-size: 13px;
  color: var(--text-primary);
}

.export-format-btn .details span {
  font-size: 11px;
  color: var(--text-muted);
}

.export-format-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: rgba(124, 92, 252, 0.05);
}

.export-format-btn.active {
  border-color: var(--primary);
  background: rgba(124, 92, 252, 0.1);
  box-shadow: 0 0 12px rgba(124, 92, 252, 0.15);
}

.export-format-btn.disabled,
.export-format-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--bg-surface-elevated);
  border-color: var(--border-color);
}

.export-option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.option-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.export-preset-row {
  display: flex;
  gap: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.export-preset-row .preset-btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.export-preset-row .preset-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.export-preset-row .preset-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(124, 92, 252, 0.2);
}

.option-help {
  font-size: 10px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.3;
}

/* Warnings and Safegaurds */
.export-warning-box {
  background: rgba(255, 179, 0, 0.1);
  border: 1px solid rgba(255, 179, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 11px;
  color: #ffc107;
  line-height: 1.4;
}

/* Progress bar styling */
.export-progress-container {
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.progress-bar-wrapper {
  width: 100%;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.15s ease-out;
}

.progress-status-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  text-align: center;
}

/* Media adaptation for export layout on smaller viewports */
@media (max-width: 600px) {
  .export-layout {
    flex-direction: column;
  }
  .export-formats {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding-right: 0;
    padding-bottom: 16px;
  }
}

