/* Export PDF Button and Modal */

.stack-header {
  position: relative;
  margin-bottom: 40px;
}

.stack-export-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: var(--font-sans, system-ui);
  font-size: 12px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.55);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 4px;
  cursor: pointer;
  transition: all 180ms ease;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.stack-export-btn:hover {
  color: rgba(0, 0, 0, 0.85);
  border-color: rgba(0, 0, 0, 0.20);
  background: rgba(0, 0, 0, 0.02);
}

.stack-export-btn svg {
  flex-shrink: 0;
  stroke: currentColor;
  width: 14px;
  height: 14px;
}

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

.export-modal.is-open {
  display: flex;
}

.export-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 200ms ease;
}

.export-modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.export-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.export-modal-title {
  font-family: var(--font-serif, 'Cormorant Garamond', serif);
  font-size: 24px;
  font-weight: 500;
  margin: 0;
  color: var(--color-text, #000);
}

.export-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text, #000);
  transition: all 150ms ease;
}

.export-modal-close:hover {
  background: rgba(0, 0, 0, 0.06);
}

.export-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.export-modal-description {
  font-family: var(--font-sans, system-ui);
  font-size: 14px;
  line-height: 1.6;
  color: rgba(0, 0, 0, 0.65);
  margin: 0 0 20px 0;
}

.export-layer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.export-layer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 8px;
  cursor: pointer;
  transition: all 150ms ease;
  background: #ffffff;
}

.export-layer-item:hover {
  border-color: rgba(0, 0, 0, 0.25);
  background: #fafafa;
}

.export-layer-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: #000000;
}

.export-layer-label {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.export-layer-name {
  font-family: var(--font-sans, system-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text, #000);
}

.export-layer-scores {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.export-score {
  font-family: var(--font-sans, system-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.04);
}

.export-score--us {
  color: var(--color-us, #2563eb);
}

.export-score--china {
  color: var(--color-china, #dc2626);
}

.export-modal-actions {
  display: flex;
  gap: 10px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.export-btn-secondary {
  flex: 1;
  padding: 8px 16px;
  font-family: var(--font-sans, system-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text, #000);
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  cursor: pointer;
  transition: all 150ms ease;
}

.export-btn-secondary:hover {
  border-color: rgba(0, 0, 0, 0.30);
  background: #fafafa;
}

.export-modal-footer {
  display: flex;
  gap: 12px;
  padding: 20px 24px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.export-btn-cancel {
  flex: 1;
  padding: 12px 20px;
  font-family: var(--font-sans, system-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text, #000);
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  cursor: pointer;
  transition: all 150ms ease;
}

.export-btn-cancel:hover {
  border-color: rgba(0, 0, 0, 0.30);
  background: #fafafa;
}

.export-btn-primary {
  flex: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-sans, system-ui);
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  background: #000000;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 150ms ease;
}

.export-btn-primary:hover {
  background: #1a1a1a;
}

.export-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.export-btn-primary svg {
  flex-shrink: 0;
  stroke: currentColor;
}

/* Responsive */
@media (max-width: 768px) {
  .stack-export-btn {
    position: static;
    margin: 20px auto 0;
    width: 100%;
    justify-content: center;
  }

  .export-modal-content {
    max-height: 95vh;
  }

  .export-layer-label {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}
