/* ================================
   PAGESPEED MODAL COMPONENT
   Shared modal + PageSpeed iframe styles
   Used on: our-work, website-builder-vs-managed-website
   ================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.modal-container {
  position: relative;
  z-index: 1;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 1.5rem;
  background: var(--badge-teal-bg);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--accent-primary);
  margin: 0;
}

.modal-close {
  width: 40px;
  height: 40px;
  background: var(--hero-gradient);
  border: none;
  color: var(--text-white);
  font-size: var(--text-2xl);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
  padding: 0;
  font-weight: var(--weight-bold);
}

.modal-close:hover {
  transform: rotate(90deg) scale(1.1);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

.pagespeed-modal-container {
  max-width: 1400px;
  width: 95%;
  max-height: 95vh;
}

.pagespeed-modal-loading {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.pagespeed-modal-spinner {
  width: 60px;
  height: 60px;
  margin: 0 auto 1.5rem;
  border: 4px solid var(--border-light);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: pagespeedSpin 1s linear infinite;
}

@keyframes pagespeedSpin {
  to {
    transform: rotate(360deg);
  }
}

.pagespeed-modal-loading-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--accent-primary);
  margin-bottom: 0.75rem;
}

.pagespeed-modal-loading-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.pagespeed-modal-info-box {
  max-width: 500px;
  margin: 0 auto;
  text-align: left;
  background: var(--badge-teal-bg);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.pagespeed-modal-info-title {
  color: var(--accent-primary);
  font-weight: var(--weight-semibold);
  margin-bottom: 0.75rem;
  font-size: var(--text-sm);
}

.pagespeed-modal-info-list {
  list-style: none;
  padding: 0;
  font-size: var(--text-sm);
  line-height: var(--line-height-relaxed);
  color: var(--text-secondary);
}

.pagespeed-modal-info-list li {
  margin-bottom: 0.5rem;
}

.pagespeed-modal-info-list li strong {
  color: var(--accent-primary);
}

.pagespeed-modal-info-footer {
  margin-top: 1rem;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-style: italic;
}

.pagespeed-modal-iframe {
  display: none;
  width: 100%;
  height: 80vh;
  border: none;
  border-radius: var(--radius-md);
}

.pagespeed-modal-iframe.active {
  display: block;
}

/* Score rings display */
.pagespeed-scores-display {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.pagespeed-score-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid currentColor;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.pagespeed-score-ring.score-green { color: #0cce6b; border-color: #0cce6b; }
.pagespeed-score-ring.score-orange { color: #ffa400; border-color: #ffa400; }
.pagespeed-score-ring.score-red { color: #ff4e42; border-color: #ff4e42; }

.pagespeed-score-number {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.pagespeed-score-label {
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.125rem;
  color: var(--text-secondary);
}

/* Direct PSI link section */
.pagespeed-direct-link {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--badge-teal-bg);
  border-radius: var(--radius-md);
  text-align: center;
}

.pagespeed-direct-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.pagespeed-url-copy {
  display: flex;
  gap: 0.5rem;
  max-width: 100%;
}

.pagespeed-url-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm, 4px);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: #EDEDF0;
  min-width: 0;
}

.pagespeed-direct-note {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 0.5rem;
}

/* Disclaimers section */
.pagespeed-disclaimers {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.pagespeed-disclaimers p {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.pagespeed-disclaimers p:last-child {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .modal-container {
    width: 95%;
    max-height: 90vh;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-title {
    font-size: var(--text-lg);
  }

  .modal-body {
    padding: 1rem;
  }

  .pagespeed-modal-container {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .pagespeed-modal-iframe {
    height: 70vh;
  }

  .pagespeed-score-ring {
    width: 60px;
    height: 60px;
  }

  .pagespeed-score-number {
    font-size: 1.25rem;
  }

  .pagespeed-url-copy {
    flex-direction: column;
  }
}
