/* ==========================================================================
   Layout: Responsive 3-Column Grid, Mobile Wizard, Desktop Panels, Print Styles
   ========================================================================== */

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------------------------------------------------------
   Main Workspace Layout: 3-Column Desktop Grid
   --------------------------------------------------------- */
.workspace-grid {
  display: grid;
  grid-template-columns: 320px minmax(420px, 1fr) 380px;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  max-width: 1840px;
  margin: 0 auto;
  width: 100%;
  align-items: start;
}

/* Independent Scrolling for each Column */
.controls-sidebar,
.canvas-viewport,
.order-details-panel {
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  padding-right: 4px;
}

.order-details-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Responsive Breakpoints */
@media (max-width: 1400px) {
  .workspace-grid {
    grid-template-columns: 290px minmax(380px, 1fr) 340px;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
  }
}

@media (max-width: 1120px) {
  .workspace-grid {
    grid-template-columns: 280px 1fr;
  }

  .order-details-panel {
    grid-column: 1 / -1; /* Spans full width below on tablet */
    max-height: none;
    overflow-y: visible;
  }
}

@media (max-width: 768px) {
  .workspace-grid {
    grid-template-columns: 1fr;
    padding: var(--space-sm);
  }

  .controls-sidebar,
  .canvas-viewport,
  .order-details-panel {
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }

  .wizard-progress-bar {
    display: block;
  }

  .mobile-wizard-nav {
    display: flex;
  }
}

/* Mobile Wizard Steps Indicator */
.wizard-progress-bar {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.wizard-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.wizard-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-2xs);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  z-index: 1;
}

.wizard-step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 2px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-2xs);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.wizard-step-item.active .wizard-step-circle {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-glow-cyan);
}

.wizard-step-item.completed .wizard-step-circle {
  background: var(--accent-primary);
  border-color: transparent;
  color: #fff;
}

.wizard-step-item.active {
  color: var(--accent-primary);
}

/* Mobile Navigation Bar */
.mobile-wizard-nav {
  display: none;
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  padding: 12px 16px;
  border-top: 1px solid var(--border-card);
  z-index: 90;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.btn-jump-results {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-focus);
  color: var(--accent-primary);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 768px) {
  .btn-jump-results {
    display: inline-flex;
  }
}

/* ---------------------------------------------------------
   Center Viewport: Canvas & Summary
   --------------------------------------------------------- */
.canvas-viewport {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Footer info */
.app-footer {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
  line-height: var(--leading-normal);
}

/* ---------------------------------------------------------
   Print Media Styles (Blueprint Sheet Output)
   --------------------------------------------------------- */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .preset-bar,
  .controls-sidebar,
  .canvas-toolbar,
  .export-actions,
  .app-footer,
  .mobile-wizard-nav,
  .toast-notice {
    display: none !important;
  }

  .workspace-grid {
    display: block !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  .summary-banner {
    background: #f8fafc !important;
    border: 1px solid #000000 !important;
    color: #000000 !important;
  }

  .summary-highlight {
    color: #000000 !important;
    font-weight: 900 !important;
  }

  .blueprint-wrapper {
    background: #ffffff !important;
    border: 2px solid #000000 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  .svg-canvas-container {
    background: #ffffff !important;
  }

  .order-details-panel {
    max-height: none !important;
    overflow: visible !important;
  }

  .cut-list-card,
  .bom-card {
    background: #ffffff !important;
    border: 1px solid #000000 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-top: 20px;
  }

  .cut-table th,
  .bom-table th {
    background: #e2e8f0 !important;
    color: #000000 !important;
  }

  .cut-table td,
  .bom-table td {
    color: #000000 !important;
  }
}
