.mgd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 99998;
}

.mgd-modal {
  position: fixed;
  z-index: 99999;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  width: 900px;
  max-width: 95%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  border-radius: 14px;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.mgd-modal .mgd-close {
  position: absolute;
  right: 14px;
  top: 10px;
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.mgd-modal .mgd-modal-inner {
  display: grid;
  grid-template-columns: 1fr 2fr; /* 1/3 و 2/3 */
  gap: 0;
  align-items: stretch;
  min-height: 420px;
}

.mgd-modal .mgd-left {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fafafa;
  padding: 20px;
}

.mgd-modal .mgd-left img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* تحافظ على نسبة الأبعاد */
  margin: auto;
}

.mgd-modal .mgd-right {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mgd-modal h2 {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1.3;
  color: #222;
}

.mgd-modal #mgd-modal-content {
  flex: 1;
  overflow-y: auto;
  color: #333;
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.mgd-modal .mgd-actions {
  text-align: right;
}

.mgd-modal .mgd-download {
  background: #29235C;
  color: #fff;
  border: 0;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.25s ease;
}
.mgd-modal .mgd-download:hover {
  background: #1e1a4b;
}

.mgd-card {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  align-items: start;
  margin: 18px 0;
}
.mgd-card .mgd-thumb img {
  object-fit: cover;
  border-radius: 8px;
}
.mgd-card .mgd-thumb--empty {
  width: 160px;
  height: 120px;
  border-radius: 8px;
  background: #f0f0f0;
}
.mgd-card .mgd-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}
.mgd-card .mgd-open {
  background: #E30613;
  color: #fff;
  border: 0;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}
.mgd-card .mgd-open:hover {
  background: #c10510;
}

@media (max-width: 768px) {
  .mgd-modal .mgd-modal-inner {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .mgd-modal .mgd-left {
    min-height: 240px;
  }
  .mgd-modal .mgd-right {
    padding: 22px;
  }
}
