/**
 * VW Email OTP Verification — Public Stylesheet
 * Scoped under .vwotp-* to avoid conflicts.
 * Uses CSS custom properties for theme-ability.
 *
 * @package Vendweave\VWOTP
 */

/* ──────────────────────────────────────────────
   Custom Properties
────────────────────────────────────────────── */
:root {
  --vwotp-accent:       #4f46e5;
  --vwotp-accent-dark:  #3730a3;
  --vwotp-accent-light: rgba(79, 70, 229, 0.12);
  --vwotp-success:      #16a34a;
  --vwotp-error:        #dc2626;
  --vwotp-warning:      #d97706;
  --vwotp-info:         #0369a1;
  --vwotp-text:         #1e1b4b;
  --vwotp-text-muted:   #64748b;
  --vwotp-border:       #e2e8f0;
  --vwotp-bg:           #ffffff;
  --vwotp-bg-card:      #f8faff;
  --vwotp-radius:       12px;
  --vwotp-radius-sm:    8px;
  --vwotp-shadow:       0 4px 24px rgba(79,70,229,0.10);
  --vwotp-shadow-lg:    0 8px 40px rgba(79,70,229,0.18);
  --vwotp-font:         'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --vwotp-transition:   0.22s cubic-bezier(0.4,0,0.2,1);
}

/* ──────────────────────────────────────────────
   Wrapper
────────────────────────────────────────────── */
.vwotp-step-wrap {
  --vwotp-accent: var(--vwotp-accent);
  font-family: var(--vwotp-font);
  margin-top: 16px;
  position: relative;
}

/* ──────────────────────────────────────────────
   Send OTP Step
────────────────────────────────────────────── */
.vwotp-send-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: vwotpFadeIn 0.3s ease;
  margin-bottom: 18px;
}

.vwotp-verify-wrap {
  margin-bottom: 18px;
}

/* ──────────────────────────────────────────────
   OTP Card
────────────────────────────────────────────── */
.vwotp-otp-card {
  background: var(--vwotp-bg);
  border: 1.5px solid var(--vwotp-border);
  border-radius: var(--vwotp-radius);
  box-shadow: var(--vwotp-shadow);
  padding: 28px 24px;
  animation: vwotpSlideUp 0.35s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  overflow: hidden;
}

.vwotp-otp-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--vwotp-accent), var(--vwotp-accent-dark));
  border-radius: var(--vwotp-radius) var(--vwotp-radius) 0 0;
}

.vwotp-otp-card__header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
}

.vwotp-otp-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--vwotp-accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--vwotp-accent);
}

.vwotp-otp-card__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--vwotp-text);
  margin: 0 0 4px;
  letter-spacing: -0.2px;
}

.vwotp-otp-card__subtitle {
  font-size: 13px;
  color: var(--vwotp-text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ──────────────────────────────────────────────
   OTP Digit Boxes
────────────────────────────────────────────── */
.vwotp-otp-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.vwotp-otp-input {
  width: 48px;
  height: 56px;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--vwotp-text);
  border: 2px solid var(--vwotp-border);
  border-radius: var(--vwotp-radius-sm);
  background: var(--vwotp-bg-card);
  outline: none;
  transition:
    border-color var(--vwotp-transition),
    box-shadow var(--vwotp-transition),
    transform var(--vwotp-transition),
    background var(--vwotp-transition);
  caret-color: var(--vwotp-accent);
}

.vwotp-otp-input:focus {
  border-color: var(--vwotp-accent);
  box-shadow: 0 0 0 3px var(--vwotp-accent-light);
  background: #fff;
  transform: translateY(-2px) scale(1.04);
}

.vwotp-otp-input:not(:placeholder-shown) {
  border-color: var(--vwotp-accent);
  background: var(--vwotp-accent-light);
  color: var(--vwotp-accent);
}

.vwotp-otp-input--error {
  border-color: var(--vwotp-error) !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.12) !important;
  animation: vwotpShake 0.4s ease;
}

.vwotp-otp-input--success {
  border-color: var(--vwotp-success) !important;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.12) !important;
}

/* Responsive: smaller boxes on mobile */
@media (max-width: 420px) {
  .vwotp-otp-input {
    width: 38px;
    height: 46px;
    font-size: 18px;
  }
  .vwotp-otp-inputs {
    gap: 6px;
  }
}

/* ──────────────────────────────────────────────
   Buttons
────────────────────────────────────────────── */
.vwotp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: none;
  border-radius: var(--vwotp-radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--vwotp-font);
  cursor: pointer;
  transition:
    background var(--vwotp-transition),
    box-shadow var(--vwotp-transition),
    transform var(--vwotp-transition),
    opacity var(--vwotp-transition);
  text-decoration: none;
  letter-spacing: 0.1px;
  color: #fff;
}

#vwotp-step-wrap .vwotp-btn,
#vwotp-step-wrap .vwotp-btn:hover:not(:disabled),
#vwotp-step-wrap .vwotp-btn:focus-visible,
#vwotp-step-wrap .vwotp-btn:active:not(:disabled) {
  color: #fff !important;
}

.vwotp-btn--primary {
  background: var(--vwotp-accent);
  color: #fff;
  box-shadow: 0 2px 12px rgba(79,70,229,0.25);
}

#vwotp-step-wrap .vwotp-btn--primary,
#vwotp-step-wrap .vwotp-btn--primary:hover:not(:disabled),
#vwotp-step-wrap .vwotp-btn--primary:focus-visible,
#vwotp-step-wrap .vwotp-btn--primary:active:not(:disabled) {
  color: #fff !important;
}

