/**
 * Advanced Assembly Builder - Frontend Styles
 * 
 * @version 1.0.0
 */

/* ==================== Browser Normalization ==================== */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  box-sizing: border-box;
}

.aab-assembly-builder-wrapper,
.aab-assembly-builder-wrapper * {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

.aab-modal-product-item,
.aab-role-accordion,
.aab-summary-box,
.aab-price-box {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* ==================== Variables ==================== */
:root {
  --aab-primary: #0073aa;
  --aab-primary-hover: #005a87;
  --aab-secondary: #00a0d2;
  --aab-success: #46b450;
  --aab-warning: #ffb900;
  --aab-danger: #dc3232;
  --aab-info: #2271b1;
  --aab-savings: #15803d;
  --aab-savings-bg: #f0fdf4;
  --aab-savings-border: #22c55e;
  --aab-gray-light: #f1f1f1;
  --aab-gray: #ddd;
  --aab-gray-dark: #666;
  --aab-text: #333;
  --aab-shadow: 0 2px 8px rgba(0,0,0,0.1);
  --aab-border-radius: 8px;
  --aab-transition: all 0.3s ease;
}

/* ==================== Base Styles ==================== */
.aab-assembly-builder-wrapper {
  font-family: inherit, 'vazir', 'IRANSans', 'Tahoma', 'Segoe UI', sans-serif !important;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  direction: rtl;
  text-align: right;
}

.aab-assembly-builder-wrapper * {
  font-family: inherit !important;
}

/* ==================== Builder Container ==================== */
.aab-builder-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  background: #fff;
  border-radius: var(--aab-border-radius);
  box-shadow: var(--aab-shadow);
  overflow: hidden;
}

/* ==================== Main Builder Area ==================== */
.aab-builder-main {
  padding: 30px;
  border-left: 1px solid var(--aab-gray);
}

.aab-compatibility-warning {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: var(--aab-border-radius);
  padding: 15px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s ease;
}

.aab-compatibility-warning strong {
  color: #856404;
  font-size: 14px;
}

.aab-compatibility-warning span {
  color: #856404;
  font-size: 13px;
  flex: 1;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== Tabs ==================== */
.aab-tabs-header {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--aab-gray-light);
  position: relative;
  z-index: 95;
}

.aab-tab-btn {
  background: var(--aab-gray-light);
  border: 2px solid transparent;
  padding: 12px 20px;
  border-radius: var(--aab-border-radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--aab-gray-dark);
  transition: var(--aab-transition);
  min-width: 120px;
  text-align: center;
}

.aab-tab-btn:hover {
  background: var(--aab-primary);
  color: #fff;
  transform: translateY(-2px);
}

.aab-tab-btn.active {
  background: var(--aab-primary);
  color: #fff;
  border-color: var(--aab-primary-hover);
  box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

.aab-tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.aab-tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== Role Row & Accordion ==================== */
.aab-role-accordion {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  margin-bottom: 10px;
  transition: all 0.3s ease;
}

.aab-role-accordion:hover {
  border-color: #c0c0c0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.aab-role-accordion.has-selection {
  background: #e5fbec;
  border-color: #86efac;
}

.aab-role-accordion.has-selection .aab-accordion-header {
  background: #e5fbec;
}

.aab-role-accordion.has-selection .aab-accordion-summary.has-selection {
  color: #15803d;
}

.aab-role-accordion.has-selection:hover {
  background: #dcfce7;
  border-color: #4ade80;
}

.aab-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 15px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 6px;
}

.aab-accordion-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: right;
  font-size: 15px;
  font-weight: 600;
  color: #333;
  padding: 0;
  transition: all 0.3s ease;
}

.aab-accordion-toggle:hover {
  color: var(--aab-primary);
}

.aab-accordion-icon {
  display: inline-block;
  font-size: 18px;
  font-weight: 600;
  color: #666;
  transition: all 0.3s ease;
  min-width: 18px;
  text-align: center;
}

