/**
 * AVA Precision 2D Visual Decking Configurator Stylesheet
 * Architectural CAD Visualizer & Luxury Engineering UI
 *
 * @package AVA_Innovation
 */

.ava-calc-container {
  max-width: 1480px;
  margin: 30px auto 60px auto;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1e293b;
}

/* 1. Header */
.ava-calc-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 36px 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid #007565;
  position: relative;
}

.ava-calc-header::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 140px;
  height: 3px;
  background: #00a896;
}

.ava-calc-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 117, 101, 0.25);
  border: 1px solid rgba(0, 168, 150, 0.4);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #5eead4;
  margin-bottom: 12px;
}

.ava-calc-title {
  color: #ffffff;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 8px 0;
  line-height: 1.2;
}

.ava-calc-subtitle {
  font-size: 14px;
  color: #94a3b8;
  max-width: 680px;
  margin: 0;
  line-height: 1.5;
}

/* In-Configurator Language Switcher */
.ava-calc-lang-toggle {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.ava-calc-lang-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ava-calc-lang-btn.active {
  background: #007565;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* 2. Workspace Layout */
.ava-calc-workspace {
  display: grid;
  grid-template-columns: 1.45fr 0.95fr;
  gap: 0;
  background: #f8fafc;
}

@media (max-width: 1040px) {
  .ava-calc-workspace {
    grid-template-columns: 1fr;
  }
}

.ava-calc-main-panel {
  padding: 40px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
}

.ava-calc-side-panel {
  padding: 40px;
  background: #f8fafc;
}

/* 3. Section Styling */
.ava-calc-section {
  margin-bottom: 34px;
  padding-bottom: 28px;
  border-bottom: 1px solid #f1f5f9;
}

.ava-calc-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.ava-calc-sec-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.ava-calc-step-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 800;
  color: #007565;
  background: rgba(0, 117, 101, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.ava-calc-sec-head h3 {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
  margin: 0;
}

/* Dimension Inputs */
.ava-dim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 600px) {
  .ava-dim-grid {
    grid-template-columns: 1fr;
  }
}

.ava-input-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px;
  transition: all 0.2s ease;
}

.ava-input-card:focus-within {
  border-color: #007565;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 117, 101, 0.08);
}

.ava-input-card label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 10px;
}

.ava-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ava-num-input {
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
}

.ava-unit {
  font-size: 15px;
  font-weight: 800;
  color: #94a3b8;
}

.ava-range-slider {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #cbd5e1;
  outline: none;
  cursor: pointer;
  accent-color: #007565;
}

/* 4. Visual 2D Blueprint Canvas Viewport */
.ava-visual-viewport {
  margin: 28px 0 34px 0;
  background: #0f172a;
  border-radius: 14px;
  box-shadow: 0 16px 36px -10px rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.ava-viewport-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ava-viewport-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ava-viewport-title svg {
  color: #38bdf8;
}

.ava-viewport-stats {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.ava-canvas-wrapper {
  padding: 20px;
  position: relative;
}

#avaFloorCanvas {
  display: block;
  width: 100%;
  height: 380px;
  border-radius: 8px;
}

.ava-canvas-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: #94a3b8;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.legend-swatch-plank {
  background: #383e42;
  border: 1px solid #555;
}

.legend-swatch-joist {
  background: #38bdf8;
}

.legend-swatch-starter {
  background: #f59e0b;
}

.legend-swatch-gutter {
  background: #06b6d4;
}

/* 5. Profile Selection Cards */
.ava-profiles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 640px) {
  .ava-profiles-grid {
    grid-template-columns: 1fr;
  }
}

.ava-profile-select-card {
  position: relative;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 22px 20px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ava-profile-select-card:hover {
  border-color: #cbd5e1;
  background: #ffffff;
  transform: translateY(-2px);
}

.ava-profile-select-card.active {
  border-color: #007565;
  background: #ffffff;
  box-shadow: 0 10px 25px -5px rgba(0, 117, 101, 0.15);
}

.ava-prof-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  background: #e2e8f0;
  color: #334155;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
}

.ava-prof-badge-primary {
  background: rgba(0, 117, 101, 0.15);
  color: #007565;
}

.ava-prof-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.ava-prof-subtitle {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 14px;
}

.ava-prof-specs {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 12px;
  color: #475569;
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
}

.ava-prof-specs li {
  margin-bottom: 5px;
}

/* 6. Swatches Grid */
.ava-swatches-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

@media (max-width: 600px) {
  .ava-swatches-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ava-swatch-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ava-swatch-item:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.ava-swatch-item.active {
  border-color: #007565;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 117, 101, 0.12);
}

.ava-swatch-circle {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin: 0 auto 8px auto;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.ava-swatch-name {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
}

.ava-swatch-desc {
  display: block;
  font-size: 10px;
  color: #64748b;
  margin-top: 2px;
}

.ava-active-color-name {
  font-size: 13px;
  font-weight: 600;
  color: #007565;
  background: rgba(0, 117, 101, 0.08);
  padding: 8px 14px;
  border-radius: 8px;
  display: inline-block;
}

/* 7. Substructure & Checkbox Cards */
.ava-substructure-box {
  margin-bottom: 18px;
}

.ava-substructure-box label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}

.ava-custom-select {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  cursor: pointer;
}

.ava-custom-select:focus {
  border-color: #007565;
}

.ava-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ava-check-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ava-check-card:hover {
  background: #ffffff;
  border-color: #cbd5e1;
}

.ava-check-card input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: #007565;
  cursor: pointer;
}

.ava-check-content strong {
  display: block;
  font-size: 13px;
  color: #0f172a;
}

.ava-check-content span {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

/* 8. Sticky Bill of Materials (BOM) Side Panel */
.ava-summary-sticky-card {
  position: sticky;
  top: 90px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.08);
}

.ava-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}

.ava-summary-head h3 {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}

.ava-summary-live-tag {
  font-size: 11px;
  font-weight: 700;
  color: #007565;
  background: rgba(0, 117, 101, 0.1);
  padding: 3px 8px;
  border-radius: 999px;
}

.ava-summary-specs {
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}

.spec-row:last-child {
  margin-bottom: 0;
}

.spec-row span {
  color: #64748b;
}

.spec-row strong {
  color: #0f172a;
}

/* Line Items */
.ava-bom-container {
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 18px;
  padding-right: 4px;
}

.ava-bom-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ava-bom-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}

.ava-bom-item:last-child {
  border-bottom: none;
}

.bom-info {
  flex: 1;
}

.bom-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
}

.bom-qty {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-top: 3px;
}

.bom-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
}

/* Financial Totals */
.ava-pricing-box {
  background: #0f172a;
  color: #ffffff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.price-row-total {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
}

.price-row-total span:last-child {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  color: #34d399; /* Emerald Green */
}

.ava-b2b-badge {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 10px;
  line-height: 1.4;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 8px;
}

/* Actions */
.ava-calc-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ava-btn-full {
  width: 100%;
  justify-content: center;
}

.ava-calc-quote-link {
  display: block;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #007565;
  text-decoration: none;
  margin-top: 6px;
  transition: color 0.2s ease;
}

.ava-calc-quote-link:hover {
  color: #005a4e;
  text-decoration: underline;
}

#avaFloorCanvas {
  display: block;
  width: 100%;
  min-height: 420px;
  height: 420px;
  background-color: #090e17;
  border-radius: 10px;
}

.ava-visual-viewport {
  background: #090e17;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.45);
}

.ava-canvas-wrapper {
  padding: 24px;
  background: #090e17;
}
