#modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#product-modal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#product-modal.open {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.95) translateY(15px);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
}
#product-modal.open .modal-box {
  transform: scale(1) translateY(0);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--fg-muted);
  transition: background var(--t-fast), color var(--t-fast);
}
[dir="rtl"] .modal-close {
  right: auto;
  left: 16px;
}
.modal-close:hover {
  background: var(--accent);
  color: var(--white);
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 0;
}

@media (max-width: 768px) {
  .modal-body {
    grid-template-columns: 1fr;
  }
}

.modal-left {
  position: relative;
  background: #0d0d0f;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-img {
  width: 100%;
  height: 100%;
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  overflow: hidden;
  position: relative;
}

.modal-img .modal-img-src {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-right {
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-cat {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.modal-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--fg);
  line-height: 1.25;
}

.modal-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--fg-muted);
}
.modal-rating .stars { color: var(--gold); }

.modal-price-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.modal-price {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.9rem;
  color: var(--accent);
  letter-spacing: 0.04em;
  line-height: 1;
}

.modal-price-orig {
  font-size: 1rem;
  color: var(--fg-muted);
  text-decoration: line-through;
}

.modal-cod-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #25D366;
  background: rgba(37, 211, 102, 0.1);
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid rgba(37, 211, 102, 0.25);
}

.modal-desc {
  font-size: 0.86rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

.modal-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.spec-pill {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 4px 10px;
  border-radius: 100px;
}

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

.modal-qty {
  display: flex;
  align-items: center;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}

.qty-btn {
  background: none;
  border: none;
  color: var(--fg);
  width: 34px;
  height: 38px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background var(--t-fast);
}
.qty-btn:hover { background: rgba(255,255,255,0.08); }

.qty-value {
  width: 28px;
  text-align: center;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--fg);
}

.related-section {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.related-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  margin-bottom: 10px;
}

.related-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.related-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 6px;
  cursor: pointer;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.related-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.related-card-img {
  height: 60px;
  border-radius: var(--r-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.related-card-img .related-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-card-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--fg);
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.related-card-price {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent);
}

#ef-channel-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
#ef-channel-modal.open {
  display: flex;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.ef-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 15, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ef-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface-1, #12151c);
  color: var(--text-1, #ffffff);
  border: 1px solid rgba(37, 211, 102, 0.4);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 35px rgba(37, 211, 102, 0.2);
  padding: 32px 28px 24px;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}
#ef-channel-modal.open .ef-modal-dialog {
  transform: scale(1) translateY(0);
}
[data-theme="light"] .ef-modal-dialog {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(37, 211, 102, 0.45);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 0 30px rgba(37, 211, 102, 0.15);
}
.ef-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-2, #94a3b8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
[dir="rtl"] .ef-modal-close {
  right: auto;
  left: 16px;
}
[data-theme="light"] .ef-modal-close {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #64748b;
}
.ef-modal-close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  transform: rotate(90deg);
}
.ef-modal-header {
  text-align: center;
  margin-bottom: 20px;
}
.ef-modal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 211, 102, 0.12);
  border: 1px solid rgba(37, 211, 102, 0.35);
  color: #25D366;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 12px;
}
.ef-modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 8px;
  line-height: 1.25;
  color: var(--text-1, #ffffff);
}
[data-theme="light"] .ef-modal-title {
  color: #0f172a;
}
.ef-modal-subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  color: #25D366;
  margin: 0;
  line-height: 1.4;
}
.ef-modal-card {
  background: var(--surface-2, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--line-1, rgba(255, 255, 255, 0.08));
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
[data-theme="light"] .ef-modal-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.ef-modal-desc {
  font-size: 0.88rem;
  color: var(--text-2, #94a3b8);
  line-height: 1.5;
  margin-bottom: 14px;
}
[data-theme="light"] .ef-modal-desc {
  color: #475569;
}
.ef-modal-perks {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ef-modal-perks li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-1, #e2e8f0);
}
[data-theme="light"] .ef-modal-perks li {
  color: #1e293b;
}
.ef-perk-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(37, 211, 102, 0.15);
  flex-shrink: 0;
}
.ef-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.ef-modal-btn-channel {
  background: #25D366;
  color: #ffffff !important;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 22px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.ef-modal-btn-channel:hover {
  background: #20ba56;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(37, 211, 102, 0.5);
  color: #ffffff !important;
}
.ef-modal-btn-chat {
  background: transparent;
  color: var(--text-1, #ffffff);
  border: 1px solid rgba(37, 211, 102, 0.45);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
}
[data-theme="light"] .ef-modal-btn-chat {
  color: #0f172a;
}
.ef-modal-btn-chat:hover {
  background: rgba(37, 211, 102, 0.1);
  border-color: #25D366;
}
.ef-modal-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-3, #64748b);
  text-align: center;
  line-height: 1.4;
}
[dir="rtl"] #ef-channel-modal {
  text-align: right;
}