.aab-accordion-icon::before {
  content: '+';
}

.aab-role-accordion.open .aab-accordion-icon::before {
  content: '−';
}

.aab-accordion-title {
  font-weight: 600;
  color: #2c3e50;
  white-space: nowrap;
}

.aab-mandatory-badge-small {
  background: #dc3545;
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  margin-right: 8px;
  display: inline-block;
}

.aab-accordion-summary {
  flex: 1;
  color: #7f8c8d;
  font-size: 14px;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aab-accordion-summary.has-selection {
  color: var(--aab-primary);
  font-weight: 600;
}

.aab-btn-compact {
  padding: 8px 16px;
  font-size: 13px;
  white-space: nowrap;
}

.aab-accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
  padding: 0 15px;
}

.aab-role-accordion.open .aab-accordion-body {
  max-height: 1000px;
  padding: 15px;
  border-top: 1px solid #e9ecef;
}

.aab-accordion-body .aab-default-badge {
  display: none !important;
}

.aab-role-highlight {
  animation: aab-highlight-pulse 1.5s ease-in-out;
  border-color: #ff9800 !important;
  background: #fff8e7 !important;
}

@keyframes aab-highlight-pulse {
  0%, 100% {
    background: transparent;
    box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.4);
  }
  50% {
    background: #fff8e7;
    box-shadow: 0 0 0 5px rgba(255, 152, 0, 0.2);
  }
}

/* ==================== دکمه بستن آکاردئون ==================== */
.aab-close-accordion {
  background: linear-gradient(135deg, #46b450 0%, #3fa047 100%);
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(70, 180, 80, 0.2);
  font-weight: 600;
}

.aab-close-accordion:hover {
  background: linear-gradient(135deg, #3fa047 0%, #358a3c 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(70, 180, 80, 0.3);
}

/* ==================== دکمه انتخاب / تغییر ==================== */
.aab-select-btn {
  background: var(--aab-primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--aab-border-radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: var(--aab-transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.aab-select-btn:hover {
  background: var(--aab-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

.aab-select-btn.selected {
  background: var(--aab-secondary);
}

/* ==================== Selected Products Container ==================== */
.aab-selected-products-container {
  margin-top: 15px;
}

.aab-no-selection {
  color: var(--aab-gray-dark);
  font-style: italic;
  text-align: center;
  display: block;
  padding: 15px;
  background: var(--aab-gray-light);
  border-radius: var(--aab-border-radius);
}

.aab-selected-item-single {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: var(--aab-gray-light);
  border-radius: var(--aab-border-radius);
  position: relative;
}

.aab-selected-item-single .aab-default-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 9px;
  padding: 3px 6px;
}

.aab-product-thumb {
  width: 60px;
  height: 60px;
  border-radius: var(--aab-border-radius);
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: var(--aab-shadow);
  flex-shrink: 0;
}

.aab-product-info-text {
  flex: 1;
  min-width: 0;
}

.aab-product-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--aab-text);
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aab-product-price {
  font-size: 13px;
  color: var(--aab-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.aab-qty-badge {
  font-size: 11px;
  color: var(--aab-gray-dark);
  background: rgba(0,0,0,0.05);
  padding: 2px 6px;
  border-radius: 4px;
}

.aab-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #ef4444;
  background: #fff;
  color: #b91c1c;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  transition: var(--aab-transition);
  flex-shrink: 0;
}

.aab-remove-btn:hover {
  background: #fee2e2;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.aab-selected-multiple {
  background: var(--aab-gray-light);
  border-radius: var(--aab-border-radius);
  padding: 15px;
}

.aab-multi-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--aab-text);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

.aab-multi-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aab-multi-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 6px;
  background: #fff;
  transition: var(--aab-transition);
}

.aab-multi-item:hover {
  background: rgba(0,115,170,0.02);
  border-color: var(--aab-primary);
}

.aab-item-name {
  flex: 1;
  font-size: 13px;
  color: var(--aab-text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aab-item-price {
  font-size: 13px;
  color: var(--aab-primary);
  font-weight: 600;
  white-space: nowrap;
}

.aab-remove-one-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #ef4444;
  background: #fff;
  color: #b91c1c;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  transition: var(--aab-transition);
  flex-shrink: 0;
}

.aab-remove-one-btn:hover {
  background: #fee2e2;
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

/* ==================== Services Section ==================== */
.aab-services-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.aab-service-row {
  background: #fff;
  border: 2px solid var(--aab-gray-light);
  border-radius: var(--aab-border-radius);
  padding: 20px;
  transition: var(--aab-transition);
}

.aab-service-row:hover {
  border-color: var(--aab-primary);
  box-shadow: 0 4px 12px rgba(0,115,170,0.15);
}

.aab-service-label {
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
}

.aab-service-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 0;
  vertical-align: middle;
}

.aab-service-content {
  flex: 1;
}

.aab-service-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--aab-text);
  margin-bottom: 5px;
}

.aab-service-desc {
  font-size: 13px;
  color: var(--aab-gray-dark);
  margin-bottom: 8px;
}

.aab-service-price-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.aab-service-original-price {
  font-size: 14px;
  color: #999;
  text-decoration: line-through;
  font-weight: 500;
}

.aab-service-discount-badge {
  background: #d63638;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.aab-service-final-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--aab-primary);
}

/* ==================== Sidebar ==================== */
.aab-builder-sidebar {
  background: var(--aab-gray-light);
  padding: 20px;
}

.aab-summary-section {
  margin-bottom: 20px;
}

.aab-summary-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--aab-text);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--aab-gray);
}

