/* ==========================================================================
   Custom Apparel & Embroidery Studio - Core Design System & Tokens
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Abril+Fatface&family=Alex+Brush&family=Alfa+Slab+One&family=Anton&family=Barlow+Condensed:wght@600;700;800;900&family=Bebas+Neue&family=Bodoni+Moda:ital,opsz,wght@0,6..96,600;0,6..96,800;1,6..96,400&family=Caveat:wght@600;700&family=Cinzel:wght@600;700;800;900&family=Cormorant+Garamond:ital,wght@0,600;0,700;1,400&family=DM+Sans:wght@400;500;700;800&family=Great+Vibes&family=Inter:wght@400;600;700;800;900&family=Italiana&family=JetBrains+Mono:wght@400;500;700;800&family=Montserrat:ital,wght@0,400;0,600;0,700;0,800;0,900;1,700&family=Oswald:wght@500;600;700&family=Outfit:wght@300;400;500;600;700;800;900&family=Pacifico&family=Permanent+Marker&family=Playfair+Display:ital,wght@0,600;0,700;0,800;1,400;1,600&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Prata&family=Righteous&family=Rubik+Mono+One&family=Space+Grotesk:wght@400;600;700&family=Syne:wght@600;700;800&family=Teko:wght@600;700&family=Unbounded:wght@600;700;800;900&display=swap');

:root {
  /* Color Palette - Luxury Studio Dark */
  --bg-app: #0d0f14;
  --bg-surface: #141820;
  --bg-surface-elevated: #1a202c;
  --bg-surface-card: #202736;
  --bg-surface-hover: #2a3344;
  --bg-canvas-stage: radial-gradient(circle at center, #232a38 0%, #12161f 70%, #0a0c10 100%);
  --bg-canvas-light: radial-gradient(circle at center, #f0f3f8 0%, #dbe2ee 70%, #c4cfdf 100%);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-active: rgba(99, 102, 241, 0.6);
  --border-gold: rgba(245, 158, 11, 0.5);

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

  --accent-primary: #6366f1; /* Indigo */
  --accent-primary-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.35);
  
  --accent-embroidery: #f59e0b; /* Golden thread */
  --accent-embroidery-glow: rgba(245, 158, 11, 0.3);

  --accent-print: #06b6d4; /* Cyan print */
  --accent-foil: #e2e8f0;

  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;

  /* Sizing & Radius */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 0 20px rgba(245, 158, 11, 0.25);
  --shadow-indigo: 0 0 20px rgba(99, 102, 241, 0.3);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* 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-bounce: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light Mode Overrides when toggled */
body.light-theme {
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --bg-surface-card: #e2e8f0;
  --bg-surface-hover: #cbd5e1;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-medium: rgba(0, 0, 0, 0.16);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* App Container Layout */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

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

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

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #f59e0b 100%);
  border-radius: var(--radius-sm);
  color: white;
  box-shadow: var(--shadow-indigo);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-embroidery);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.header-center-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.garment-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.header-actions .btn {
  padding: 4px 8px;
  font-size: 11px;
}

/* Studio Main Workspace Layout */
.studio-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 310px 1fr 340px;
  height: calc(100vh - 56px);
  overflow: hidden;
  position: relative;
}

/* Sidebar Panels (Left & Right) */
.panel-left, .panel-right {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  z-index: 20;
}

.panel-left {
  border-right: 1px solid var(--border-subtle);
}

.panel-right {
  border-left: 1px solid var(--border-subtle);
}

.panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Custom Scrollbar */
.panel-content::-webkit-scrollbar,
.custom-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.panel-content::-webkit-scrollbar-track,
.custom-scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
.panel-content::-webkit-scrollbar-thumb,
.custom-scroll::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-full);
}

/* Section Cards inside Panel */
.section-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-label .badge-mini {
  font-size: 10px;
  color: var(--accent-primary);
  font-weight: 600;
  text-transform: none;
}

/* Garment Grid / Cards */
.garment-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.garment-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  position: relative;
}

.garment-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
  transform: translateY(-2px);
}

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

.garment-card .icon-preview {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.garment-card .icon-preview svg {
  width: 100%;
  height: 100%;
  stroke: var(--text-secondary);
  fill: none;
  transition: stroke var(--transition-fast);
}

.garment-card.active .icon-preview svg {
  stroke: var(--accent-primary);
}

.garment-card .garment-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

.garment-card .garment-sub {
  font-size: 9px;
  color: var(--text-muted);
}

/* Placement Zone Buttons */
.view-zone-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.zone-btn {
  flex: 1 1 calc(50% - 4px);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.zone-btn.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.zone-btn .zone-icon {
  font-size: 14px;
}

/* Color Swatches Grid */
.color-swatch-list {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-subtle);
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.color-swatch:hover {
  transform: scale(1.15);
  z-index: 2;
  border-color: white;
}

.color-swatch.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-glow);
  transform: scale(1.1);
}

.color-swatch.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Custom Color Picker Input */
.custom-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.color-picker-wrapper {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-medium);
}

.color-picker-wrapper input[type="color"] {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 52px;
  height: 52px;
  cursor: pointer;
  border: none;
}

.hex-input-box {
  flex: 1;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Buttons System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
}

.btn-embroidery {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  font-weight: 700;
  box-shadow: var(--shadow-gold);
}
.btn-embroidery:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  transform: translateY(-1px);
}

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

.btn-outline {
  background: transparent;
  border-color: var(--border-medium);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-secondary);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}

.btn-icon-only {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-window {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-surface-elevated);
}
