/*
 * File: assets/css/pc-builder.css
 * Purpose: Styles for the Mitul IT PC Builder feature.
 * Color theme: Matte Black (#111111 / #1a1a1a) + Orange (#e07b00 / #ff8c00)
 * Compatible with: Martfury WooCommerce theme + Font Awesome 6
 */

/* ═══════════════════════════════════════════════
   CSS CUSTOM PROPERTIES
═══════════════════════════════════════════════ */
:root {
  --pcb-primary:      #e07b00;
  --pcb-primary-dark: #c96e00;
  --pcb-bg:           #111111;
  --pcb-bg-card:      #1a1a1a;
  --pcb-bg-hover:     #242424;
  --pcb-border:       #2e2e2e;
  --pcb-text:         #f0f0f0;
  --pcb-text-muted:   #888888;
  --pcb-green:        #3dba78;
  --pcb-red:          #e74c3c;
  --pcb-radius:       8px;
  --pcb-shadow:       0 4px 20px rgba(0,0,0,.45);
  --pcb-transition:   all .22s ease;
}

/* ═══════════════════════════════════════════════
   PAGE LAYOUT
═══════════════════════════════════════════════ */
.mituit-pcb-page {
  background: var(--pcb-bg);
  min-height: 70vh;
  padding-bottom: 60px;
}

/* Page Header */
.mituit-pcb-page-header {
  background: linear-gradient(135deg, #0d0d0d 0%, #1c1c1c 60%, #252500 100%);
  border-bottom: 2px solid var(--pcb-primary);
  padding: 36px 0 28px;
  margin-bottom: 32px;
}
.mituit-pcb-title {
  color: var(--pcb-primary);
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -.5px;
}
.mituit-pcb-title .pcb-icon { margin-right: 10px; }
.mituit-pcb-subtitle {
  color: var(--pcb-text-muted);
  font-size: .95rem;
  margin: 0;
}

/* Two-column layout */
.mituit-pcb-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .mituit-pcb-layout { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════
   SLOT LIST (LEFT COLUMN)
═══════════════════════════════════════════════ */
.mituit-pcb-slots-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pcb-slot {
  background: var(--pcb-bg-card);
  border: 1px solid var(--pcb-border);
  border-radius: var(--pcb-radius);
  overflow: hidden;
  transition: var(--pcb-transition);
}
.pcb-slot:hover { border-color: var(--pcb-primary); }

/* Slot header */
.pcb-slot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}
.pcb-slot-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(224,123,0,.15);
  display: flex; align-items: center; justify-content: center;
  color: var(--pcb-primary);
  font-size: .9rem;
  flex-shrink: 0;
}
.pcb-slot-label {
  flex: 1;
  color: var(--pcb-text);
  font-weight: 600;
  font-size: .92rem;
}
.pcb-required { color: var(--pcb-primary); font-size: .7rem; }

.pcb-choose-btn {
  background: transparent;
  border: 1px solid var(--pcb-primary);
  color: var(--pcb-primary);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--pcb-transition);
  white-space: nowrap;
}
.pcb-choose-btn:hover {
  background: var(--pcb-primary);
  color: #fff;
}