.aab-summary-box {
  background: #fff;
  border-radius: var(--aab-border-radius);
  padding: 20px;
  box-shadow: var(--aab-shadow);
}

@media (max-width: 768px) {
  .aab-summary-box {
    padding: 15px;
  }
  .aab-summary-title {
    font-size: 16px;
    margin-bottom: 12px;
  }
}

.aab-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--aab-gray-light);
}

.aab-summary-item:last-child {
  border-bottom: none;
}

.aab-summary-name {
  font-size: 13px;
  color: var(--aab-gray-dark);
  font-weight: 500;
  text-align: right !important;
  flex: 1;
}

.aab-summary-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--aab-primary);
  text-align: left !important;
  white-space: nowrap;
  margin-left: 5px;
}

/* ==================== Total Savings Section ==================== */
.aab-total-savings-wrapper {
  margin: 15px 0;
  animation: fadeIn 0.3s ease;
}

.aab-total-savings {
  background: var(--aab-savings-bg);
  border-right: 3px solid var(--aab-savings-border);
  padding: 12px 16px;
  border-radius: 8px;
  text-align: center;
  transition: all 0.3s ease;
}

.aab-total-savings:hover {
  background: #e8f7ea;
  transform: translateX(-2px);
}

.aab-savings-label {
  font-size: 13px;
  font-weight: 500;
  color: #166534;
  margin-left: 8px;
}

.aab-savings-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--aab-savings);
  margin: 0 4px;
}

.aab-savings-currency {
  font-size: 13px;
  font-weight: 500;
  color: #166534;
}

