/**
 * @file
 * E-Campus Popup styles.
 */

.ecampus-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.ecampus-popup-overlay.is-show {
  display: flex;
  opacity: 1;
}
.ecampus-popup-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 680px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.35s ease;
}
/* Size presets — width on tablet+, image-cap tweak on phones (see media queries below). */
.ecampus-popup-overlay--small .ecampus-popup-modal { max-width: 480px; }
.ecampus-popup-overlay--medium .ecampus-popup-modal { max-width: 680px; }
.ecampus-popup-overlay--big .ecampus-popup-modal { max-width: 880px; }
.ecampus-popup-overlay.is-show .ecampus-popup-modal {
  transform: translateY(0) scale(1);
}
.ecampus-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #1e3a8a;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 2;
  transition: transform 0.2s, background 0.2s, color 0.2s;
}
.ecampus-popup-close:hover {
  background: #1e3a8a;
  color: #fff;
  transform: rotate(90deg);
}
.ecampus-popup-image {
  width: 100%;
  height: auto;
  display: block;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  background: #f1f5f9;
}
.ecampus-popup-body {
  padding: 32px 36px;
}
.ecampus-popup-badge {
  display: inline-block;
  background: #1e3a8a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
}
.ecampus-popup-title {
  color: #0f172a;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 12px;
}
.ecampus-popup-text {
  color: #334155;
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 20px;
}
.ecampus-popup-text p:last-child {
  margin-bottom: 0;
}
.ecampus-popup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}
.ecampus-popup-dismiss {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.ecampus-popup-dismiss input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #1e3a8a;
}
.ecampus-popup-btn {
  background: #1e3a8a;
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.ecampus-popup-btn:hover {
  background: #1e40af;
}
body.ecampus-popup-open {
  overflow: hidden;
}

/* Phones (iPhone SE / small Android) */
@media (max-width: 480px) {
  .ecampus-popup-overlay {
    padding: 10px;
    /* Anchor to top so a tall modal scrolls naturally instead of being clipped at center. */
    align-items: flex-start;
    padding-top: 20px;
  }
  .ecampus-popup-modal {
    /* dvh accounts for the iOS Safari URL bar; vh is the fallback. */
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
  }
  .ecampus-popup-image {
    /* Cap image so badge/title/text/button stay above the fold. Default = medium. */
    max-height: 38vh;
    object-fit: contain;
    background: #f1f5f9;
  }
  .ecampus-popup-overlay--small .ecampus-popup-image { max-height: 28vh; }
  .ecampus-popup-overlay--big .ecampus-popup-image { max-height: 44vh; }
  .ecampus-popup-body {
    padding: 18px 20px 20px;
  }
  .ecampus-popup-badge {
    font-size: 10px;
    padding: 4px 10px;
    margin-bottom: 10px;
  }
  .ecampus-popup-title {
    font-size: 17px;
    margin-bottom: 8px;
  }
  .ecampus-popup-text {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 14px;
  }
  .ecampus-popup-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-top: 12px;
  }
  .ecampus-popup-btn {
    width: 100%;
    padding: 12px 22px;
  }
  .ecampus-popup-dismiss {
    justify-content: center;
  }
  .ecampus-popup-close {
    /* Stay >= 36px to keep the tap target usable (WCAG 2.5.5). */
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
}

/* Very small phones (iPhone SE portrait, 375px and below) */
@media (max-width: 375px) {
  .ecampus-popup-image {
    max-height: 32vh;
  }
  .ecampus-popup-overlay--small .ecampus-popup-image { max-height: 24vh; }
  .ecampus-popup-overlay--big .ecampus-popup-image { max-height: 38vh; }
  .ecampus-popup-body {
    padding: 14px 16px 16px;
  }
  .ecampus-popup-title {
    font-size: 16px;
  }
  .ecampus-popup-text {
    font-size: 13.5px;
  }
}