/* Selected product row */
.pcb-selected-product {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 14px;
  background: rgba(224,123,0,.06);
  border-top: 1px solid var(--pcb-border);
  animation: pcbFadeIn .25s ease;
}
@keyframes pcbFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.pcb-sel-img {
  width: 52px; height: 52px;
  object-fit: contain;
  border-radius: 4px;
  background: #2a2a2a;
  flex-shrink: 0;
}
.pcb-sel-info { flex: 1; min-width: 0; }
.pcb-sel-name {
  display: block;
  color: var(--pcb-text);
  font-weight: 600;
  font-size: .87rem;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pcb-sel-name:hover { color: var(--pcb-primary); }
.pcb-sel-sku {
  display: block;
  color: var(--pcb-text-muted);
  font-size: .75rem;
  margin-top: 2px;
}
.pcb-sel-price {
  color: var(--pcb-primary);
  font-weight: 700;
  font-size: .92rem;
  white-space: nowrap;
}
.pcb-remove-btn {
  background: transparent;
  border: 1px solid #333;
  color: var(--pcb-text-muted);
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .8rem;
  transition: var(--pcb-transition);
  flex-shrink: 0;
}
.pcb-remove-btn:hover { background: var(--pcb-red); border-color: var(--pcb-red); color: #fff; }

/* Compatibility warning */
.pcb-compat-alerts {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pcb-compat-alert {
  background: rgba(231,76,60,.12);
  border-left: 3px solid var(--pcb-red);
  color: #f99;
  padding: 10px 14px;
  border-radius: 0 var(--pcb-radius) var(--pcb-radius) 0;
  font-size: .85rem;
}

/* ═══════════════════════════════════════════════
   SUMMARY PANEL (RIGHT COLUMN)
═══════════════════════════════════════════════ */
.mituit-pcb-summary {
  background: var(--pcb-bg-card);
  border: 1px solid var(--pcb-border);
  border-radius: var(--pcb-radius);
  padding: 20px;
  position: sticky;
  top: 80px;
}
.pcb-summary-title {
  color: var(--pcb-primary);
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--pcb-border);
}
.pcb-summary-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}
.pcb-summary-list::-webkit-scrollbar { width: 4px; }
.pcb-summary-list::-webkit-scrollbar-thumb { background: var(--pcb-primary); border-radius: 2px; }

.pcb-summary-empty { color: var(--pcb-text-muted); font-size: .85rem; text-align: center; padding: 20px 0; }

.pcb-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--pcb-border);
  font-size: .83rem;
}
.pcb-summary-item-name { color: var(--pcb-text); flex: 1; }
.pcb-summary-item-price { color: var(--pcb-primary); font-weight: 600; white-space: nowrap; }

.pcb-summary-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-top: 2px solid var(--pcb-primary);
  margin-bottom: 16px;
  font-weight: 700;
  color: var(--pcb-text);
  font-size: 1.05rem;
}
#pcb-total-price { color: var(--pcb-primary); font-size: 1.2rem; }

/* Buttons */
.pcb-summary-actions { display: flex; flex-direction: column; gap: 10px; }
.pcb-btn {
  width: 100%;
  padding: 12px;
  border-radius: 6px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: var(--pcb-transition);
}
.pcb-btn-primary {
  background: var(--pcb-primary);
  color: #fff;
}
.pcb-btn-primary:hover:not(:disabled) { background: var(--pcb-primary-dark); }
.pcb-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.pcb-btn-secondary {
  background: #2a2a2a;
  color: var(--pcb-text-muted);
  border: 1px solid var(--pcb-border);
}
.pcb-btn-secondary:hover { background: var(--pcb-bg-hover); color: var(--pcb-text); }

.pcb-cart-msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: .85rem;
  font-weight: 600;
}
.pcb-cart-msg.success { background: rgba(61,186,120,.15); color: var(--pcb-green); border-left: 3px solid var(--pcb-green); }
.pcb-cart-msg.error   { background: rgba(231,76,60,.12);  color: #f99;            border-left: 3px solid var(--pcb-red);   }

/* Tip box */
.mituit-pcb-tip-box {
  background: var(--pcb-bg-card);
  border: 1px solid var(--pcb-border);
  border-radius: var(--pcb-radius);
  padding: 16px 18px;
  margin-top: 16px;
}
.mituit-pcb-tip-box h4 { color: var(--pcb-primary); font-size: .88rem; margin: 0 0 10px; }
.mituit-pcb-tip-box ul { margin: 0; padding: 0 0 0 18px; }
.mituit-pcb-tip-box li { color: var(--pcb-text-muted); font-size: .8rem; line-height: 1.7; }

/* ═══════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════ */
.pcb-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
  animation: pcbOverlayIn .2s ease;
}
@keyframes pcbOverlayIn { from { opacity: 0; } to { opacity: 1; } }

.pcb-modal {
  background: #1a1a1a;
  border: 1px solid var(--pcb-primary);
  border-radius: 12px;
  width: 100%;
  max-width: 860px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--pcb-shadow);
  animation: pcbModalIn .22s ease;
}
@keyframes pcbModalIn { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.pcb-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--pcb-border);
}
.pcb-modal-title {
  color: var(--pcb-primary);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}