/* ==================== Smart Add to Cart Button ==================== */
.aab-add-to-cart-btn {
  width: 100%;
  border: none;
  padding: 16px 24px;
  border-radius: var(--aab-border-radius);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  transition: var(--aab-transition);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.aab-add-to-cart-btn.aab-state-incomplete {
  background: linear-gradient(135deg, #2271b1 0%, #135e96 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
  cursor: pointer;
}

.aab-add-to-cart-btn.aab-state-incomplete:hover {
  background: linear-gradient(135deg, #135e96 0%, #0a4a78 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(34, 113, 177, 0.4);
}

.aab-add-to-cart-btn.aab-state-incomplete:active {
  transform: translateY(0);
}

.aab-add-to-cart-btn.aab-state-complete {
  background: linear-gradient(135deg, #46b450 0%, #3a9b44 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(70, 180, 80, 0.3);
  cursor: pointer;
  animation: btn-glow 2s ease-in-out;
}

.aab-add-to-cart-btn.aab-state-complete:hover {
  background: linear-gradient(135deg, #3a9b44 0%, #2e7d32 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(70, 180, 80, 0.4);
}

.aab-add-to-cart-btn.aab-state-complete:active {
  transform: translateY(0);
}

.aab-add-to-cart-btn .aab-btn-text {
  position: relative;
  z-index: 1;
}

@keyframes btn-glow {
  0% { box-shadow: 0 4px 12px rgba(70, 180, 80, 0.3); }
  50% { box-shadow: 0 0 20px rgba(70, 180, 80, 0.6); }
  100% { box-shadow: 0 4px 12px rgba(70, 180, 80, 0.3); }
}

.aab-completion-status {
  margin-top: 12px;
  font-size: 13px;
  text-align: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8f9fa;
  border-right: 3px solid #2271b1;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== Upsell Services ==================== */
.aab-summary-services-upsell {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 2px dashed var(--aab-gray);
  animation: fadeIn 0.3s ease;
}

.aab-upsell-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #fff8e7 0%, #fffef5 100%);
  border-radius: 6px;
  border-right: 3px solid var(--aab-warning);
}

.aab-upsell-icon {
  display: none;
}

.aab-upsell-title {
  font-size: 15px;
  font-weight: 700;
  color: #856404;
  flex: 1;
}

.aab-upsell-title::before {
  content: "✨ ";
  font-size: 14px;
}

@media (max-width: 768px) {
  .aab-upsell-title::before {
    content: "";
  }
}

.aab-upsell-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 15px;
}

.aab-upsell-service-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid var(--aab-gray-light);
  transition: all 0.3s ease;
}

.aab-upsell-service-item:hover {
  background: #f0f6fc;
  border-color: var(--aab-primary);
  transform: translateX(-5px);
  box-shadow: 0 2px 8px rgba(0,115,170,0.1);
}

.aab-upsell-service-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.aab-upsell-service-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--aab-text);
  line-height: 1.4;
}

.aab-upsell-price-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.aab-upsell-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--aab-primary);
}

.aab-upsell-original-price {
  font-size: 12px;
  color: #999;
  text-decoration: line-through;
}

.aab-upsell-discount {
  display: inline-block;
  background: var(--aab-danger);
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.aab-upsell-select-btn {
  background: var(--aab-success);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(70, 180, 80, 0.2);
}

.aab-upsell-select-btn:hover {
  background: #3a9d43;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(70, 180, 80, 0.3);
}

.aab-upsell-note {
  font-size: 11px;
  color: var(--aab-gray-dark);
  text-align: center;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed var(--aab-gray);
}

.aab-upsell-empty {
  text-align: center;
  padding: 20px;
  color: var(--aab-gray-dark);
  font-size: 13px;
  background: var(--aab-gray-light);
  border-radius: var(--aab-border-radius);
}

/* ==================== Selected Services in Sidebar ==================== */
.aab-summary-services-selected {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 2px dashed var(--aab-gray);
  animation: fadeIn 0.3s ease;
}

.aab-summary-services-selected h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--aab-text);
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--aab-gray-light);
}

.aab-summary-services-selected h4::before {
  content: "🛠️";
  font-size: 14px;
  margin-left: 6px;
}

.aab-summary-services-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aab-summary-service-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border-right: 3px solid var(--aab-success);
}

.aab-summary-service-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aab-summary-service-name {
  font-size: 13px;
  color: var(--aab-text);
  font-weight: 500;
}

.aab-summary-service-price-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.aab-summary-service-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--aab-primary);
}

.aab-summary-service-original-price {
  font-size: 12px;
  color: #999;
  text-decoration: line-through;
}

