/**
 * Single Product Stylesheet - Arcade Store
 * 
 * Optimized Compact Design:
 * - Small product thumbnail (100px-110px) in a unified header card
 * - Zero empty voids / zero disjointed gaps between elements
 * - Original payment gateways design preserved exactly
 * - High readability, modern Arabic typography (Tajawal / system font)
 */

:root {
  --spx-accent: var(--color-primary, #01696f);
  --spx-accent-hover: var(--color-primary-hover, #0c4e54);
  --spx-accent-tint: var(--color-primary-light, #e8f5f5);
  --spx-border: var(--color-border, #e0e0e0);
  --spx-divider: var(--color-divider, #e8e8e8);
  --spx-text: var(--color-text, #111111);
  --spx-text-muted: var(--color-text-muted, #555555);
  --spx-text-subtle: var(--color-text-subtle, #777777);
  --spx-bg-card: #ffffff;
  --spx-bg-block: var(--color-block, #f8f8fa);
  --spx-bg-subtle: #f9f9fb;
}

/* ══════════════════════════════════════
   Wrapper & Breadcrumbs
══════════════════════════════════════ */
.spx-wrap {
  max-width: 740px;
  margin: 0 auto;
  padding: 16px 14px 40px;
  direction: rtl;
  color: var(--spx-text);
  font-family: inherit;
}

.spx-breadcrumbs-wrap {
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: var(--spx-text-subtle);
}

.spx-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}

.spx-breadcrumbs a {
  color: var(--spx-text-muted);
  text-decoration: none;
  transition: color 140ms ease-out;
}

.spx-breadcrumbs a:hover {
  color: var(--spx-accent);
}

.spx-crumb-sep {
  opacity: 0.4;
  user-select: none;
}

.spx-crumb-item.current {
  color: var(--spx-text);
  font-weight: 500;
}

/* ══════════════════════════════════════
   Main Unified Card (Compact & Tight)
══════════════════════════════════════ */
.spx-main-card {
  background: var(--spx-bg-card);
  border: 1px solid var(--spx-border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Header Row: Small Image + Title & Price */
.spx-header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--spx-divider);
}

/* Compact Product Image */
.spx-img-frame {
  width: 100px;
  height: 100px;
  min-width: 100px;
  min-height: 100px;
  border-radius: 12px;
  border: 1px solid var(--spx-border);
  background: var(--spx-bg-block);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.spx-img {
  width: 84%;
  height: 84%;
  object-fit: contain;
  display: block;
}

/* Title & Price Column */
.spx-title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.spx-cat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--spx-accent);
  text-decoration: none;
  line-height: 1;
  margin-bottom: 2px;
}

.spx-cat-label:hover {
  text-decoration: underline;
}

.spx-title {
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  font-weight: 700;
  color: var(--spx-text);
  line-height: 1.3;
  margin: 0;
  word-break: break-word;
}

.spx-price-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.spx-price {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--spx-accent);
  line-height: 1;
}

.spx-price .woocommerce-Price-amount {
  color: inherit;
}

.spx-discount-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  line-height: 1.3;
}

/* Star Rating Pill */
.spx-rating-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--spx-text-muted);
  margin-top: 2px;
}

.spx-stars {
  display: flex;
  gap: 2px;
}

.spx-star {
  width: 12px;
  height: 12px;
  stroke: #eab308;
  fill: none;
  stroke-width: 2;
}

.spx-star.on {
  fill: #eab308;
}

.spx-rc {
  opacity: 0.65;
  font-weight: 400;
}

/* ══════════════════════════════════════
   Feature Highlights
══════════════════════════════════════ */
.spx-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spx-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--spx-text-muted);
  line-height: 1.4;
}

.spx-feature-icon {
  width: 15px;
  height: 15px;
  color: var(--spx-accent);
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   WooCommerce Form & Variations
══════════════════════════════════════ */
#wc-cart-form {
  margin: 0;
  padding: 0;
}

#wc-cart-form .single_add_to_cart_button {
  display: none !important;
}

#wc-cart-form table.variations {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}

#wc-cart-form table.variations tr {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

#wc-cart-form table.variations td.label {
  padding: 0;
}

#wc-cart-form table.variations td.label label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--spx-text);
  margin-bottom: 2px;
  display: block;
}

#wc-cart-form table.variations td.value {
  padding: 0;
}

#wc-cart-form select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  background-color: var(--spx-bg-card);
  border: 1px solid var(--spx-border);
  border-radius: 8px;
  color: var(--spx-text);
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 140ms ease-out;
  cursor: pointer;
}

#wc-cart-form select:focus-visible {
  outline: none;
  border-color: var(--spx-accent);
}

#wc-cart-form .reset_variations {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--spx-text-subtle);
  text-decoration: underline;
}

/* Override Modern Quantity Wrapper margin to eliminate gap */
.modern-qty-wrapper {
  margin-bottom: 8px !important;
  padding: 8px 12px !important;
  gap: 12px !important;
}

/* ══════════════════════════════════════
   بوابات الدفع (بالشكل والتصميم الأصلي)
══════════════════════════════════════ */
.spx-gateways {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.spx-gw-label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-text-muted);
  margin: 0;
}

.spx-gw-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spx-gw-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--color-border, #e0e0e0);
  cursor: pointer;
  transition: border-color .18s, background .18s;
  background: var(--card-bg, #fff);
  user-select: none;
}

