@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;800;900&display=swap');

body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background-color: #f8f9fa;
  color: #343a40;
  overflow-x: hidden;
  width: 100%;
}

/* ─── Header ─── */
.header {
  padding: 0 24px 0 16px;
  width: 100%;
  height: 95px;
  background-color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: height 0.2s ease;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header .header-left img {
  width: 44px;
  height: 44px;
  max-height: 44px;
  object-fit: contain;
  border-radius: 50%;
  margin: 0 !important;
}

.header-left h1 {
  color: white;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1.2px;
  white-space: nowrap;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #aaa;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 8px 14px;
  border-radius: 8px;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.nav-link i { font-size: 22px; }
.nav-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-link.active-nav, .active-nav { color: #c0392b !important; }
.nav-link.active-nav i, .active-nav i { color: #c0392b !important; }

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ─── Main Builder Page ─── */
.builder-page { 
  margin-top: 110px;
  padding: 24px 20px 80px; 
  max-width: 1200px; 
  margin-left: auto;
  margin-right: auto;
}

.builder-header { 
  text-align: center; 
  margin-bottom: 24px; 
}

.builder-title { 
  font-size: clamp(2rem, 5.5vw, 3.8rem);
  font-weight: 900;
  color: #000000;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: -1px;
  line-height: 1.05;
}

.builder-accent { color: #c0392b; }

.builder-subtitle { 
  text-align: center; 
  color: #1a1a1a;
  font-size: clamp(0.85rem, 2vw, 1.15rem);
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 8px;
}

.builder-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.btn-outline {
  background: #fff;
  color: #555;
  border: 1px solid #ddd;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.2s;
}

.btn-outline:hover {
  background: #fdfdfd;
  border-color: #c0392b;
  color: #c0392b;
}

/* ─── Table Styling ─── */
.builder-table-wrapper { 
  background: white; 
  border-radius: 12px; 
  box-shadow: 0 10px 30px rgba(0,0,0,0.06); 
  width: 100%;
}

.builder-table { 
  width: 100%; 
  border-collapse: collapse; 
}

.builder-table thead { 
  background: #c0392b; 
  color: white; 
}

.builder-table th { 
  padding: 16px 20px; 
  text-align: left; 
  text-transform: uppercase; 
  font-size: 0.78rem; 
  letter-spacing: 1px; 
}

.builder-table td { 
  padding: 14px 20px; 
  border-bottom: 1px solid #f1f1f1; 
  vertical-align: middle; 
}

.component-row.locked { opacity: 0.6; background: #fafafa; }
.component-row.locked .component-name { color: #999; }

.btn-choose {
  background: #fff;
  color: #555;
  border: 1px solid #ddd;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.2s;
}

.btn-choose:hover:not(:disabled) { 
  background: #c0392b; 
  color: white; 
  border-color: #c0392b; 
}

.btn-choose:disabled { 
  background: #eee; 
  border-color: #ddd; 
  color: #aaa; 
  cursor: not-allowed; 
}

.btn-remove { 
  background: #f0f0f0; 
  color: #333; 
  border: none; 
  padding: 7px 16px; 
  border-radius: 20px; 
  font-weight: 700; 
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-remove:hover { 
  background: #c0392b; 
  color: white; 
}

.builder-price-val {
  font-weight: 800;
  color: #c0392b;
  font-size: 1rem;
}

/* ─── Selected Component Row ─── */
.part-selected-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.part-selected-img {
  width: 52px;
  height: 52px;
  min-width: 52px;
  background: #fbfbfb;
  border: 1px solid #eee;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.part-selected-img img {
  max-width: 44px;
  max-height: 44px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.part-selected-text {
  flex: 1;
  min-width: 0;
}

.selected-part-name {
  font-size: 14px;
  font-weight: 700;
  color: #111;
  line-height: 1.35;
  word-break: break-word;
}

.selected-part-specs {
  font-size: 12px;
  color: #666;
  margin-top: 3px;
  line-height: 1.4;
}

.mobile-price-action-row {
  display: flex;
  align-items: center;
}

.mobile-remove-btn { display: none; }
.desktop-remove-btn { display: inline-block; }

/* ─── Parts Catalog Modal ─── */
.parts-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.parts-modal-overlay.active { display: flex; }

.parts-modal {
  background: #ffffff;
  width: 100%;
  max-width: 750px;
  max-height: 90vh;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalScale 0.25s ease-out;
}

@keyframes modalScale { 
  from { transform: scale(0.95); opacity: 0; } 
  to { transform: scale(1); opacity: 1; } 
}

.modal-header { 
  background: #c0392b; 
  color: white; 
  padding: 14px 20px; 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  flex-shrink: 0;
}

.modal-close-btn { 
  background: rgba(255,255,255,0.2); 
  border: none; 
  color: white; 
  width: 32px; 
  height: 32px; 
  border-radius: 50%; 
  cursor: pointer; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-size: 20px; 
}

.modal-search-bar {
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  flex-shrink: 0;
}

.modal-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-search-row .search-input-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: #999;
  font-size: 18px;
  pointer-events: none;
}

#modalSearch { 
  width: 100%; 
  padding: 12px 14px 12px 40px;
  background: #ffffff; 
  border: 1px solid #ddd; 
  border-radius: 10px; 
  color: #333; 
  outline: none; 
  font-family: 'Poppins', sans-serif;
  font-size: 0.88rem;
  box-sizing: border-box;
}

#modalSearch:focus { border-color: #c0392b; }
.modal-sort-container { flex-shrink: 0; }

.btn-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 16px;
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
}

.btn-sort i { font-size: 16px; color: #c0392b; }

.modal-parts-list { 
  padding: 16px 20px; 
  max-height: 520px; 
  overflow-y: auto; 
  background: #fff; 
  flex: 1;
}

.part-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #eee;
  border-radius: 10px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  gap: 12px;
}

.part-card:hover {
  background: #fafafa !important;
  border-color: #ddd !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.part-card-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.part-card-thumb {
  width: 54px;
  height: 54px;
  min-width: 54px;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.part-card-thumb img {
  max-width: 44px;
  max-height: 44px;
  object-fit: contain;
}

.part-card-content { flex: 1; min-width: 0; }

.part-card-title {
  margin: 0;
  font-weight: 700;
  font-size: 13.5px;
  color: #111;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.part-card-desc {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: #777;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.part-card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.part-card-cost {
  font-weight: 800;
  font-size: 15px;
  color: #c0392b;
}

.btn-card-details { 
  background: white; 
  color: #c0392b; 
  border: 1.5px solid #c0392b; 
  padding: 6px 14px; 
  border-radius: 6px; 
  font-weight: 700; 
  font-size: 11.5px;
  cursor: pointer; 
}

.part-card-locked {
  opacity: 0.55;
  cursor: not-allowed !important;
  background-color: rgba(255, 50, 50, 0.04);
  border: 1px dashed #e74c3c !important;
  pointer-events: none;
}

.part-card-locked .btn-card-details { pointer-events: auto; }

.part-card-incompatible-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #e74c3c;
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  margin-top: 5px;
}

/* ══════════════════════════════════════════════════════════════
   STEP-BY-STEP MODAL CARDS
   ══════════════════════════════════════════════════════════════ */
.quotation-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(5px);
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.quotation-modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 540px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  animation: modalScale 0.22s ease-out;
}

.quotation-header {
  padding: 16px 22px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.quotation-header.red-header { background: #c0392b; }

.quotation-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.quotation-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.quotation-component-list {
  display: flex;
  flex-direction: column;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid #f0f0f0;
}

.summary-label {
  font-size: 13px;
  font-weight: 700;
  color: #444;
  width: 35%;
}

.summary-value {
  font-size: 13px;
  color: #111;
  font-weight: 600;
  text-align: right;
  width: 65%;
  word-break: break-word;
}

.builder-total-line-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px solid #222;
  font-size: 15px;
  font-weight: 800;
  color: #111;
}

.builder-total-line-summary strong {
  font-size: 20px;
  color: #c0392b;
  font-variant-numeric: tabular-nums;
}

.quotation-footer {
  padding: 14px 24px;
  background: #fafafa;
  border-top: 1px solid #eeeeee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.btn-modal-cancel {
  padding: 9px 18px;
  background: #ffffff;
  border: 1px solid #cccccc;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-modal-cancel:hover { background: #f2f2f2; }

.btn-modal-proceed {
  padding: 9px 22px;
  background: #c0392b;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-modal-proceed:hover { background: #a93226; }

.modal-step-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fee2e2;
  color: #c0392b;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.dialog-form-group {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
}

.dialog-form-group label {
  font-size: 11.5px;
  font-weight: 700;
  color: #444;
}

.dialog-form-group input {
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13.5px;
  font-family: 'Poppins', sans-serif;
  outline: none;
  box-sizing: border-box;
}

.dialog-form-group input:focus {
  border-color: #c0392b;
}

/* ══════════════════════════════════════════════════════════════
   IN-SYSTEM SIGN IN REQUIRED MODAL POPUP
   ══════════════════════════════════════════════════════════════ */
.auth-prompt-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  backdrop-filter: blur(4px);
  padding: 16px;
}

.auth-prompt-box {
  background: #ffffff;
  border-radius: 14px;
  width: 420px;
  max-width: 92vw;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-prompt-icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fee2e2;
  color: #c0392b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 16px;
}

.auth-prompt-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 8px 0;
}

.auth-prompt-msg {
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.5;
  margin: 0 0 24px 0;
}

.auth-prompt-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 12px;
  width: 100%;
}

.btn-prompt-cancel {
  background: #f1f5f9;
  color: #475569;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-prompt-cancel:hover { background: #e2e8f0; }

.btn-prompt-login {
  background: #c0392b;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-prompt-login:hover {
  background: #a93226;
  transform: translateY(-1px);
}

/* Feedback Modal */
.feedback-status-banner {
  background: #fdfaf3;
  border: 1px solid #faeacc;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}

.feedback-stars-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}

.star-item {
  font-size: 32px;
  color: #d8d8d8;
  cursor: pointer;
  transition: color 0.15s, transform 0.15s;
}

.star-item:hover, .star-item.active {
  color: #f39c12;
  transform: scale(1.15);
}

.feedback-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 12.5px;
  resize: vertical;
  outline: none;
}

.feedback-textarea:focus { border-color: #c0392b; }

/* ══════════════════════════════════════════════════════════════
   MOBILE VIEW
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .builder-page {
    margin-top: 96px;
    padding: 16px 12px 60px;
  }

  .builder-table-wrapper {
    overflow-x: visible;
    box-shadow: none;
    background: transparent;
  }

  .builder-table {
    min-width: 0 !important;
    width: 100% !important;
    display: block !important;
  }

  .builder-table thead { display: none !important; }

  .builder-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .component-row {
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    border-radius: 10px !important;
    border: 1px solid #e8e8e8 !important;
    padding: 14px !important;
    gap: 8px !important;
  }

  .component-row td {
    padding: 0 !important;
    border: none !important;
    width: 100% !important;
  }

  .component-name {
    font-size: 12px !important;
    font-weight: 800 !important;
    color: #c0392b !important;
    letter-spacing: 0.5px;
    text-transform: uppercase;
  }

  .btn-choose {
    width: 100%;
    justify-content: center;
    padding: 10px;
    font-size: 12.5px;
  }

  .part-selected-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
  }

  .part-selected-img {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: #fbfbfb;
    border: 1px solid #eee;
    border-radius: 6px;
  }

  .part-selected-text { flex: 1; min-width: 0; }

  .selected-part-name {
    font-size: 13px;
    font-weight: 700;
    color: #111;
    word-break: break-word;
  }

  .selected-part-specs {
    font-size: 11px;
    color: #777;
    margin-top: 2px;
  }

  .component-action-cell { display: none !important; }
  .desktop-remove-btn { display: none !important; }
  .mobile-remove-btn { display: inline-block !important; }

  .mobile-price-action-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding-top: 8px !important;
    border-top: 1px solid #f2f2f2 !important;
    margin-top: 4px !important;
  }

  .builder-table tfoot {
    display: block !important;
    width: 100% !important;
    margin-top: 12px !important;
  }

  .builder-table tfoot tr {
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    border-radius: 10px !important;
    border: 1.5px solid #e0e0e0 !important;
    padding: 14px 16px !important;
    gap: 12px !important;
  }

  .builder-table tfoot td {
    display: flex !important;
    width: 100% !important;
    padding: 0 !important;
    border: none !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  #sendBuildBtn {
    width: 100% !important;
    justify-content: center !important;
    padding: 12px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
  }

  .part-card {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .part-card-actions {
    justify-content: space-between !important;
    width: 100% !important;
    border-top: 1px solid #f5f5f5 !important;
    padding-top: 8px !important;
  }

  .quotation-modal-card {
    width: calc(100vw - 28px);
    max-height: 90vh;
  }

  .summary-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .summary-label,
  .summary-value {
    width: 100%;
    text-align: left;
  }
}