.aab-summary-service-discount-badge {
  background: var(--aab-danger);
  color: #fff;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
}

.aab-remove-service-btn {
  width: 26px;
  height: 26px;
  background: #fff;
  border: 1px solid var(--aab-danger);
  border-radius: 50%;
  color: var(--aab-danger);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.aab-remove-service-btn:hover {
  background: var(--aab-danger);
  color: #fff;
  transform: scale(1.1);
}

/* ==================== Price Section ==================== */
.aab-price-section {
  margin-bottom: 10px;
}

.aab-price-box {
  background: linear-gradient(135deg, var(--aab-primary) 0%, var(--aab-primary-hover) 100%);
  color: #fff;
  border-radius: var(--aab-border-radius);
  padding: 25px;
  text-align: center !important;
  box-shadow: 0 4px 15px rgba(0,115,170,0.3);
}

@media (max-width: 768px) {
  .aab-price-box {
    padding: 20px 15px;
  }
}

.aab-price-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
  margin-top: 30px;
  opacity: 0.9;
  text-align: center !important;
}

.aab-price-amount {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 5px;
  text-align: center !important;
}

.aab-currency {
  font-size: 16px;
  font-weight: 600;
  opacity: 0.9;
  margin-bottom: 20px;
  text-align: center !important;
  display: block !important;
  width: 100% !important;
}

#aab-total-price {
  text-align: center !important;
  display: block !important;
}

#aab-mobile-total {
  text-align: center !important;
  display: block !important;
}

.aab-price-box * {
  text-align: center !important;
}

.aab-price-section * {
  text-align: center !important;
}

/* ==================== Modal - New Two-Column Layout ==================== */
.aab-product-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999999 !important;
  display: none;
  isolation: isolate;
}

.aab-product-modal.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.aab-modal-backdrop {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75) !important;
  z-index: 1 !important;
  backdrop-filter: blur(3px);
}

.aab-modal-content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 1200px;
  width: 95%;
  max-height: 90vh;
  overflow: hidden;
  z-index: 1000000 !important;
  display: flex;
  flex-direction: row;
}

.aab-modal-sidebar {
  width: 280px;
  background: #f8f9fa;
  border-left: 1px solid #e9ecef;
  padding: 20px;
  overflow-y: auto;
  flex-shrink: 0;
}

.aab-modal-sidebar h4 {
  margin: 0 0 15px 0;
  font-size: 15px;
  color: #1d2327;
}

.aab-filters-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.aab-filter-group {
  margin-bottom: 0;
}

.aab-filter-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: #1d2327;
  margin-bottom: 8px;
}

.aab-filter-group select {
  width: 100%;
  padding: 10px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.aab-filter-group select:focus {
  outline: none;
  border-color: var(--aab-primary);
}

.aab-modal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.aab-modal-header {
  background: var(--aab-primary);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.aab-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.aab-modal-close {
  background: none;
  border: none;
  color: #fff !important;
  font-size: 28px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--aab-transition);
}

.aab-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.aab-filter-drawer-open {
  display: none;
}

.aab-filter-badge {
  background: #dc3545;
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  margin-right: 8px;
}

.aab-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
}

.aab-products-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.aab-modal-product-item {
  background: #fff;
  border: 2px solid var(--aab-gray-light);
  border-radius: var(--aab-border-radius);
  padding: 15px;
  cursor: pointer;
  transition: var(--aab-transition);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.aab-modal-product-item:hover {
  border-color: var(--aab-primary);
  box-shadow: 0 4px 12px rgba(0, 115, 170, 0.2);
  transform: translateY(-2px);
}

.aab-modal-product-item.selected {
  border-color: var(--aab-success);
  background: rgba(70, 180, 80, 0.05);
}

.aab-modal-product-image {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: var(--aab-border-radius);
  background: var(--aab-gray-light);
  padding: 10px;
}

.aab-modal-product-placeholder {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--aab-gray-light);
  border-radius: var(--aab-border-radius);
}

