/* modal.css */
/* Premium dark-mode styling matching the Ledger brand aesthetic */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 99999;
  display: none; /* Controlled by JS */
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: #09090b;
  color: #fafafa;
  width: 92%;
  max-width: 650px;
  max-height: 90vh;
  border: 1px solid #27272a;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow-y: auto;
  font-family: 'Inter', sans-serif;
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: #71717a;
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}

.modal-close-btn:hover {
  color: #ffffff;
}

/* Header */
.modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid #27272a;
  padding-bottom: 20px;
}

.modal-logo {
  height: 32px;
  width: auto;
  filter: invert(1); /* Ensure it's white in dark mode */
}

.modal-header h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  color: #ffffff;
}

/* Stepper progress */
.modal-progress {
  display: flex;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 8px;
}

.progress-step {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #71717a;
  border-bottom: 2px solid #27272a;
  transition: all 0.3s ease;
}

.progress-step.active {
  color: #ffffff;
  border-bottom-color: #a855f7; /* Purple accent for CL Card */
}

.progress-step.completed {
  color: #a855f7;
  border-bottom-color: #a855f7;
}

/* Steps content */
.step-container {
  display: none;
}

.step-container.active {
  display: block;
  animation: fadeIn 0.4s ease-out;
}

.step-instruction {
  font-size: 1rem;
  color: #a1a1aa;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Custom button */
.modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: #ffffff;
  color: #000000;
  border: none;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 16px;
}

.modal-btn:hover {
  background: #e4e4e7;
  transform: translateY(-1px);
}

.modal-btn.secondary {
  background: transparent;
  color: #ffffff;
  border: 1px solid #3f3f46;
}

.modal-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: #71717a;
}

.modal-btn:disabled {
  background: #27272a;
  color: #71717a;
  cursor: not-allowed;
  transform: none;
}

/* Step 1: Scanner styles */
.scanner-container {
  width: 100%;
  height: 280px;
  background: #000000;
  border: 1px solid #27272a;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

#qr-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-frame {
  position: absolute;
  width: 180px;
  height: 180px;
  border: 2px dashed rgba(168, 85, 247, 0.6);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.scanner-laser {
  position: absolute;
  width: 180px;
  height: 2px;
  background: #a855f7;
  box-shadow: 0 0 8px 2px rgba(168, 85, 247, 0.8);
  animation: scan 2.5s infinite ease-in-out;
  pointer-events: none;
}

.scanner-status {
  text-align: center;
  font-size: 0.9rem;
  color: #a1a1aa;
  margin-top: 8px;
}

/* Step 2: Photo capture styles */
.photo-container {
  width: 100%;
  height: 280px;
  background: #000000;
  border: 1px solid #27272a;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

#photo-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#photo-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
}

.card-outline-guide {
  position: absolute;
  width: 85%;
  height: 55%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  z-index: 2;
}

.photo-controls {
  display: flex;
  gap: 12px;
}

/* Step 3: Seed Words Form */
.seed-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

@media (max-width: 600px) {
  .seed-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.word-input-container {
  display: flex;
  align-items: center;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 8px;
  padding: 6px 12px;
  transition: border-color 0.2s;
}

.word-input-container:focus-within {
  border-color: #a855f7;
}

.word-num {
  font-size: 0.8rem;
  font-weight: 600;
  color: #71717a;
  width: 24px;
}

.word-input {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 0.95rem;
  font-family: inherit;
  width: 100%;
  outline: none;
}

.form-error {
  color: #ef4444;
  font-size: 0.9rem;
  margin-bottom: 12px;
  text-align: center;
  height: 20px;
}

/* Success layout */
.success-icon {
  text-align: center;
  margin: 32px 0 24px;
}

.success-icon svg {
  width: 80px;
  height: 80px;
  stroke: #a855f7;
  stroke-width: 2;
}

.checkmark-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 2;
  stroke-miterlimit: 10;
  stroke: #a855f7;
  fill: none;
  animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  stroke: #ffffff;
  animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

#step-success-content {
  text-align: center;
}

#step-success-content h4 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: #ffffff;
}

#step-success-content p {
  color: #a1a1aa;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Helper Utilities */
.hidden {
  display: none !important;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scan {
  0%, 100% { top: 50px; }
  50% { top: 230px; }
}

@keyframes stroke {
  100% { stroke-dashoffset: 0; }
}

/* Mobile Optimization overrides */
@media (max-width: 600px) {
  .modal-content {
    padding: 24px 16px;
    width: 95%;
    border-radius: 16px;
  }
  .modal-header {
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
  }
  .modal-header h3 {
    font-size: 1.2rem;
  }
  .modal-logo {
    height: 24px;
  }
  .modal-progress {
    margin-bottom: 20px;
  }
  .progress-step {
    font-size: 0.75rem;
    padding: 6px 2px;
  }
  .scanner-container, .photo-container {
    height: 200px;
  }
  .scanner-frame, .scanner-laser {
    width: 140px;
    height: 140px;
  }
  @keyframes scan {
    0%, 100% { top: 30px; }
    50% { top: 170px; }
  }
  .seed-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .word-input-container {
    padding: 4px 8px;
  }
  .word-input {
    font-size: 0.85rem;
  }
}