.spx-gw-item:hover {
  border-color: var(--color-primary, #01696f);
}

.spx-gw-item.active {
  border-color: var(--color-primary, #01696f);
  background: var(--color-primary-light, #e8f5f5);
}

.spx-gw-item input[type=radio] {
  display: none;
}

/* مؤشر الاختيار */
.spx-gw-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--color-border, #ccc);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color .18s, background .18s;
}

.spx-gw-check svg {
  width: 10px;
  height: 10px;
  fill: #fff;
  opacity: 0;
  transition: opacity .15s;
}

.spx-gw-item.active .spx-gw-check {
  border-color: var(--color-primary, #01696f);
  background: var(--color-primary, #01696f);
}

.spx-gw-item.active .spx-gw-check svg {
  opacity: 1;
}

.spx-gw-name {
  flex: 1;
  font-size: .92rem;
  color: var(--color-text);
}

.spx-gw-icon img {
  height: 20px;
  width: auto;
  display: block;
}

.spx-gw-fields {
  display: none;
  padding: 12px 14px;
  background: var(--color-bg-secondary, #f9f9f9);
  border-radius: 8px;
  margin-top: -2px;
}

.spx-gw-fields.open {
  display: block;
}

.spx-gw-fields p {
  font-size: .82rem;
  color: var(--color-text-muted);
  margin: 0;
}

.spx-empty-wallet {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--alert-warning-bg, #fff8e1);
  color: var(--alert-warning-text, #795548);
  border: 1px solid var(--alert-warning-border, #ffe082);
  border-radius: 10px;
  font-size: .84rem;
  font-weight: 500;
}

.spx-empty-wallet svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   Status Messages & Alerts
══════════════════════════════════════ */
.spx-status {
  display: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.8125rem;
  line-height: 1.45;
  border: 1px solid transparent;
  margin-top: 4px;
}

.spx-status.success {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

.spx-status.error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.spx-status.warning {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.spx-status-inner {
  display: block;
}

.spx-recharge {
  display: inline-block;
  margin-top: 4px;
  color: var(--spx-accent);
  font-weight: 600;
  text-decoration: underline;
}

/* ══════════════════════════════════════
   Primary Buy Button
══════════════════════════════════════ */
.spx-buy-btn {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  border-radius: 10px;
  background: var(--btn-bg, var(--color-primary, #01696f));
  color: var(--btn-text, #ffffff);
  transition: background-color 140ms ease-out;
  margin-top: 4px;
}

.spx-buy-btn:hover:not(:disabled) {
  background: var(--btn-hover-bg, #0c4e54);
}

.spx-buy-btn:focus-visible {
  outline: 2px solid var(--spx-accent);
  outline-offset: 2px;
}

.spx-buy-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.spx-buy-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.spx-field-error {
  border-color: #dc2626 !important;
  background-color: #fff5f5 !important;
}

/* ══════════════════════════════════════
   Lower Sections: Description & Specs
══════════════════════════════════════ */
.spx-desc-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--spx-divider);
}

.spx-section-header {
  margin-bottom: 12px;
}

.spx-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--spx-text);
  margin: 0;
}

.spx-desc-content {
  font-size: 0.9rem;
  color: var(--spx-text-muted);
  line-height: 1.7;
}

.spx-desc-content p {
  margin-bottom: 12px;
}

.spx-desc-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--spx-border);
}

.spx-desc-content ul,
.spx-desc-content ol {
  padding-right: 18px;
  margin-bottom: 12px;
}

.spx-desc-content li {
  margin-bottom: 4px;
}

/* Specifications Table */
.spx-specs-block {
  margin-top: 20px;
}

.spx-specs-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--spx-text);
  margin-bottom: 8px;
}

.spx-specs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  border: 1px solid var(--spx-border);
  border-radius: 8px;
  overflow: hidden;
}

.spx-specs-table tr {
  border-bottom: 1px solid var(--spx-border);
}

.spx-specs-table tr:last-child {
  border-bottom: none;
}

.spx-specs-table tr:nth-child(even) {
  background: var(--spx-bg-subtle);
}

.spx-specs-table th {
  padding: 8px 12px;
  text-align: right;
  font-weight: 600;
  color: var(--spx-text);
  width: 32%;
  background: var(--spx-bg-block);
}

.spx-specs-table td {
  padding: 8px 12px;
  color: var(--spx-text-muted);
}

/* ══════════════════════════════════════
   Reviews & Related Wrappers
══════════════════════════════════════ */
.spx-reviews-wrap {
  margin-top: 24px;
}

/* ══════════════════════════════════════
   Order Processing Overlay Modal
══════════════════════════════════════ */
.op-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease-out;
}

.op-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.op-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--spx-bg-card);
  border-radius: 12px;
  border: 1px solid var(--spx-border);
  padding: 18px 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--spx-text);
}

.op-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--spx-accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: op-spin 0.65s linear infinite;
  flex-shrink: 0;
}

@keyframes op-spin {
  to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════
   Responsive Adjustments
══════════════════════════════════════ */
@media (max-width: 600px) {
  .spx-wrap {
    padding: 12px 10px 32px;
  }
  .spx-main-card {
    padding: 14px 14px;
    gap: 10px;
  }
  .spx-header-row {
    gap: 12px;
  }
  .spx-img-frame {
    width: 85px;
    height: 85px;
    min-width: 85px;
    min-height: 85px;
  }
  .spx-title {
    font-size: 1.15rem;
  }
  .spx-price {
    font-size: 1.25rem;
  }
}