.aab-modal-product-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aab-modal-product-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--aab-text);
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.aab-product-link {
  text-decoration: none;
  font-size: 14px;
}

.aab-modal-product-price {
  font-size: 15px;
  color: var(--aab-primary);
  font-weight: 700;
}

.aab-add-to-temp-btn {
  width: 100%;
  margin-top: 0;
  padding: 8px 12px;
  background: linear-gradient(135deg, #46b450 0%, #3a9b44 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.aab-add-to-temp-btn:hover {
  background: linear-gradient(135deg, #3a9b44 0%, #2e7d32 100%);
  transform: translateY(-1px);
}

.aab-add-to-temp-btn:active {
  transform: translateY(1px);
}

.aab-selected-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  background: var(--aab-success);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(70, 180, 80, 0.4);
  z-index: 10;
}

.aab-default-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--aab-warning);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  z-index: 5;
  white-space: nowrap;
  text-align: center;
  line-height: 1.3;
}

.aab-modal-footer {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 2px solid #e9ecef;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  z-index: 10;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.aab-modal-footer-info {
  flex: 1;
}

.aab-modal-footer-count {
  font-size: 14px;
  color: #135e96;
}

.aab-modal-footer-count strong {
  font-size: 18px;
  color: #2271b1;
}

.aab-modal-footer-buttons {
  display: flex;
  gap: 10px;
}

.aab-btn-primary {
  background: #46b450;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.aab-btn-primary:hover {
  background: #3a9b44;
  transform: translateY(-1px);
}

.aab-btn-secondary {
  background: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.aab-btn-secondary:hover {
  background: #e0e0e0;
}

.aab-modal-actions-top {
  display: none !important;
}

/* ==================== Drawer موبایل (Bottom Sheet) ==================== */
.aab-filter-bottom-drawer {
  position: fixed;
  bottom: -100%;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.2);
  z-index: 1000001;
  transition: bottom 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}

.aab-filter-bottom-drawer.open {
  bottom: 0;
}

.aab-drawer-handle {
  width: 50px;
  height: 4px;
  background: #ddd;
  border-radius: 4px;
  margin: 12px auto 0;
  cursor: pointer;
}

.aab-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e9ecef;
}

.aab-drawer-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1d2327;
}

.aab-drawer-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #999;
  padding: 0;
  line-height: 1;
}

.aab-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.aab-drawer-filters-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.aab-drawer-filter-group {
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 16px;
}

.aab-drawer-filter-group label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #1d2327;
  margin-bottom: 10px;
}

.aab-drawer-filter-group select {
  width: 100%;
  padding: 12px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
}

.aab-drawer-filter-group select:focus {
  outline: none;
  border-color: var(--aab-primary);
}

.aab-drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 12px;
  background: #fff;
}

