/* ==========================================================================
   PUNCA APPAREL - KOMPARASI HARGA POSTER & ANALISIS HPP CSS
   ========================================================================== */

.compare-page-container {
  max-width: 1540px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem 1.25rem;
}

/* Page Header Banner */
.compare-header-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0284c7 100%);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  color: #ffffff;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.25);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.compare-title-wrap h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.02em;
}

.compare-title-wrap p {
  color: #cbd5e1;
  font-size: 0.875rem;
  margin: 0;
  max-width: 700px;
  line-height: 1.45;
}

.compare-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-save-prices {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #10b981;
  color: #ffffff;
  border: 1px solid #059669;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transition: all 0.2s ease;
}

.btn-save-prices:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

.btn-save-prices:active {
  transform: translateY(0);
}

.btn-reset-prices {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.btn-reset-prices:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.btn-reset-margin-small {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #ffffff;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-reset-margin-small:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

/* Category & Material Selector Bar */
.compare-selector-bar {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cat-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.85rem;
}

.cat-switch-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cat-pills {
  display: inline-flex;
  background: #f1f5f9;
  padding: 0.25rem;
  border-radius: var(--radius-full);
  gap: 0.35rem;
}

.cat-pill-btn {
  border: none;
  background: transparent;
  padding: 0.45rem 1.15rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.cat-pill-btn:hover {
  color: var(--text-main);
}

.cat-pill-btn.active {
  background: var(--primary-deep);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.materials-scroll-list {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scrollbar-width: thin;
}

.mat-item-card {
  flex: 0 0 auto;
  background: #f8fafc;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: all 0.2s ease;
  user-select: none;
}

.mat-item-card:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.mat-item-card.active {
  background: #eff6ff;
  border-color: var(--primary-deep);
  box-shadow: 0 0 0 1px var(--primary-deep);
}

.mat-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mat-info {
  display: flex;
  flex-direction: column;
}

.mat-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.mat-gsm {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* 3-COLUMN COMPARE GRID */
.compare-grid-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1200px) {
  .compare-grid-layout {
    grid-template-columns: 1fr 1fr;
  }
  .compare-col-calculator {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .compare-grid-layout {
    grid-template-columns: 1fr;
  }
}

/* COLUMN CARD CONTAINERS */
.compare-col-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.compare-col-punca {
  border-top: 4px solid #2563eb;
}

.compare-col-vendor {
  border-top: 4px solid #f59e0b;
}

.compare-col-calculator {
  border-top: 4px solid #10b981;
}

.col-card-header {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.col-card-header h3 {
  font-size: 0.975rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.col-badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
}

.badge-punca {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.badge-vendor {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-calc {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

/* POSTER THUMBNAIL BOX */
.poster-box-wrap {
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.poster-preview-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  aspect-ratio: 16 / 10;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.poster-preview-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.3s ease;
}

.poster-preview-card:hover img {
  transform: scale(1.03);
}

.poster-zoom-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(2px);
}

.poster-preview-card:hover .poster-zoom-overlay {
  opacity: 1;
}

.poster-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.poster-meta-bar strong {
  color: var(--text-main);
}

/* EDITABLE PRICELIST TABLES */
.pricelist-table-container {
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.table-help-hint {
  font-size: 0.75rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #f8fafc;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  border-left: 3px solid #3b82f6;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.compare-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 0.55rem 0.6rem;
  text-align: left;
  border: 1px solid var(--border-light);
  font-size: 0.75rem;
}

.compare-table td {
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border-light);
  vertical-align: middle;
}

.compare-table tr:hover td {
  background: #f8fafc;
}

.tier-label-cell {
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  background: #fafafa;
}

/* EDITABLE PRICE INPUT IN TABLE */
.price-input-cell {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-prefix {
  position: absolute;
  left: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #94a3b8;
  pointer-events: none;
}

.price-editable-input {
  width: 100%;
  padding: 0.38rem 0.25rem 0.38rem 1.45rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.775rem;
  font-weight: 700;
  color: #0f172a;
  background: #ffffff;
  transition: all 0.2s ease;
  font-family: inherit;
  -moz-appearance: textfield;
}

.price-editable-input::-webkit-outer-spin-button,
.price-editable-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.price-editable-input:focus {
  outline: none;
  border-color: #2563eb;
  background: #f0f7ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.price-editable-input.vendor-input:focus {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

/* RIGHT COLUMN: HPP & MARGIN ANALYZER */
.analyzer-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.simulator-controls {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sim-control-title {
  font-size: 0.775rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sim-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.sim-field-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.sim-select,
.sim-input {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #0f172a;
  background: #ffffff;
  font-family: inherit;
}

.sim-select:focus,
.sim-input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

/* FINANCIAL SCORECARD */
.financial-metrics-card {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.metric-big-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.metric-box {
  background: #ffffff;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.metric-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
}

.metric-sub {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 0.15rem;
}

/* PROFIT HIGHLIGHT BANNER */
.profit-highlight-banner {
  background: #ecfdf5;
  border: 1.5px solid #a7f3d0;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.profit-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #065f46;
}

.profit-amount {
  font-size: 1.35rem;
  font-weight: 800;
  color: #047857;
  letter-spacing: -0.02em;
}

.profit-per-pcs {
  font-size: 0.75rem;
  color: #059669;
  font-weight: 600;
}

/* MARGIN PROGRESS & INTERACTIVE SLIDER */
.margin-slider-controller {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: #f8fafc;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.gauge-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.775rem;
  font-weight: 700;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.gauge-percent {
  font-size: 1.15rem;
  font-weight: 800;
  color: #047857;
  letter-spacing: -0.01em;
}

.slider-interactive-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* CUSTOM RANGE SLIDER */
.custom-margin-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  background: linear-gradient(90deg, #ef4444 0%, #f59e0b 25%, #10b981 50%, #059669 100%);
  border-radius: 999px;
  outline: none;
  cursor: grab;
  transition: opacity 0.2s ease;
}

.custom-margin-range:active {
  cursor: grabbing;
}

.custom-margin-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #059669;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease;
}

.custom-margin-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  border-color: #2563eb;
}

.custom-margin-range::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #059669;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease;
}

.slider-scale-legend {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #94a3b8;
  user-select: none;
}

/* MARGIN SCOPE (ALL TIERS VS SELECTED TIER) */
.margin-scope-box {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.45rem;
  border-top: 1px dashed #cbd5e1;
}

.margin-scope-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  user-select: none;
}

.margin-scope-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
  cursor: pointer;
}

.margin-scope-hint {
  font-size: 0.68rem;
  color: #64748b;
  padding-left: 1.5rem;
}

.margin-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.725rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  align-self: flex-start;
}

.status-healthy {
  background: #ecfdf5;
  color: #047857;
}

.status-normal {
  background: #eff6ff;
  color: #1d4ed8;
}

.status-warning {
  background: #fef3c7;
  color: #b45309;
}

.status-danger {
  background: #fef2f2;
  color: #b91c1c;
}

/* TIER COMPARISON MATRIX TABLE */
.tier-matrix-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tier-matrix-title {
  font-size: 0.775rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.matrix-table th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 700;
  padding: 0.5rem 0.45rem;
  text-align: center;
  border: 1px solid var(--border-light);
}

.matrix-table td {
  padding: 0.45rem 0.45rem;
  text-align: center;
  border: 1px solid var(--border-light);
  font-weight: 600;
}

.matrix-table td.col-tier {
  text-align: left;
  font-weight: 700;
  color: #1e293b;
}

.matrix-profit-positive {
  color: #047857;
  font-weight: 700;
}

.matrix-margin-badge {
  background: #ecfdf5;
  color: #047857;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.7rem;
}

/* LIGHTBOX POSTER MODAL */
.poster-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.poster-modal.open {
  display: flex;
}

.poster-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.poster-modal-img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  background: #ffffff;
}

.poster-modal-close {
  position: absolute;
  top: -2.75rem;
  right: 0;
  background: #ffffff;
  color: #0f172a;
  border: none;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.poster-modal-title {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 0.75rem;
  text-align: center;
}
