/* KEIFEI VERIFY - Verification UI & Install Prompt Styles v2.0.0 */

/* ===== Verification Result Container ===== */
.keifei-verify-root {
  max-width: 680px;
  margin: 3rem auto;
  padding: 2.5rem 1.5rem;
  text-align: center;
  font-family: inherit;
  animation: keifei-fade-in 0.3s ease-out;
}

@keyframes keifei-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Result Icon ===== */
.keifei-verify-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}

.keifei-verify-authentic .keifei-verify-icon { background: #e9f8ee; color: #16803d; }
.keifei-verify-invalid .keifei-verify-icon { background: #fff0ef; color: #c7352b; }
.keifei-verify-previous .keifei-verify-icon { background: #fff7e6; color: #a76b00; }
.keifei-verify-technical .keifei-verify-icon { background: #f1f3f5; color: #53606d; }

/* ===== Spinner ===== */
.keifei-verify-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #d9dee2;
  border-top-color: #16803d;
  border-radius: 50%;
  margin: 0 auto;
  animation: keifei-spin 0.8s linear infinite;
}

@keyframes keifei-spin { to { transform: rotate(360deg); } }

/* ===== Result Text ===== */
.keifei-verify-root h1 {
  margin: 1rem 0 0.5rem;
  font-size: 1.8rem;
  font-weight: 700;
  color: #263842;
}

.keifei-verify-root p {
  color: #5d6670;
  font-size: 1rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}

/* ===== Product Details ===== */
.keifei-verify-details {
  max-width: 480px;
  text-align: left;
  margin: 1.5rem auto 0;
  border-top: 1px solid #e8e8e8;
}

.keifei-verify-details .detail-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}

.keifei-verify-details .detail-row .label { color: #77858e; font-weight: 500; }
.keifei-verify-details .detail-row .value { color: #263842; font-weight: 600; text-align: right; }

/* ===== Retry Button ===== */
.keifei-verify-retry {
  margin-top: 1.5rem;
  border: 0;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  background: #16803d;
  color: white;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.keifei-verify-retry:hover { background: #136035; }

/* ===== KEIFEI VERIFY Badge ===== */
.keifei-verify-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2rem;
  padding: 0.5rem 1rem;
  background: #16803d;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 20px;
}

/* =========================================================================
   SCANNER UI - Custom Upload Interface (v2.0.0)
   ========================================================================= */

/* ===== Scanner Container ===== */
.keifei-scanner-container {
  max-width: 520px;
  margin: 2rem auto;
  padding: 2rem 1.5rem;
}

/* ===== Scanner Header ===== */
.keifei-scanner-header {
  text-align: center;
  margin-bottom: 2rem;
}

.keifei-scanner-header .eyebrow {
  color: #16803d;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}

.keifei-scanner-header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  font-weight: 700;
  color: #263842;
}

.keifei-scanner-header p {
  color: #5d6670;
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
}

/* ===== Upload Choice Buttons (Mobile: Camera / Gallery) ===== */
.keifei-scanner-choice {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.keifei-scanner-choice-desktop {
  align-items: center;
}

.keifei-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 1.25rem;
  border: 2px solid #e0e5ea;
  border-radius: 16px;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
  text-align: center;
  width: 100%;
  font: inherit;
}

.keifei-choice-btn:hover {
  border-color: #16803d;
  background: #f8fdf9;
}

.keifei-choice-btn:active {
  transform: scale(0.98);
}

.keifei-choice-btn-wide {
  max-width: 320px;
}

.keifei-choice-icon {
  font-size: 2rem;
  line-height: 1;
}

.keifei-choice-label {
  font-size: 1rem;
  font-weight: 600;
  color: #263842;
}

.keifei-choice-btn small {
  color: #77858e;
  font-size: 0.8rem;
  font-weight: 400;
}

/* ===== Image Preview ===== */
.keifei-scanner-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #f8fdf9;
  border: 1px solid #d4e9da;
  border-radius: 12px;
  margin-bottom: 1rem;
  animation: keifei-fade-in 0.3s ease-out;
}

.keifei-preview-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  background: #e8e8e8;
  flex-shrink: 0;
}

.keifei-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.keifei-preview-info {
  flex: 1;
  text-align: left;
}

.keifei-preview-info strong {
  display: block;
  font-size: 0.9rem;
  color: #263842;
  font-weight: 600;
  word-break: break-all;
}

.keifei-preview-info small {
  display: block;
  color: #77858e;
  font-size: 0.8rem;
  margin-top: 2px;
}

.keifei-preview-change {
  border: 1px solid #d0d5da;
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  background: white;
  color: #53606d;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.keifei-preview-change:hover { background: #f1f3f5; }

/* Inline preview (for original page inputs) */
.keifei-preview-inline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f8fdf9;
  border: 1px solid #d4e9da;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.keifei-preview-inline .keifei-preview-img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
}

/* ===== Divider ===== */
.keifei-divider {
  text-align: center;
  margin: 1.5rem 0;
  position: relative;
}

.keifei-divider span {
  display: inline-block;
  padding: 0 1rem;
  background: white;
  color: #a0aab2;
  font-size: 0.85rem;
  position: relative;
  z-index: 1;
}

.keifei-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e0e5ea;
}

/* ===== Token Form ===== */
.keifei-token-form {
  text-align: left;
}

.keifei-token-form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #263842;
  margin-bottom: 0.5rem;
}

.keifei-token-input-group {
  display: flex;
  gap: 0.5rem;
}

.keifei-token-input-group input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #d0d5da;
  border-radius: 8px;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.keifei-token-input-group input:focus {
  border-color: #16803d;
  box-shadow: 0 0 0 3px rgba(22, 128, 61, 0.1);
}

.keifei-token-input-group button {
  padding: 0.75rem 1.5rem;
  border: 0;
  border-radius: 8px;
  background: #16803d;
  color: white;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.keifei-token-input-group button:hover { background: #136035; }

/* ===== Submit Section ===== */
.keifei-submit-section {
  margin-top: 1.5rem;
  animation: keifei-fade-in 0.3s ease-out;
}

.keifei-submit-btn {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 1rem 2rem;
  border: 0;
  border-radius: 12px;
  background: #16803d;
  color: white;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(22, 128, 61, 0.3);
}

.keifei-submit-btn:hover { background: #136035; }
.keifei-submit-btn:active { transform: scale(0.98); }

/* =========================================================================
   COUNTDOWN INDICATOR (30s result persistence)
   ========================================================================= */
.keifei-verify-countdown {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999990;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: rgba(38, 56, 66, 0.9);
  color: white;
  border-radius: 24px;
  font-size: 0.8rem;
  font-weight: 500;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  animation: keifei-fade-in 0.3s ease-out;
}

.keifei-countdown-text strong {
  color: #4cd977;
  font-weight: 700;
}

.keifei-countdown-cancel {
  border: 0;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 16px;
  padding: 0.25rem 0.75rem;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
}

.keifei-countdown-cancel:hover { background: rgba(255, 255, 255, 0.3); }

/* =========================================================================
   INSTALL PROMPT (Bottom Sheet)
   ========================================================================= */
.keifei-install-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999998;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-out;
}

.keifei-install-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.keifei-install-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999999;
  background: #ffffff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  padding: 1.5rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom, 0));
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  max-width: 520px;
  margin: 0 auto;
}

.keifei-install-sheet.visible { transform: translateY(0); }

.keifei-install-handle {
  width: 40px;
  height: 4px;
  background: #d9dee2;
  border-radius: 2px;
  margin: 0 auto 1.25rem;
}

.keifei-install-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.keifei-install-icon {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: #16803d;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.keifei-install-icon img { width: 100%; height: 100%; object-fit: cover; }

.keifei-install-title { flex: 1; }

.keifei-install-title h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #263842;
  line-height: 1.3;
}

.keifei-install-title small {
  display: block;
  margin-top: 2px;
  color: #77858e;
  font-size: 0.8rem;
  font-weight: 500;
}

.keifei-install-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border: 0;
  background: #f1f3f5;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: #53606d;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  line-height: 1;
  padding: 0;
}

.keifei-install-close:hover { background: #e8e8e8; }

.keifei-install-body { margin-bottom: 1.25rem; }

.keifei-install-body p {
  color: #5d6670;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

.keifei-install-actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.keifei-install-btn-primary {
  border: 0;
  border-radius: 12px;
  padding: 0.9rem 1.5rem;
  background: #16803d;
  color: white;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.keifei-install-btn-primary:hover { background: #136035; }
.keifei-install-btn-primary:active { transform: scale(0.98); }

.keifei-install-btn-secondary {
  border: 0;
  background: transparent;
  color: #77858e;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.2s;
}

.keifei-install-btn-secondary:hover { color: #53606d; }

.keifei-install-instructions {
  display: none;
  background: #f8f9fa;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.keifei-install-instructions.visible {
  display: block;
  animation: keifei-fade-in 0.3s ease-out;
}

.keifei-install-instructions h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #263842;
}

.keifei-install-instructions ol {
  margin: 0;
  padding-left: 1.5rem;
  color: #5d6670;
  font-size: 0.85rem;
  line-height: 1.6;
}

.keifei-install-instructions li { margin-bottom: 0.5rem; }

/* ===== Mobile Responsive ===== */
@media (max-width: 480px) {
  .keifei-verify-root {
    margin: 1.5rem auto;
    padding: 1.5rem 1rem;
  }

  .keifei-verify-root h1 { font-size: 1.5rem; }

  .keifei-scanner-container {
    margin: 1rem auto;
    padding: 1.5rem 1rem;
  }

  .keifei-scanner-header h1 { font-size: 1.4rem; }

  .keifei-choice-btn { padding: 1.25rem 1rem; }

  .keifei-install-sheet {
    padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0));
  }

  .keifei-install-icon { width: 52px; height: 52px; }
  .keifei-install-title h2 { font-size: 1.1rem; }

  .keifei-verify-countdown {
    bottom: 0.5rem;
    font-size: 0.75rem;
    padding: 0.4rem 0.875rem;
  }
}

/* ===== Desktop ===== */
@media (min-width: 768px) {
  .keifei-install-sheet {
    border-radius: 20px;
    bottom: 1.5rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(120%);
    max-width: 420px;
  }

  .keifei-install-sheet.visible {
    transform: translateX(-50%) translateY(0);
  }
}