.aab-drawer-footer button {
  flex: 1;
  padding: 14px;
  border-radius: 40px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.aab-drawer-apply {
  background: var(--aab-primary);
  color: #fff;
  border: none;
}

.aab-drawer-apply:active {
  background: var(--aab-primary-hover);
  transform: scale(0.98);
}

.aab-drawer-reset {
  background: #f8f9fa;
  color: #666;
  border: 1px solid #e9ecef;
}

.aab-drawer-reset:active {
  background: #e9ecef;
  transform: scale(0.98);
}

.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

body.aab-modal-open {
  overflow: hidden !important;
}

/* ==================== Responsive Styles ==================== */
@media (max-width: 1024px) {
  .aab-builder-container {
    grid-template-columns: 1fr;
  }
  
  .aab-builder-main {
    border-left: none;
    border-bottom: 1px solid var(--aab-gray);
  }
  
  .aab-products-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  
  .aab-modal-footer {
    padding: 12px 16px;
  }
}

@media (max-width: 768px) {
  .aab-assembly-builder-wrapper {
    padding: 15px;
  }
  
  .aab-builder-main,
  .aab-builder-sidebar {
    padding: 20px;
  }
  
  .desktop-only {
    display: none !important;
  }
  
  .mobile-only {
    display: flex;
  }
  
  .aab-modal-content {
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
    position: fixed;
  }
  
  .aab-modal-sidebar {
    display: none;
  }
  
  .aab-modal-main {
    height: 100%;
  }
  
  .aab-modal-header {
    padding: 15px 20px;
  }
  
  .aab-filter-drawer-open {
    width: calc(100% - 40px);
    margin: 12px 20px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--aab-primary) 0%, var(--aab-primary-hover) 100%);
    color: white;
    border: none;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.3);
  }
  
  .aab-filter-drawer-open:active {
    transform: scale(0.98);
  }
  
  .aab-products-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 16px 20px;
  }
  
  .aab-modal-product-item {
    aspect-ratio: auto;
    padding: 12px;
  }
  
  .aab-modal-footer {
    flex-direction: column;
    padding: 12px 16px;
  }
  
  .aab-modal-footer-buttons {
    width: 100%;
  }
  
  .aab-modal-footer-buttons button {
    flex: 1;
  }
  
  .aab-tabs-header {
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 15px;
  }
  
  .aab-tab-btn {
    padding: 10px 15px;
    font-size: 13px;
    min-width: auto;
    flex: 1;
  }
  
  .aab-accordion-header {
    flex-wrap: wrap;
    padding: 10px 12px;
  }
  
  .aab-accordion-toggle {
    font-size: 14px;
  }
  
  .aab-accordion-title {
    font-size: 14px;
  }
  
  .aab-accordion-summary {
    font-size: 13px;
  }
  
  .aab-btn-compact {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .aab-builder-sidebar {
    position: sticky;
    top: 0;
    z-index: 90;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 0 0 8px 8px;
  }
  
  .aab-summary-mobile-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: linear-gradient(135deg, #2271b1 0%, #135e96 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    border-radius: 0;
  }
  
  .aab-summary-mobile-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
  }
  
  .aab-builder-sidebar.open .aab-summary-mobile-icon {
    transform: rotate(180deg);
  }
  
  .aab-sidebar-content {
    display: none;
    padding: 15px;
    animation: slideDown 0.3s ease;
    background: #f8f9fa;
  }
  
  .aab-builder-sidebar.open .aab-sidebar-content {
    display: block;
  }
  
  .aab-selected-item-single {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .aab-product-thumb {
    width: 50px;
    height: 50px;
  }
  
  .aab-product-name {
    font-size: 13px;
    white-space: normal;
  }
  
  .aab-remove-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 28px;
    height: 28px;
    font-size: 16px;
  }
  
  .aab-price-amount {
    font-size: 24px;
  }
  
  .aab-add-to-cart-btn {
    padding: 14px 20px;
    font-size: 14px;
  }
  
  .aab-savings-amount {
    font-size: 16px;
  }
  
  .aab-total-savings {
    padding: 10px 12px;
  }
}

@media (max-width: 480px) {
  .aab-assembly-builder-wrapper {
    padding: 10px;
  }
  
  .aab-builder-main,
  .aab-builder-sidebar {
    padding: 15px;
  }
  
  .aab-products-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .aab-tabs-header {
    gap: 6px;
  }
  
  .aab-tab-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .aab-accordion-header {
    padding: 8px 10px;
  }
  
  .aab-accordion-toggle {
    font-size: 13px;
    gap: 8px;
  }
  
  .aab-accordion-title {
    font-size: 13px;
  }
  
  .aab-accordion-summary {
    font-size: 12px;
    display: none;
  }
  
  .aab-btn-compact {
    padding: 5px 10px;
    font-size: 11px;
  }
  
  .aab-price-amount {
    font-size: 20px;
  }
  
  .aab-add-to-cart-btn {
    padding: 12px 16px;
    font-size: 13px;
  }
  
  .aab-savings-amount {
    font-size: 14px;
  }
  
  .aab-savings-label {
    font-size: 11px;
  }
  
  .aab-total-savings {
    padding: 8px 10px;
  }
  
  .aab-modal-footer-count {
    font-size: 12px;
  }
  
  .aab-modal-footer-count strong {
    font-size: 16px;
  }
  
  .aab-btn-primary,
  .aab-btn-secondary {
    padding: 8px 16px;
    font-size: 13px;
  }
}

