/* =========================================================
   FixAlways — Website Preview Modal
========================================================= */

#site-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#site-modal.site-modal-hidden {
  display: none;
}

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

/* Backdrop */
.site-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
}

/* Container */
.site-modal-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  height: calc(100vh - 48px);
  max-height: 800px;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-elevated, #111827);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  animation: modalSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlide {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Header */
.site-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.site-modal-info {
  min-width: 0;
  flex: 1;
}

.site-modal-name {
  font-weight: 800;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.93);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-modal-url {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  display: block;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

.site-modal-url:hover {
  color: var(--accent, #f0a54a);
  text-decoration: none;
}

.site-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 16px;
  flex-shrink: 0;
}

.site-modal-external {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.2s;
  text-decoration: none;
}

.site-modal-external:hover {
  color: var(--accent, #f0a54a);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.site-modal-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 20px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.site-modal-close:hover {
  color: white;
  background: rgba(255, 80, 80, 0.15);
  border-color: rgba(255, 80, 80, 0.25);
}

/* Body / Iframe */
.site-modal-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.site-modal-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Loading */
.site-modal-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-elevated, #111827);
}

.site-modal-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent, #f0a54a);
  border-radius: 50%;
  animation: modalSpin 0.8s linear infinite;
}

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

/* Mobile */
@media (max-width: 720px) {
  #site-modal {
    padding: 8px;
  }

  .site-modal-container {
    border-radius: 14px;
    height: calc(100vh - 16px);
    max-height: none;
  }

  .site-modal-header {
    padding: 10px 14px;
  }

  .site-modal-name {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #site-modal,
  .site-modal-container,
  .site-modal-spinner {
    animation: none !important;
  }
}
