/* تنسيقات الواجهة الأمامية المحسنة */

@import url("https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap");

* {
  box-sizing: border-box;
}

.opcd-form-container {
  font-family: "Cairo", sans-serif;
  max-width: 500px;
  margin: 20px auto;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  direction: rtl;
  text-align: right;
  background: #fff;
  border: 1px solid #e5e7eb;
}

/* العنوان الرئيسي */
.opcd-form-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 25px;
  text-align: center;
  color: #374151;
  line-height: 1.6;
  padding: 15px;
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
  border-radius: 12px;
  border: 1px solid #d1d5db;
}

/* ملخص المنتج المحسن */
.opcd-product-summary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 16px;
  margin-bottom: 25px;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
  position: relative;
  overflow: hidden;
}

.opcd-product-summary::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  pointer-events: none;
}

.opcd-product-badge {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  position: relative;
  z-index: 1;
}

.opcd-sale-badge,
.opcd-stock-badge {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.opcd-sale-badge {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.opcd-product-info {
  display: flex;
  align-items: center;
  gap: 15px;
  position: relative;
  z-index: 1;
}

.opcd-product-image-container {
  position: relative;
}

.opcd-product-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 12px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.opcd-product-details {
  flex: 1;
}

.opcd-product-name {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.opcd-product-price {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.opcd-regular-price {
  text-decoration: line-through;
  opacity: 0.7;
  font-size: 14px;
}

.opcd-sale-price,
.opcd-current-price {
  font-size: 22px;
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.opcd-discount-badge {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* مؤشر المخزون */
.opcd-stock-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  position: relative;
  z-index: 1;
}

.opcd-in-stock {
  color: #10b981;
  font-weight: 600;
}

.opcd-out-of-stock {
  color: #ef4444;
  font-weight: 600;
}

.opcd-backorder {
  color: #f59e0b;
  font-weight: 600;
}

.opcd-stock-count {
  opacity: 0.8;
  font-size: 12px;
}

/* النموذج */
.opcd-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.opcd-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opcd-form-group label {
  font-weight: 600;
  font-size: 14px;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 5px;
}

.opcd-required {
  color: #ef4444;
  font-weight: 700;
}

.opcd-form-group input,
.opcd-form-group select,
.opcd-form-group textarea {
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  font-family: "Cairo", sans-serif;
  transition: all 0.3s ease;
  background-color: #fff;
  width: 100%;
}

.opcd-form-group input:focus,
.opcd-form-group select:focus,
.opcd-form-group textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  transform: translateY(-1px);
}

/* تنسيقات خاصة بحقل البلدية */
.opcd-form-group select#opcd-commune {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
}

.opcd-form-group select#opcd-commune:disabled {
  background-color: #f9fafb;
  color: #9ca3af;
  cursor: not-allowed;
}

.opcd-form-group select#opcd-commune option {
  padding: 8px 12px;
  font-size: 14px;
}

.opcd-form-group select#opcd-commune option:hover {
  background-color: #f3f4f6;
}

.opcd-form-group select:disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

/* متغيرات المنتج */
.opcd-product-variations {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 20px 0;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
}

.opcd-variation-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.opcd-variation-label {
  font-weight: 600;
  font-size: 14px;
  color: #374151;
}

