/**
 * Live Copy Paste Feature Styles
 */

/* Opt-in bar (fixed) */
.nextsaas-live-copy-enable-bar {
  position: fixed;
  right: 50px;
  bottom: 110px;
  z-index: 100001;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  max-width: calc(100vw - 32px);
}

.nextsaas-live-copy-enable-bar.is-active {
  border-color: rgba(135, 230, 75, 0.55);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 0 0 2px rgba(135, 230, 75, 0.2);
}

.nextsaas-live-copy-enable-btn,
.nextsaas-live-copy-disable-btn {
  margin: 0;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.nextsaas-live-copy-enable-btn {
  background: #87e64b;
  color: #0b0b0b;
}

.nextsaas-live-copy-enable-btn:hover {
  background: #6fca3a;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.nextsaas-live-copy-disable-btn {
  background: #e3ffd1;
  color: #333;
}

.nextsaas-live-copy-disable-btn:hover {
  background: #e8e9ec;
}

.nextsaas-live-copy-enable-btn:focus-visible,
.nextsaas-live-copy-disable-btn:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.65);
  outline-offset: 2px;
}

.nextsaas-live-copy-enable-status {
  font-size: 12px;
  font-weight: 600;
  color: #1a7f2e;
  white-space: nowrap;
  margin-left: 10px;
}

.nextsaas-live-copy-enable-bar:not(.is-active) .nextsaas-live-copy-enable-status {
  display: none;
}

@media (max-width: 480px) {
  .nextsaas-live-copy-enable-bar {
    left: 12px;
    right: 12px;
    bottom: 12px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .nextsaas-live-copy-enable-status {
    width: 100%;
    text-align: center;
  }
}

/* Copyable Section - Highlight on hover */
.nextsaas-copyable-section {
  position: relative;
  transition: all 0.2s ease;
}

.nextsaas-copyable-section.nextsaas-section-hover {
  outline: 2px solid #87E64B;
  outline-offset: -2px;
  box-shadow: 0 0 0 2px rgba(135, 230, 75, 0.25);
}

/* Frontend Copy Button */
.nextsaas-live-copy-actions {
  position: absolute;
  top: 50px;
  right: 50px;
  z-index: 9999;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(-6px) scale(1);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.nextsaas-live-copy-actions.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.nextsaas-live-copy-btn,
.nextsaas-live-copy-docs-btn {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: #87E64B;
  color: #0b0b0b;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, filter 0.18s ease;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.14) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.nextsaas-live-copy-btn.copied {
  filter: saturate(1.05);
}

.nextsaas-live-copy-btn:hover {
  background: #6fca3a;
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14), 0 4px 10px rgba(0, 0, 0, 0.16);
}

.nextsaas-live-copy-docs-btn:hover {
  background: #6fca3a;
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14), 0 4px 10px rgba(0, 0, 0, 0.16);
}

.nextsaas-live-copy-btn:hover .nextsaas-live-copy-tooltip,
.nextsaas-live-copy-btn.copied .nextsaas-live-copy-tooltip,
.nextsaas-live-copy-btn.copying .nextsaas-live-copy-tooltip,
.nextsaas-live-copy-docs-btn:hover .nextsaas-live-copy-tooltip {
  opacity: 1;
  transform: translateX(-8px) scale(1);
  pointer-events: auto;
}

.nextsaas-live-copy-btn:active {
  transform: translateY(0) scale(0.99);
}

.nextsaas-live-copy-btn.copying {
  opacity: 0.85;
  cursor: wait;
}

.nextsaas-live-copy-btn.copying .nextsaas-live-copy-icon {
  animation: spin 0.9s linear infinite;
}

.nextsaas-live-copy-btn.copied {
  background: #6fca3a;
  animation: nextsaasCopiedPulse 420ms ease-out both;
}

.nextsaas-live-copy-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.nextsaas-live-copy-icon svg {
  width: 15px;
  height: 15px;
  display: block;
}

.nextsaas-live-copy-tooltip {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateX(-2px) scale(0.98);
  transform-origin: right center;
  translate: 0 -50%;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  backdrop-filter: blur(6px);
}

.nextsaas-live-copy-tooltip::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 100%;
  translate: 0 -50%;
  width: 0;
  height: 0;
  border: 7px solid transparent;
  border-left-color: rgba(30, 30, 30, 0.92);
}

.nextsaas-live-copy-btn:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.7);
  outline-offset: 2px;
}

.nextsaas-live-copy-docs-btn:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.7);
  outline-offset: 2px;
}

@keyframes nextsaasCopiedPulse {
  0% {
    transform: translateY(0) scale(1);
  }
  55% {
    transform: translateY(0) scale(1.06);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

/* Docs popup removed (docs icon links out). */

/* Hide button in Elementor editor */
.elementor-editor-active .nextsaas-live-copy-btn,
body.elementor-editor-preview .nextsaas-live-copy-btn {
  display: none !important;
}

/* Message notification */
.nextsaas-live-copy-message {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100000;
  padding: 12px 20px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 350px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.nextsaas-live-copy-message.show {
  transform: translateX(0);
  opacity: 1;
}

.nextsaas-live-copy-message-success {
  background: #6fca3a;
  color: #fff;
}

.nextsaas-live-copy-message-error {
  background: #2f6b10;
  color: #fff;
}

.nextsaas-live-copy-message-info {
  background: #87E64B;
  color: #fff;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .nextsaas-live-copy-btn {
    top: 10px;
    right: 10px;
    padding: 6px 10px;
    font-size: 11px;
  }

  .nextsaas-live-copy-text {
    display: none;
  }

  .nextsaas-live-copy-message {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

/* Editor Popup Styles */
#nextsaas-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
}

#nextsaas-popup-box {
  background: #fff;
  border-radius: 8px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.nextsaas-heading-container {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.nextsaas-spinner-container {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nextsaas-spinner {
  animation: spin 1s linear infinite;
}

.nextsaas-checkmark {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: #6fca3a;
}

.nextsaas-message-container {
  flex: 1;
}

#nextsaas-popup-message {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 5px;
}

#nextsaas-popup-submessage {
  display: block;
  font-size: 14px;
  color: #666;
}

.nextsaas-widget-list {
  margin-top: 20px;
}

.nextsaas-widget-count {
  margin-bottom: 15px;
  font-size: 14px;
  color: #666;
}

.nextsaas-widget-names {
  max-height: 200px;
  overflow-y: auto;
}

.nextsaas-widget-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.nextsaas-widget-row:last-child {
  border-bottom: none;
}

.nextsaas-widget-tick {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #6fca3a;
}

.nextsaas-widget-tick.loader {
  border: 2px solid #ddd;
  border-top-color: #87E64B;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  color: transparent;
}

.nextsaas-widget-name {
  font-size: 14px;
  color: #333;
}

.nextsaas-widget-note {
  margin-top: 15px;
  padding: 10px;
  background: #f0f0f1;
  border-radius: 4px;
  font-size: 12px;
  color: #666;
}

@media (max-width: 767px) {
  .nextsaas-live-copy-enable-bar {
    display: none;
  }
}
