/* Gem Viewer Modal Styles */

.gem-viewer-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.gem-viewer-modal.active {
  display: block;
}

/* Persistent Header */
.gem-viewer-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  z-index: 10000;
}

/* Left Section: Back Button & Title */
.viewer-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.viewer-back-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.viewer-back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateX(-2px);
}

.viewer-title {
  color: white;
  font-size: 1.125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Center Section: Actions */
.viewer-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.viewer-action-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
  white-space: nowrap;
}

.viewer-action-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.viewer-action-btn.active {
  background: rgba(16, 185, 129, 0.8);
}

.viewer-action-btn .count {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* Right Section: External Link */
.viewer-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.viewer-external-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.viewer-external-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* iframe Container */
.gem-viewer-content {
  position: absolute;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
}

.gem-viewer-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

/* Loading State */
.viewer-loading {
  position: absolute;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #1f2937;
  color: white;
}

.viewer-loading.hidden {
  display: none;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 1rem;
  font-size: 1.125rem;
  color: #9CA3AF;
}

/* Blocked/Fallback State */
.viewer-blocked {
  position: absolute;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  color: white;
  padding: 2rem;
  text-align: center;
}

.viewer-blocked.active {
  display: flex;
}

.blocked-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.blocked-title {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.blocked-message {
  font-size: 1rem;
  color: #9CA3AF;
  margin-bottom: 2rem;
  max-width: 500px;
}

.blocked-open-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.blocked-open-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .gem-viewer-header {
    height: auto;
    flex-direction: column;
    padding: 0.75rem;
    gap: 0.5rem;
  }
  
  .viewer-left,
  .viewer-actions,
  .viewer-right {
    width: 100%;
    justify-content: center;
  }
  
  .viewer-title {
    font-size: 1rem;
  }
  
  .viewer-action-btn,
  .viewer-back-btn,
  .viewer-external-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
  }
  
  .gem-viewer-content {
    top: auto;
    height: calc(100vh - 140px);
  }
  
  .viewer-loading,
  .viewer-blocked {
    top: auto;
  }
}