/* خيارات الألوان */
.opcd-color-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.opcd-color-option {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.opcd-color-option:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.opcd-color-option.selected {
  border-color: #667eea;
  transform: scale(1.15);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.opcd-color-option.selected::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
  font-size: 16px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.opcd-color-option.red {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}
.opcd-color-option.green {
  background: linear-gradient(135deg, #10b981, #059669);
}
.opcd-color-option.black {
  background: linear-gradient(135deg, #1f2937, #111827);
}
.opcd-color-option.blue {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}
.opcd-color-option.white {
  background: linear-gradient(135deg, #ffffff, #f3f4f6);
  border: 2px solid #d1d5db;
}
.opcd-color-option.white.selected::after {
  color: #374151;
}
.opcd-color-option.default {
  background: linear-gradient(135deg, #6b7280, #4b5563);
}

/* خيارات الأحجام */
.opcd-size-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.opcd-size-option {
  padding: 12px 18px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  background: #fff;
  color: #374151;
  min-width: 50px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.opcd-size-option:hover {
  border-color: #667eea;
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.opcd-size-option.selected {
  border-color: #667eea;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

/* تنسيقات الكمية المحسنة */
.opcd-quantity-selector {
  display: flex;
  align-items: center;
  gap: 15px;
  background: #f8fafc;
  padding: 12px 20px;
  border-radius: 12px;
  justify-content: center;
  border: 2px solid #e5e7eb;
}

.opcd-qty-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-radius: 50%;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.opcd-qty-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.opcd-qty-btn:active {
  transform: scale(0.95);
}

.opcd-qty-input {
  width: 70px;
  text-align: center;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
  color: #374151;
  padding: 10px;
  background: white;
}

.opcd-qty-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* تنسيقات خيارات الشحن المحسنة */
.opcd-shipping-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 15px;
}

.opcd-shipping-option {
  background: #f8fafc;
  padding: 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid #e5e7eb;
  position: relative;
  overflow: hidden;
}

.opcd-shipping-option::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.opcd-shipping-option:hover::before,
.opcd-shipping-option.selected::before {
  transform: scaleX(1);
}

.opcd-shipping-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: #667eea;
}

.opcd-shipping-option.selected {
  border-color: #10b981;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.2);
}

.opcd-shipping-option input[type="radio"] {
  display: none;
}

.opcd-shipping-content {
  display: flex;
  align-items: center;
  gap: 15px;
}

.opcd-shipping-icon {
  font-size: 24px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 12px;
  flex-shrink: 0;
}

.opcd-shipping-info {
  flex: 1;
}

.opcd-shipping-title {
  font-weight: 700;
  margin-bottom: 4px;
  color: #1f2937;
  font-size: 16px;
}

.opcd-shipping-desc {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 6px;
}

.opcd-shipping-price {
  color: #667eea;
  font-weight: 700;
  font-size: 15px;
}

/* ملخص الأسعار القابل للطي */
.opcd-price-summary {
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border-radius: 16px;
  margin: 25px 0;
  border: 2px solid #e5e7eb;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.opcd-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  cursor: pointer;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  transition: all 0.3s ease;
}

.opcd-summary-header:hover {
  background: linear-gradient(135deg, #5a67d8, #6b46c1);
}

.opcd-summary-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.opcd-toggle-icon {
  font-size: 16px;
  font-weight: bold;
  transition: transform 0.3s ease;
}

.opcd-summary-content {
  padding: 20px;
  transition: all 0.3s ease;
}

.opcd-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 15px;
}

.opcd-price-row:last-child {
  border-bottom: none;
}

.opcd-price-row.opcd-total {
  font-weight: 800;
  font-size: 20px;
  margin-top: 10px;
  padding-top: 15px;
  border-top: 3px solid #667eea;
  color: #667eea;
  background: rgba(102, 126, 234, 0.05);
  padding: 15px;
  border-radius: 8px;
  margin: 15px -5px 0;
}

/* الأزرار المحسنة */
.opcd-form-actions {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 25px;
}

.opcd-action-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.opcd-submit-btn {
  background: linear-gradient(135deg, #8b5cf6, #a855f7);
  color: white;
  border: none;
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Cairo", sans-serif;
  flex: 1;
  min-width: 200px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
}

.opcd-submit-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.opcd-submit-btn:hover::before {
  left: 100%;
}

.opcd-submit-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(139, 92, 246, 0.4);
}

.opcd-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.opcd-btn-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.opcd-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* الرسائل المحسنة */
.opcd-loading {
  text-align: center;
  padding: 40px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 2px solid #e5e7eb;
}

.opcd-loading-content h4 {
  margin: 20px 0 10px 0;
  color: #374151;
  font-size: 20px;
}

.opcd-loading-content p {
  color: #6b7280;
  margin: 0;
}

.opcd-spinner-large {
  border: 4px solid #f3f4f6;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.opcd-message {
  padding: 25px;
  border-radius: 16px;
  text-align: center;
  font-weight: 500;
  margin: 20px 0;
  border: 2px solid;
}

.opcd-success {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: #065f46;
  border-color: #10b981;
}

.opcd-error {
  background: linear-gradient(135deg, #fef2f2, #fecaca);
  color: #991b1b;
  border-color: #ef4444;
}

.opcd-success-icon,
.opcd-error-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.opcd-message h3 {
  margin: 15px 0 10px 0;
  font-size: 22px;
}

.opcd-order-details {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid #10b981;
  text-align: right;
}

.opcd-detail-row {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
  font-size: 15px;
}

.opcd-order-id,
.opcd-final-amount {
  font-weight: 700;
  color: #667eea;
}

.opcd-retry-btn {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  margin-top: 15px;
  transition: all 0.3s ease;
}

.opcd-retry-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* تنسيقات الهواتف المحمولة */
@media (max-width: 768px) {
  .opcd-form-container {
    margin: 10px;
    padding: 16px;
    border-radius: 12px;
  }

  .opcd-form-title {
    font-size: 16px;
    padding: 12px;
  }

  .opcd-product-info {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }

  .opcd-product-image {
    width: 120px;
    height: 120px;
  }

  .opcd-product-name {
    font-size: 20px;
  }

  .opcd-product-price {
    justify-content: center;
  }

  .opcd-shipping-options {
    grid-template-columns: 1fr;
  }

  .opcd-action-buttons {
    flex-direction: column;
    gap: 15px;
  }

  .opcd-submit-btn {
    width: 100%;
    min-width: auto;
  }

  .opcd-color-options {
    justify-content: center;
  }

  .opcd-size-options {
    justify-content: center;
  }

  .opcd-quantity-selector {
    padding: 10px 16px;
  }

  .opcd-qty-btn {
    width: 40px;
    height: 40px;
  }

  .opcd-product-variations {
    padding: 15px;
  }

  .opcd-summary-header {
    padding: 15px;
  }

  .opcd-summary-content {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .opcd-form-container {
    margin: 5px;
    padding: 12px;
  }

  .opcd-product-summary {
    padding: 16px;
  }

  .opcd-product-image {
    width: 100px;
    height: 100px;
  }

  .opcd-product-name {
    font-size: 18px;
  }

  .opcd-form-group input,
  .opcd-form-group select,
  .opcd-form-group textarea {
    padding: 12px 14px;
    font-size: 16px;
  }

  .opcd-shipping-content {
    gap: 12px;
  }

  .opcd-shipping-icon {
    width: 45px;
    height: 45px;
    font-size: 20px;
  }

  .opcd-submit-btn {
    padding: 14px 24px;
    font-size: 16px;
  }

  .opcd-qty-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .opcd-qty-input {
    width: 60px;
    font-size: 16px;
  }

  .opcd-color-option {
    width: 40px;
    height: 40px;
  }

  .opcd-size-option {
    padding: 10px 14px;
    min-width: 45px;
  }
}

/* تحسينات إضافية للتفاعل */
.opcd-form-group.focused input,
.opcd-form-group.focused select,
.opcd-form-group.focused textarea {
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* تنسيقات منع النسخ واللصق */
.opcd-no-copy-paste input,
.opcd-no-copy-paste textarea,
.opcd-no-copy-paste select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* تأثيرات الحركة */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.opcd-form-container {
  animation: fadeInUp 0.6s ease-out;
}

/* تحسينات الأداء */
.opcd-form-container * {
  will-change: transform;
}

.opcd-submit-btn,
.opcd-qty-btn,
.opcd-color-option,
.opcd-size-option {
  will-change: transform, box-shadow;
}
