:root {
  --primary-color: #00bf8f;
  --error-color: #ff4757;
  --text-dark: #333;
  --text-light: #555;
  --modal-bg: linear-gradient(to bottom, #f1f3f4 50%, #ffffff 50%);
  --modal-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

html {
  scrollbar-gutter: stable;
}

body.modal-open {
  overflow: hidden;
  padding-right: calc(100vw - 100%);
}

.modal-container {
  display: none;
}

.info-icon,
.modal-close {
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: 0.3s ease;
  touch-action: manipulation;
}

.info-icon {
  background: var(--modal-bg);
  color: #373639;
  width: 24px;
  height: 24px;
  font-size: 14px;
  margin: 0;
}

.info-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.modal-close {
  background: var(--error-color);
  color: #fff;
  width: 32px;
  height: 32px;
  font-size: 18px;
  line-height: 32px;
  position: absolute;
  top: 15px;
  right: 15px;
}

.modal-close:hover {
  background: #ff6b81;
  transform: rotate(90deg);
}

.modal-close:focus {
  outline: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  padding: 1rem;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

@supports not (backdrop-filter: blur(8px)) {
  .modal-overlay {
    background: rgba(0, 0, 0, 0.9);
  }
}

.modal-content {
  background: #fff;
  color: var(--text-dark);
  border-radius: 16px;
  width: min(90%, 500px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  text-align: center;
  font-size: 1rem;
  line-height: 1.8;
  position: relative;
  direction: rtl;
  box-shadow: var(--modal-shadow);
  animation: modalSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideIn {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.modal-title,
.modal-text,
.juz-modal-text {
  background: var(--modal-bg);
  border: 1px solid #ccc;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.modal-title {
  font-size: 1.25rem;
  margin: 0 auto 1.25rem;
  color: var(--text-dark);
  font-weight: bold;
  padding: 0.75rem 1.5rem;
  display: inline-block;
  text-align: center;
  line-height: 1.9;
  width: fit-content;
  max-width: 90%;
}

.modal-text {
  padding: 1.25rem;
  color: var(--text-light);
  font-size: 1.0625rem;
  line-height: 1.9;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.modal-text p {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
}

.modal-text p strong {
  font-weight: normal;
  color: var(--text-light);
  margin-left: 0.625rem;
}

.modal-text p span {
  font-weight: bold;
  color: var(--text-dark);
}

.juz-modal-text {
  text-align: center;
  direction: rtl;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.juz-modal-text p {
  justify-content: center;
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.juz-modal-text p strong {
  font-weight: normal;
  color: var(--text-light);
  margin: 0 0.625rem;
}

.juz-modal-text p span {
  font-weight: bold;
  color: var(--text-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.circle-page {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  background-color: #373639;
  color: #fff;
  font-size: 1em;
  text-align: center;
  font-weight: normal;
  margin: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  user-select: none;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .modal-content {
    width: 90%;
    padding: 1.5rem;
    font-size: 0.9375rem;
  }

  .modal-title {
    font-size: 1rem;
    padding: 0.9375rem;
  }

  .modal-text {
    font-size: 1rem;
    padding: 0.9375rem;
  }
}

@media (max-width: 480px) {
  .modal-content {
    padding: 1.2rem;
  }

  .modal-title {
    font-size: 0.9375rem;
    padding: 0.75rem;
  }

  .modal-text {
    font-size: 0.9375rem;
    padding: 0.75rem;
  }
}