.pcb-modal-close {
  background: transparent;
  border: 1px solid #333;
  color: var(--pcb-text-muted);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--pcb-transition);
}
.pcb-modal-close:hover { background: var(--pcb-red); border-color: var(--pcb-red); color: #fff; }

/* Search */
.pcb-modal-search {
  padding: 14px 20px;
  border-bottom: 1px solid var(--pcb-border);
  position: relative;
}
.pcb-modal-search input {
  width: 100%;
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 9px 12px 9px 36px;
  color: var(--pcb-text);
  font-size: .9rem;
  outline: none;
  box-sizing: border-box;
  transition: var(--pcb-transition);
}
.pcb-modal-search input:focus { border-color: var(--pcb-primary); }
.pcb-search-icon {
  position: absolute;
  left: 32px; top: 50%;
  transform: translateY(-50%);
  color: var(--pcb-text-muted);
  font-size: .85rem;
}

/* Product grid */
.pcb-modal-products {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  align-content: start;
}
.pcb-modal-products::-webkit-scrollbar { width: 5px; }
.pcb-modal-products::-webkit-scrollbar-thumb { background: var(--pcb-primary); border-radius: 3px; }

/* Product card inside modal */
.pcb-product-card {
  background: #111;
  border: 1px solid var(--pcb-border);
  border-radius: var(--pcb-radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--pcb-transition);
  display: flex;
  flex-direction: column;
}
.pcb-product-card:hover {
  border-color: var(--pcb-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(224,123,0,.2);
}
.pcb-product-card img {
  width: 100%;
  height: 120px;
  object-fit: contain;
  background: #1c1c1c;
  padding: 10px;
}
.pcb-product-card-body { padding: 10px; flex: 1; display: flex; flex-direction: column; }
.pcb-product-card-name {
  color: var(--pcb-text);
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pcb-product-card-price {
  color: var(--pcb-primary);
  font-weight: 700;
  font-size: .88rem;
  margin-top: 6px;
}
.pcb-product-card-select {
  display: block;
  text-align: center;
  background: var(--pcb-primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: 7px;
  margin: 8px 10px 10px;
  border-radius: 5px;
  transition: var(--pcb-transition);
}
.pcb-product-card:hover .pcb-product-card-select { background: var(--pcb-primary-dark); }

/* Pagination */
.pcb-modal-pagination {
  padding: 14px 20px;
  border-top: 1px solid var(--pcb-border);
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.pcb-page-btn {
  background: #222;
  border: 1px solid #333;
  color: var(--pcb-text-muted);
  width: 34px; height: 34px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  transition: var(--pcb-transition);
}
.pcb-page-btn:hover,
.pcb-page-btn.active { background: var(--pcb-primary); border-color: var(--pcb-primary); color: #fff; }

/* No products message */
.pcb-no-products {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--pcb-text-muted);
  padding: 40px;
  font-size: .9rem;
}

/* Loading spinner */
.pcb-loader {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 40px;
}
.pcb-loader span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--pcb-primary);
  animation: pcbBounce .9s ease-in-out infinite;
}
.pcb-loader span:nth-child(2) { animation-delay: .15s; }
.pcb-loader span:nth-child(3) { animation-delay: .30s; }
@keyframes pcbBounce {
  0%, 80%, 100% { transform: scale(.6); opacity: .4; }
  40%            { transform: scale(1.1); opacity: 1; }
}

/* ═══════════════════════════════════════════════
   ADMIN AREA
═══════════════════════════════════════════════ */
.mituit-pcb-admin-wrap h1,
.mituit-pcb-admin-wrap h2 {
  color: #e07b00;
}
.mituit-pcb-fields {
  border: 1px solid #e07b00 !important;
  border-radius: 6px;
  margin: 10px 0 !important;
  padding: 6px 0 !important;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 600px) {
  .pcb-slot-header { flex-wrap: wrap; }
  .pcb-choose-btn { margin-left: auto; }
  .pcb-modal-products { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .pcb-modal { max-height: 95vh; }
  .mituit-pcb-title { font-size: 1.5rem; }
}
