#bie-app {
  direction: rtl;
  max-width: 1000px;
  margin: 20px auto;
  font-family: 'Tahoma', 'Segoe UI', Arial, sans-serif;
  background: #f9f9f9;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* کانتینر جستجو */
.bie-search-container {
  position: relative;
  margin-bottom: 30px;
}

#bie-search {
  width: 100%;
  padding: 15px 20px;
  font-size: 16px;
  border-radius: 8px;
  border: 2px solid #ddd;
  background: #fff;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

#bie-search:focus {
  outline: none;
  border-color: #dc3545;
  box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}


#bie-results {
  list-style: none;
  padding: 0;
  margin: 5px 0 0 0;
  border: 2px solid #dc3545;
  border-radius: 10px;
  max-height: 320px;
  overflow-y: auto;
  background: #fff0f0;
  position: absolute;
  z-index: 1000;
  width: 100%;
  box-shadow: 0 4px 16px rgba(220,53,69,0.15);
  display: none;
}

#bie-results li {
  padding: 14px 18px;
  border-bottom: 1px solid #ffc2c2;
  cursor: pointer;
  display: flex;
  gap: 18px;
  align-items: center;
  transition: background-color 0.2s ease;
  background: transparent;
  color: #b30000;
  font-size: 15px;
}

#bie-results li:last-child {
  border-bottom: none;
}

#bie-results li:hover {
  background: #ffeaea;
  color: #fff;
}

#bie-results img {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  object-fit: cover;
  background: #fff;
  border: 2px solid #dc3545;
}

.product-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-name {
  font-weight: bold;
  color: #333;
  font-size: 14px;
}

.product-sku {
  color: #666;
  font-size: 12px;
}

.product-price {
  color: #dc3545;
  font-weight: bold;
  font-size: 13px;
}

/* کانتینر جدول فاکتور */
.bie-invoice-container {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#bie-invoice {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

#bie-invoice th {
  background: #dc3545;
  color: white;
  padding: 15px 10px;
  text-align: center;
  font-weight: bold;
  border: none;
}

#bie-invoice td {
  padding: 12px 10px;
  text-align: center;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

#bie-invoice tbody tr:hover {
  background: #f8f8f8;
}

/* ستون‌های خاص */
.product-image img {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #ddd;
}

.product-name {
  text-align: right;
  font-weight: 500;
  color: #333;
}

.product-sku {
  color: #666;
  font-family: 'Courier New', monospace;
}

.product-price,
.subtotal {
  font-weight: bold;
  color: #dc3545;
  direction: ltr;
  text-align: center;
}

.product-qty input.qty {
  width: 60px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
  background: #fff;
}

.product-qty input.qty:focus {
  outline: none;
  border-color: #dc3545;
}

.product-actions {
  text-align: center;
}

.remove-item {
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: background-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.remove-item:hover {
  background: #c82333;
}

/* فوتر جدول */
#bie-invoice tfoot td {
  background: #f8f9fa;
  border-top: 2px solid #dc3545
  ;
  border-bottom: none;
  font-weight: bold;
  padding: 15px 10px;
}

.total-label {
  text-align: left !important;
  color: #333;
  font-size: 16px;
}

.total-amount {
  color: #dc3545 !important;
  font-size: 18px;
  font-weight: bold;
  direction: ltr;
}

/* حالت ریسپانسیو */
@media (max-width: 768px) {
  #bie-app {
    margin: 10px;
    padding: 15px;
  }
  
  #bie-invoice {
    font-size: 12px;
  }
  
  #bie-invoice th,
  #bie-invoice td {
    padding: 8px 5px;
  }
  
  .product-image img {
    width: 40px;
    height: 40px;
  }
  
  #bie-results img {
    width: 40px;
    height: 40px;
  }
  
  .product-qty input.qty {
    width: 50px;
    padding: 6px;
  }
}

/* ریسپانسیو برای موبایل */
@media (max-width: 700px) {
  #bie-app {
    padding: 0 4px;
  }
  .bie-search-container input {
    width: 100% !important;
    font-size: 16px;
    box-sizing: border-box;
  }
  .bie-invoice-container {
    overflow-x: auto;
    width: 100%;
  }
  #bie-invoice {
    min-width: 600px;
    font-size: 14px;
  }
  #bie-invoice thead th, #bie-invoice tfoot td {
    font-size: 13px;
    padding: 6px 2px;
  }
  #bie-invoice td {
    padding: 6px 2px;
  }
  #bie-submit-invoice {
    font-size: 16px;
    padding: 10px 0;
  }
}

@media (max-width: 480px) {
  #bie-invoice {
    min-width: 400px;
    font-size: 12px;
  }
  #bie-invoice thead th, #bie-invoice tfoot td {
    font-size: 11px;
    padding: 4px 1px;
  }
  #bie-invoice td {
    padding: 4px 1px;
  }
  #bie-submit-invoice {
    font-size: 14px;
    padding: 8px 0;
  }
}

/* مودال نمایش بزرگ عکس محصول */
#bie-image-modal {
  position: fixed;
  z-index: 9999;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bie-modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
}
.bie-modal-content {
  position: relative;
  z-index: 2;
  background: #fff;
  border-radius: 0;
  padding: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  max-width: 64vw;
  max-height: 64vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: auto;
}
.bie-modal-content img {
  max-width: 64vw;
  max-height: 64vh;
  width: 64vw;
  height: auto;
  border-radius: 0;
  box-shadow: none;
  display: block;
}
.bie-modal-close {
  position: absolute;
  top: 2vw;
  left: 2vw;
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: background 0.2s;
}
.bie-modal-close:hover {
  background: #b30000;
}

@media (max-width: 900px) {
  .bie-modal-content img {
    max-width: 72vw;
    max-height: 56vh;
    width: 72vw;
  }
  .bie-modal-content {
    max-width: 72vw;
    max-height: 64vh;
  }
}
@media (max-width: 600px) {
  .bie-modal-content {
    max-width: 90vw;
    max-height: 60vh;
  }
  .bie-modal-content img {
    max-width: 90vw;
    max-height: 54vh;
    width: 90vw;
  }
}