.vwotp-btn--primary:hover:not(:disabled) {
  background: var(--vwotp-accent-dark);
  box-shadow: 0 4px 20px rgba(79,70,229,0.35);
  transform: translateY(-1px);
  color: #fff;
}

.vwotp-btn--primary:hover:not(:disabled) .vwotp-btn__text,
.vwotp-btn--primary:hover:not(:disabled) .vwotp-btn__icon,
.vwotp-btn--primary:focus-visible .vwotp-btn__text,
.vwotp-btn--primary:focus-visible .vwotp-btn__icon,
.vwotp-btn .vwotp-btn__text,
.vwotp-btn .vwotp-btn__icon {
  color: inherit;
}

#vwotp-step-wrap .vwotp-btn__text,
#vwotp-step-wrap .vwotp-btn__icon,
#vwotp-step-wrap .vwotp-btn__icon svg {
  color: inherit !important;
  fill: currentColor;
  stroke: currentColor;
}

.vwotp-btn--primary:active:not(:disabled) {
  transform: translateY(0);
}

.vwotp-btn:hover:not(:disabled) {
  color: #fff;
}

.vwotp-btn--full {
  width: 100%;
  margin-bottom: 16px;
}

.vwotp-btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  transform: none;
}

.vwotp-btn__icon svg {
  pointer-events: none;
}

/* Loading spinner via border trick */
.vwotp-btn--loading .vwotp-btn__icon {
  display: none;
}

.vwotp-btn--loading::before {
  content: '';
  width: 15px;
  height: 15px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: vwotpSpin 0.65s linear infinite;
  flex-shrink: 0;
}

/* ──────────────────────────────────────────────
   Resend Row
────────────────────────────────────────────── */
.vwotp-resend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--vwotp-text-muted);
  flex-wrap: wrap;
  margin: 8px 0 14px;
  justify-content: space-between;
}

.vwotp-resend-text {
  color: var(--vwotp-text-muted);
  font-weight: 500;
}

.vwotp-btn-resend {
  background: rgba(79,70,229,0.08);
  border: 1px solid rgba(79,70,229,0.18);
  color: var(--vwotp-accent-dark);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 999px;
  transition: background var(--vwotp-transition), color var(--vwotp-transition), transform var(--vwotp-transition), opacity var(--vwotp-transition);
  font-family: var(--vwotp-font);
  line-height: 1;
  white-space: nowrap;
}

.vwotp-btn-resend:hover:not(:disabled) {
  background: rgba(79,70,229,0.14);
  color: var(--vwotp-accent-dark);
  transform: translateY(-1px);
}

.vwotp-btn-resend:disabled {
  background: rgba(100,116,139,0.08);
  border-color: rgba(100,116,139,0.12);
  color: var(--vwotp-text-muted);
  cursor: not-allowed;
}

.vwotp-resend-timer {
  font-size: 12px;
  font-weight: 600;
  color: var(--vwotp-accent);
  min-width: 36px;
}

/* ──────────────────────────────────────────────
   Change Email
────────────────────────────────────────────── */
.vwotp-change-email-row {
  text-align: center;
  margin-top: 6px;
}

.vwotp-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(3,105,161,0.08);
  border: 1px solid rgba(3,105,161,0.16);
  color: var(--vwotp-info);
  font-size: 12px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 999px;
  font-family: var(--vwotp-font);
  transition: background var(--vwotp-transition), color var(--vwotp-transition), transform var(--vwotp-transition);
  line-height: 1;
}

.vwotp-link-btn:hover {
  background: rgba(3,105,161,0.14);
  color: var(--vwotp-info);
  transform: translateY(-1px);
}

/* ──────────────────────────────────────────────
   Notices
────────────────────────────────────────────── */
.vwotp-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--vwotp-radius-sm);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 14px;
  animation: vwotpFadeIn 0.25s ease;
}

.vwotp-notice--info {
  background: rgba(3,105,161,0.08);
  color: var(--vwotp-info);
  border: 1px solid rgba(3,105,161,0.18);
}

.vwotp-notice--success {
  background: rgba(22,163,74,0.08);
  color: var(--vwotp-success);
  border: 1px solid rgba(22,163,74,0.18);
}

.vwotp-notice--error {
  background: rgba(220,38,38,0.08);
  color: var(--vwotp-error);
  border: 1px solid rgba(220,38,38,0.18);
}

/* ──────────────────────────────────────────────
   Verified Badge
────────────────────────────────────────────── */
.vwotp-verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(22,163,74,0.10);
  border: 1.5px solid rgba(22,163,74,0.25);
  border-radius: var(--vwotp-radius-sm);
  color: var(--vwotp-success);
  font-size: 14px;
  font-weight: 600;
  animation: vwotpScaleIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

/* ──────────────────────────────────────────────
   Honeypot (always hidden)
────────────────────────────────────────────── */
.vwotp-hp-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ──────────────────────────────────────────────
   Keyframe Animations
────────────────────────────────────────────── */
@keyframes vwotpFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes vwotpScaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes vwotpShake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}

@keyframes vwotpSpin {
  to { transform: rotate(360deg); }
}

/* ──────────────────────────────────────────────
   WooCommerce Context Overrides
────────────────────────────────────────────── */
.woocommerce-page .vwotp-otp-card {
  margin-top: 0;
}

/* ──────────────────────────────────────────────
   Dark Mode Support
────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --vwotp-bg:       #1e1b2e;
    --vwotp-bg-card:  #272440;
    --vwotp-border:   #3d3a5a;
    --vwotp-text:     #f0eeff;
    --vwotp-text-muted: #9490c4;
  }

  .vwotp-otp-input {
    color: var(--vwotp-text);
  }
}
