/* ==========================================================================
   Pixar-Style 3D Character Studio Stylesheet - PicDriver
   Advanced 3D Shading, Dynamic Light Orb, Face Mesh Warping & Comparison Wipe
   ========================================================================== */

:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --accent-cyan: #06b6d4;
  --accent-gold: #f59e0b;
  --accent-rose: #f43f5e;
  --surface-color: #0f172a;
  --card-bg: rgba(15, 23, 42, 0.75);
  --card-hover: rgba(30, 41, 59, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

.pixar-workspace {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

.tool-hero {
  text-align: center;
  padding: 2.5rem 1rem 1.75rem;
  max-width: 800px;
  margin: 0 auto;
}

.tool-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #fff 30%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.75rem;
}

.tool-hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Studio Grid */
.pixar-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr);
  gap: 1.75rem;
  align-items: start;
}

/* Stage Column */
.pixar-stage-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.pixar-viewport-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 36px -8px rgba(0, 0, 0, 0.5);
  position: relative;
}

.pixar-viewport-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid var(--border-color);
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pixar-status-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hud-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-badge.accent {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.3);
}

.hud-badge.gold {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.pixar-actions-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Canvas Viewport */
.pixar-canvas-container {
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: #0f1117 radial-gradient(circle at center, rgba(30, 34, 45, 0.6) 0%, rgba(10, 12, 16, 0.95) 100%);
  position: relative;
  overflow: hidden;
  user-select: none;
}

canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

#pixar-canvas {
  max-width: 100%;
  max-height: 580px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: default;
}

/* Interactive 3D Light Orb */
#light-orb {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #fef08a 40%, #eab308 100%);
  box-shadow: 0 0 25px 8px rgba(254, 240, 138, 0.75), 0 0 50px 18px rgba(234, 179, 8, 0.35);
  cursor: grab;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.85);
  transition: box-shadow 0.2s;
}

#light-orb:active {
  cursor: grabbing;
  box-shadow: 0 0 35px 12px rgba(254, 240, 138, 0.95), 0 0 70px 24px rgba(234, 179, 8, 0.5);
}

#light-orb svg {
  width: 22px;
  height: 22px;
  color: #78350f;
  pointer-events: none;
}

.light-orb-label {
  position: absolute;
  top: 50px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Before / After Split Wipe UI */
.compare-overlay-ctrls {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 8;
}

.compare-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  pointer-events: auto;
  margin: 0;
}

.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(0,0,0,0.8), 0 0 8px #6366f1;
  pointer-events: none;
  transform: translateX(-50%);
}

.compare-handle-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #6366f1;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.6);
  border: 2px solid #fff;
  white-space: nowrap;
  letter-spacing: 1px;
}

/* Controls Sidebar */
.tool-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.control-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.65rem;
}

.control-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Presets & Material Toggles */
.pixar-presets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  transition: all 0.2s ease;
  text-align: left;
}

.preset-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.preset-btn.active {
  background: rgba(99, 102, 241, 0.25);
  border-color: #6366f1;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.preset-btn-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 400;
}

.material-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.mat-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.5rem 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.mat-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.mat-btn.active {
  background: rgba(99, 102, 241, 0.22);
  border-color: #6366f1;
  color: #fff;
}

/* Form Groups & Sliders */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-value-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  color: #818cf8;
}

.slider-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  transition: background 0.2s;
}

.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #6366f1;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
  transition: transform 0.15s, background 0.15s;
}

.slider-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #818cf8;
}

/* Export Card */
.export-card {
  background: linear-gradient(145deg, rgba(30, 34, 45, 0.9), rgba(20, 23, 31, 0.95));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.2);
}

.btn-download-main {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.8rem 1.2rem;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-download-main:hover {
  background: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}

.export-sub-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.btn-download-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background 0.2s;
}

.btn-download-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Responsive Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

table th {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

table tr:last-child td {
  border-bottom: none;
}

/* Mobile & Tablet Breakpoint */
@media (max-width: 768px) {
  .pixar-grid {
    grid-template-columns: 1fr;
  }

  .pixar-canvas-container {
    min-height: 340px;
    padding: 0.75rem;
  }

  .pixar-presets-grid,
  .material-row,
  .export-sub-row {
    grid-template-columns: 1fr;
  }

  .pixar-viewport-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