/* ==================== Desktop (بیشتر از 1024px) ==================== */
@media (min-width: 1025px) {
  .aab-builder-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    align-items: start;
  }
  
  .aab-builder-main {
    order: 1;
  }
  
  .aab-builder-sidebar {
    order: 2;
    position: sticky;
    top: 100px;
    align-self: flex-start;
  }
  
  .aab-summary-mobile-toggle {
    display: none;
  }
  
  .aab-sidebar-content {
    display: block !important;
  }
}

/* ==================== Loading Modal ==================== */
.aab-loading-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.aab-loading-modal.active {
  opacity: 1;
  visibility: visible;
}

.aab-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.aab-loading-content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.aab-loading-modal.active .aab-loading-content {
  transform: scale(1);
}

.aab-loading-spinner {
  margin-bottom: 20px;
}

.aab-spinner {
  width: 60px;
  height: 60px;
  margin: 0 auto;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #2271b1;
  border-radius: 50%;
  animation: aab-spin 1s linear infinite;
}

@keyframes aab-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.aab-loading-message h3 {
  margin: 0 0 10px 0;
  font-size: 20px;
  font-weight: 600;
  color: #1d2327;
}

.aab-loading-message p {
  margin: 0;
  font-size: 14px;
  color: #757575;
}

/* ==================== Toast Notifications ==================== */
.aab-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #fff;
  border-radius: 8px;
  padding: 15px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 999998;
  min-width: 300px;
  max-width: 500px;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.aab-toast.active {
  opacity: 1;
  transform: translateX(0);
}

.aab-toast-icon {
  font-size: 24px;
  line-height: 1;
}

.aab-toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
  color: #1d2327;
  white-space: pre-line;
}

.aab-toast-success {
  border-left: 4px solid #46b450;
}

.aab-toast-warning {
  border-left: 4px solid #ffb900;
}

.aab-toast-error {
  border-left: 4px solid #dc3545;
}

.aab-toast-info {
  border-left: 4px solid #2271b1;
}

/* ==================== Cart Page Styles ==================== */
.woocommerce-cart .aab-composite-details,
.woocommerce-checkout .aab-composite-details {
  background: #f8f9fa;
  border-right: 3px solid #0073aa;
  border-radius: 8px;
  padding: 12px 15px;
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.woocommerce-cart .aab-composite-details .aab-build-id {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #dee2e6;
  font-weight: 600;
  color: #0073aa;
}

.woocommerce-cart .aab-composite-details .aab-component-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed #e9ecef;
}

.woocommerce-cart .aab-composite-details .aab-component-item:last-child {
  border-bottom: none;
}

.woocommerce-cart .aab-composite-details .aab-component-role {
  font-weight: 600;
  color: #0073aa;
  min-width: 100px;
  font-size: 12px;
}

.woocommerce-cart .aab-composite-details .aab-component-name {
  color: #333;
  flex: 1;
  font-size: 13px;
}

.woocommerce-cart .aab-composite-details .aab-component-qty {
  color: #666;
  font-size: 11px;
  background: #e9ecef;
  padding: 2px 6px;
  border-radius: 12px;
  white-space: nowrap;
}

/* ==================== Utility Classes ==================== */
.aab-text-center {
  text-align: center;
}

.aab-text-muted {
  color: #757575;
}

.aab-mb-0 {
  margin-bottom: 0;
}

.aab-mt-10 {
  margin-top: 10px;
}