/**
 * SMS OTP Login Styles
 * Compatible with PrestaShop 8.x & 9.x (Classic & Hummingbird themes)
 */

:root {
  --smsotp-primary: #24b9d7;
  --smsotp-primary-hover: #1ca5c1;
  --smsotp-primary-text: #ffffff;
  --smsotp-bg-card: #ffffff;
  --smsotp-text-main: #232323;
  --smsotp-text-muted: #6c757d;
  --smsotp-border: #e1e4e8;
  --smsotp-border-focus: #24b9d7;
  --smsotp-danger: #e3342f;
  --smsotp-success: #38c172;
  --smsotp-radius: 10px;
  --smsotp-box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* -------------------------------------------------------------
 * GİRİŞ SAYFASI BUTONU (HOOK)
 * ------------------------------------------------------------- */
.smsotp-login-trigger-wrap {
  margin-top: 18px;
  margin-bottom: 12px;
  text-align: center;
}

.smsotp-trigger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 20px;
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: var(--smsotp-radius);
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.smsotp-trigger-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
  text-decoration: none;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
}

.smsotp-trigger-icon {
  margin-right: 10px;
  display: inline-flex;
  align-items: center;
}

/* -------------------------------------------------------------
 * MODAL POPUP & BACKDROP
 * ------------------------------------------------------------- */
.smsotp-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2147483647 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 16px;
  box-sizing: border-box;
}

.smsotp-modal-backdrop.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.smsotp-modal-container {
  background: var(--smsotp-bg-card);
  border-radius: 14px;
  box-shadow: var(--smsotp-box-shadow);
  width: 100%;
  max-width: 440px;
  position: relative;
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.smsotp-modal-backdrop.is-active .smsotp-modal-container {
  transform: translateY(0) scale(1);
}

.smsotp-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  font-size: 1.1rem;
  line-height: 1;
  transition: all 0.2s ease;
  z-index: 10;
}

.smsotp-modal-close:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* -------------------------------------------------------------
 * KART VE FORM ELEMANLARI (Hem Modal Hem Sayfa İçin)
 * ------------------------------------------------------------- */
.smsotp-card-body {
  padding: 32px 28px;
}

.smsotp-header {
  text-align: center;
  margin-bottom: 24px;
}

.smsotp-badge-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #e0f2fe;
  color: #0284c7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.smsotp-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--smsotp-text-main);
  margin: 0 0 8px 0;
}

.smsotp-subtitle {
  font-size: 0.92rem;
  color: var(--smsotp-text-muted);
  line-height: 1.5;
  margin: 0;
}

.smsotp-phone-display {
  font-weight: 700;
  color: var(--smsotp-text-main);
  display: inline-block;
  direction: ltr;
}

/* Bildirim Kutuları */
.smsotp-alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}

.smsotp-alert-danger {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.smsotp-alert-success {
  background-color: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* Telefon Giriş Alanı */
.smsotp-phone-field {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--smsotp-border);
  border-radius: var(--smsotp-radius);
  background: #ffffff;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: text;
  position: relative;
  z-index: 5;
}

.smsotp-phone-field:focus-within {
  border-color: var(--smsotp-border-focus);
  box-shadow: 0 0 0 3px rgba(36, 185, 215, 0.2);
}

.smsotp-phone-prefix {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  background: #f8fafc;
  border-right: 1.5px solid var(--smsotp-border);
  font-weight: 600;
  font-size: 0.95rem;
  color: #334155;
  user-select: none;
}

.smsotp-phone-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 13px 14px !important;
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.05em;
  color: var(--smsotp-text-main) !important;
  background: transparent !important;
  width: 100%;
  pointer-events: auto !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  cursor: text !important;
}

/* -------------------------------------------------------------
 * 6 HANELİ MODERN OTP GİRİŞ KUTULARI
 * ------------------------------------------------------------- */
.smsotp-digits-wrap {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 20px 0 24px 0;
}

.smsotp-digit-input {
  width: 48px;
  height: 56px;
  border: 2px solid var(--smsotp-border);
  border-radius: 10px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--smsotp-text-main);
  background: #ffffff;
  transition: all 0.15s ease;
  outline: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  -moz-appearance: textfield;
  pointer-events: auto !important;
  user-select: text !important;
  cursor: text !important;
}

.smsotp-digit-input::-webkit-outer-spin-button,
.smsotp-digit-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.smsotp-digit-input:focus {
  border-color: var(--smsotp-border-focus);
  background: #f0fdfa;
  box-shadow: 0 0 0 3px rgba(36, 185, 215, 0.25);
  transform: translateY(-2px);
}

.smsotp-digit-input.has-value {
  border-color: #94a3b8;
  background: #f8fafc;
}

/* Hata durumunda titreme animasyonu */
@keyframes smsotp-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.smsotp-digits-wrap.shake {
  animation: smsotp-shake 0.4s ease;
}

.smsotp-digits-wrap.shake .smsotp-digit-input {
  border-color: var(--smsotp-danger);
  background-color: #fef2f2;
}

/* -------------------------------------------------------------
 * BUTONLAR VE İKİNCİL AKSİYONLAR
 * ------------------------------------------------------------- */
.smsotp-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--smsotp-radius);
  background: var(--smsotp-primary);
  color: var(--smsotp-primary-text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(36, 185, 215, 0.3);
}

.smsotp-submit-btn:hover:not(:disabled) {
  background: var(--smsotp-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(36, 185, 215, 0.4);
}

.smsotp-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* Yükleniyor Spinner */
.smsotp-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: smsotp-spin 0.6s linear infinite;
  display: inline-block;
}

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

/* Geri Sayım & Yeniden İste */
.smsotp-resend-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.smsotp-resend-btn {
  background: none;
  border: none;
  color: var(--smsotp-primary);
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  transition: color 0.15s;
}

.smsotp-resend-btn:disabled {
  color: #94a3b8;
  cursor: not-allowed;
  text-decoration: none;
}

.smsotp-countdown-badge {
  color: #64748b;
  font-weight: 500;
  font-size: 0.88rem;
}

.smsotp-footer-links {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #f1f5f9;
  text-align: center;
}

.smsotp-footer-links a {
  color: #64748b;
  font-size: 0.88rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.smsotp-footer-links a:hover {
  color: var(--smsotp-text-main);
  text-decoration: underline;
}

/* -------------------------------------------------------------
 * AYRI SAYFA TASARIMI (/smsotp/auth)
 * ------------------------------------------------------------- */
#smsotp-page-wrapper {
  max-width: 440px;
  margin: 30px auto;
  padding: 0 16px;
}

#smsotp-page-wrapper .smsotp-standalone-card {
  background: var(--smsotp-bg-card);
  border: 1px solid var(--smsotp-border);
  border-radius: 14px;
  box-shadow: var(--smsotp-box-shadow);
  overflow: hidden;
}

/* Mobil İyileştirmeler */
@media (max-width: 480px) {
  .smsotp-card-body {
    padding: 24px 18px;
  }
  .smsotp-digits-wrap {
    gap: 6px;
  }
  .smsotp-digit-input {
    width: 42px;
    height: 50px;
    font-size: 1.3rem;
  }
}
