/**
 * Curious Check - Modern Auth
 * In-page centered card design
 */

/* === INLINE FORM ERRORS (AJAX) === */
.cc-form-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 3px solid #ef4444;
  color: #991b1b;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 16px;
  animation: ccSlideDown 0.25s ease;
}

.cc-form-error strong {
  font-weight: 600;
}

@keyframes ccSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === WRAPPER === */
.cc-auth {
  --a-primary: #12715B;
  --a-primary-h: #0e5a49;
  --a-accent: #33D886;
  --a-text: #0f172a;
  --a-text2: #475569;
  --a-muted: #94a3b8;
  --a-border: #e2e8f0;
  --a-bg: #f8fafc;
  --a-white: #ffffff;
  --a-r: 10px;

  padding: 48px 20px 64px;
  display: flex;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.cc-auth-inner {
  width: 100%;
  max-width: 440px;
}

/* === HEADER === */
.cc-auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.cc-auth-logo {
  height: 36px;
  width: auto;
}

/* === CHECKOUT NOTICE === */
.cc-auth-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border: 1px solid #bbf7d0;
  border-radius: var(--a-r);
  font-size: 13px;
  color: var(--a-primary);
  font-weight: 500;
  margin-bottom: 20px;
}

.cc-auth-notice svg {
  flex-shrink: 0;
  color: var(--a-accent);
}

/* === CARD === */
.cc-auth-card {
  background: var(--a-white);
  border: 1px solid var(--a-border);
  border-radius: 16px;
  box-shadow:
    0 1px 3px rgba(0,0,0,0.04),
    0 6px 24px rgba(0,0,0,0.04);
  overflow: hidden;
}

/* === TABS === */
.cc-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--a-border);
  background: var(--a-bg);
}

.cc-auth-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 15px 16px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--a-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  position: relative;
}

.cc-auth-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: transparent;
  border-radius: 2px 2px 0 0;
  transition: all 0.2s;
}

.cc-auth-tab:hover {
  color: var(--a-text2);
}

.cc-auth-tab.active {
  color: var(--a-primary);
  background: var(--a-white);
}

.cc-auth-tab.active::after {
  background: var(--a-primary);
}

.cc-auth-tab svg {
  opacity: 0.5;
  transition: opacity 0.2s;
}

.cc-auth-tab.active svg {
  opacity: 1;
}

/* === PANELS === */
.cc-auth-panel {
  display: none;
  padding: 28px 28px 24px;
}

.cc-auth-panel.active {
  display: block;
  animation: ccFade 0.2s ease;
}

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

/* === FIELDS === */
.cc-field {
  margin-bottom: 18px;
}

.cc-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--a-text);
  margin-bottom: 6px;
}

.cc-field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.cc-field-row label {
  margin-bottom: 0;
}

.cc-link-sm {
  font-size: 12px;
  color: var(--a-primary);
  text-decoration: none;
  font-weight: 500;
}

.cc-link-sm:hover {
  text-decoration: underline;
}

/* Text inputs */
.cc-auth-card input.input-text,
.cc-auth-card input[type="text"],
.cc-auth-card input[type="email"] {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--a-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--a-text);
  background: var(--a-white);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.cc-auth-card input.input-text:focus,
.cc-auth-card input[type="text"]:focus,
.cc-auth-card input[type="email"]:focus {
  border-color: var(--a-primary);
  box-shadow: 0 0 0 3px rgba(18,113,91,0.08);
}

.cc-auth-card input::placeholder {
  color: var(--a-muted);
}

/* === PASSWORD FIELD ===
   WooCommerce wraps <input type="password"> in <span class="password-input">.
   We handle both the pre-wrap and post-wrap states.
*/
.cc-password-wrap {
  position: relative;
}

/* Before WooCommerce wraps it */
.cc-password-wrap > input[type="password"],
.cc-password-wrap > input[type="text"] {
  width: 100%;
  padding: 11px 44px 11px 14px;
  border: 1.5px solid var(--a-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--a-text);
  background: var(--a-white);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

/* After WooCommerce wraps it in <span class="password-input"> */
.cc-password-wrap .password-input {
  display: block !important;
  position: relative;
}

.cc-password-wrap .password-input input[type="password"],
.cc-password-wrap .password-input input[type="text"] {
  width: 100%;
  padding: 11px 44px 11px 14px;
  border: 1.5px solid var(--a-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--a-text);
  background: var(--a-white);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.cc-password-wrap input:focus,
.cc-password-wrap .password-input input:focus {
  border-color: var(--a-primary);
  box-shadow: 0 0 0 3px rgba(18,113,91,0.08);
}

.cc-password-wrap input::placeholder,
.cc-password-wrap .password-input input::placeholder {
  color: var(--a-muted);
}

/* Show/hide toggle */
.cc-password-wrap .show-password-input {
  position: absolute !important;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none !important;
  border: none !important;
  padding: 2px !important;
  cursor: pointer;
  color: var(--a-muted);
  z-index: 2;
}

.cc-password-wrap .show-password-input:hover {
  color: var(--a-text2);
}

/* Password strength meter */
.cc-auth-card .woocommerce-password-strength {
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.02em;
}

.woocommerce-password-strength.short  { background:#fef2f2; color:#b91c1c; border:1px solid #fecaca; }
.woocommerce-password-strength.bad    { background:#fff7ed; color:#c2410c; border:1px solid #fed7aa; }
.woocommerce-password-strength.good   { background:#fefce8; color:#a16207; border:1px solid #fde68a; }
.woocommerce-password-strength.strong { background:#ecfdf5; color:#047857; border:1px solid #a7f3d0; }

/* Password hint */
.cc-auth-card .woocommerce-password-hint,
.cc-auth-card small.woocommerce-password-hint {
  display: block;
  font-size: 11px;
  color: var(--a-muted);
  margin-top: 6px;
  line-height: 1.5;
}

/* Auto-generate password message */
.cc-auto-pw {
  font-size: 13px;
  color: var(--a-text2);
  background: #f0fdf4;
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 3px solid var(--a-primary);
  margin: 0 0 18px;
}

/* === CHECKBOX === */
.cc-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--a-text2);
  cursor: pointer;
  margin-bottom: 20px;
  user-select: none;
}

.cc-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--a-primary);
  cursor: pointer;
  margin: 0;
}

/* === SUBMIT BUTTON === */
.cc-btn {
  width: 100%;
  padding: 12px;
  background: var(--a-primary);
  color: var(--a-white);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(18,113,91,0.2);
}

.cc-btn:hover {
  background: var(--a-primary-h);
  box-shadow: 0 4px 12px rgba(18,113,91,0.25);
  transform: translateY(-1px);
}

.cc-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(18,113,91,0.2);
}

/* === ALT LINK === */
.cc-auth-alt {
  text-align: center;
  font-size: 13px;
  color: var(--a-muted);
  margin: 20px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--a-border);
}

.cc-link {
  background: none;
  border: none;
  color: var(--a-primary);
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  font-family: inherit;
}

.cc-link:hover {
  text-decoration: underline;
}

/* === TRUST ROW === */
.cc-auth-trust {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.cc-trust-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: var(--a-white);
  border: 1px solid var(--a-border);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  color: var(--a-text2);
}

.cc-trust-pill svg {
  color: var(--a-primary);
}

/* ============================
   WOOCOMMERCE OVERRIDES
   ============================ */

/* Privacy policy text injected by WooCommerce */
.cc-auth-card .woocommerce-privacy-policy-text {
  font-size: 12px;
  color: var(--a-muted);
  line-height: 1.6;
  margin: 14px 0 18px;
  padding: 12px 14px;
  background: var(--a-bg);
  border-radius: 8px;
  border: 1px solid var(--a-border);
}

.cc-auth-card .woocommerce-privacy-policy-text a {
  color: var(--a-primary);
  text-decoration: none;
  font-weight: 500;
}

.cc-auth-card .woocommerce-privacy-policy-text a:hover {
  text-decoration: underline;
}

/* Notices inside the form container */
.cc-auth-inner .woocommerce-message,
.cc-auth-inner .woocommerce-info,
.cc-auth-inner .woocommerce-error {
  padding: 12px 16px;
  border-radius: var(--a-r);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
  border: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.cc-auth-inner .woocommerce-message {
  background: #ecfdf5;
  color: var(--a-primary);
  border-left: 3px solid var(--a-primary);
}

.cc-auth-inner .woocommerce-info {
  background: #eff6ff;
  color: #1e40af;
  border-left: 3px solid #3b82f6;
}

.cc-auth-inner .woocommerce-error {
  background: #fef2f2;
  color: #991b1b;
  border-left: 3px solid #ef4444;
}

.cc-auth-inner .woocommerce-error li {
  list-style: none;
  margin: 0;
}

/* Hide WC default remember me / lost password (we have our own) */
.cc-auth .woocommerce-form-login__rememberme,
.cc-auth .woocommerce-form .lost_password {
  display: none;
}

/* WC form row resets */
.cc-auth-card .form-row {
  margin: 0 0 18px;
  padding: 0;
}

.cc-auth-card .form-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--a-text);
  margin-bottom: 6px;
}

.cc-auth-card .form-row .input-text {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--a-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--a-text);
  background: var(--a-white);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.cc-auth-card .form-row .input-text:focus {
  border-color: var(--a-primary);
  box-shadow: 0 0 0 3px rgba(18,113,91,0.08);
}

/* === THEME INTEGRATION ===
   Remove extra page padding so the card sits nicely. 
   Keep header & footer visible. */
.woocommerce-account:not(.logged-in) .tg-page-area {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.woocommerce-account:not(.logged-in) .breadcrumbs,
.woocommerce-account:not(.logged-in) .breadcrumbs.panel {
  display: none !important;
}

/* Remove page title on auth page */
.woocommerce-account:not(.logged-in) .page-title,
.woocommerce-account:not(.logged-in) .entry-title,
.woocommerce-account:not(.logged-in) header.entry-header {
  display: none !important;
}

/* === SOCIAL LOGIN / GOOGLE BUTTON === */
.cc-social-login {
  display: flex;
  justify-content: center;
  margin-bottom: 0;
}

.cc-social-login .g_id_signin {
  width: 100%;
}

.cc-social-login .g_id_signin > div {
  width: 100% !important;
}

/* === AUTH DIVIDER === */
.cc-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.cc-auth-divider::before,
.cc-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--a-border);
}

.cc-auth-divider span {
  font-size: 12px;
  color: var(--a-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* === OTP PANEL === */
#cc-otp-panel {
  padding: 28px 28px 24px;
}

.cc-otp-header {
  text-align: center;
  margin-bottom: 28px;
}

.cc-otp-header svg {
  color: var(--a-primary);
  margin-bottom: 12px;
}

.cc-otp-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--a-text);
  margin: 0 0 8px;
}

.cc-otp-header p {
  font-size: 13px;
  color: var(--a-text2);
  margin: 0;
  line-height: 1.5;
}

.cc-otp-email {
  color: var(--a-primary);
  word-break: break-all;
}

.cc-otp-digits {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.cc-otp-digit {
  width: 46px;
  height: 54px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--a-text);
  border: 1.5px solid var(--a-border);
  border-radius: 10px;
  background: var(--a-white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  caret-color: var(--a-primary);
}

.cc-otp-digit:focus {
  border-color: var(--a-primary);
  box-shadow: 0 0 0 3px rgba(18, 113, 91, 0.08);
}

.cc-otp-message {
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  min-height: 20px;
  margin-bottom: 16px;
}

.cc-otp-success {
  color: var(--a-primary);
}

.cc-otp-error {
  color: #b91c1c;
}

.cc-otp-verify-btn {
  width: 100%;
  margin-bottom: 16px;
}

.cc-otp-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cc-otp-resend-btn,
.cc-otp-back-btn {
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 0;
  transition: color 0.15s;
}

.cc-otp-resend-btn {
  color: var(--a-primary);
}

.cc-otp-resend-btn:hover:not(:disabled) {
  text-decoration: underline;
}

.cc-otp-resend-btn:disabled {
  color: var(--a-muted);
  cursor: not-allowed;
}

.cc-otp-timer {
  font-size: 12px;
  color: var(--a-muted);
  margin-left: 4px;
}

.cc-otp-back-btn {
  color: var(--a-muted);
}

.cc-otp-back-btn:hover {
  color: var(--a-text2);
}

/* OTP shake animation for incorrect code */
@keyframes ccShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.cc-shake {
  animation: ccShake 0.4s ease;
}

/* === FCRA MODAL === */
.cc-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: ccModalFadeIn 0.2s ease;
}

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

.cc-modal {
  background: var(--a-white, #ffffff);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  max-width: 480px;
  width: 100%;
  overflow: hidden;
  animation: ccModalSlideUp 0.25s ease;
}

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

.cc-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 28px;
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border-bottom: 1px solid #bbf7d0;
}

.cc-modal-header svg {
  color: #12715B;
  flex-shrink: 0;
}

.cc-modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.cc-modal-body {
  padding: 24px 28px;
}

.cc-modal-body p {
  font-size: 14px;
  line-height: 1.7;
  color: #374151;
  margin: 0;
  font-style: italic;
}

.cc-modal-body a {
  color: #12715B;
  font-weight: 600;
  text-decoration: none;
}

.cc-modal-body a:hover {
  text-decoration: underline;
}

.cc-modal-actions {
  display: flex;
  gap: 12px;
  padding: 20px 28px;
  border-top: 1px solid #e2e8f0;
  justify-content: flex-end;
}

.cc-modal-btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  border: none;
}

.cc-modal-btn-cancel {
  background: #f3f4f6;
  color: #374151;
}

.cc-modal-btn-cancel:hover {
  background: #e5e7eb;
}

.cc-modal-btn-agree {
  background: #12715B;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(18, 113, 91, 0.2);
}

.cc-modal-btn-agree:hover {
  background: #0e5a49;
  box-shadow: 0 4px 12px rgba(18, 113, 91, 0.25);
  transform: translateY(-1px);
}

.cc-modal-btn-agree:active {
  transform: translateY(0);
}

/* === AGREEMENT CHECKBOXES === */
.cc-agreements-section {
  margin: 20px 0 0;
  padding: 16px;
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 10px;
}

.cc-agreements-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #fde68a;
  transition: color 0.3s;
}

.cc-agreements-header svg {
  flex-shrink: 0;
  color: #a16207;
}

.cc-agreements-error {
  color: #b91c1c !important;
}

.cc-agreements-error svg {
  color: #b91c1c !important;
}

.cc-agreement-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  padding: 6px 0;
  line-height: 1.4;
  user-select: none;
}

.cc-agreement-check + .cc-agreement-check {
  border-top: 1px solid rgba(253, 230, 138, 0.5);
  padding-top: 8px;
}

.cc-agreement-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #12715B;
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
  margin-top: 1px;
}

/* === GOOGLE AGREEMENTS PANEL === */
#cc-google-agreements-panel {
  padding: 32px 28px 24px;
  animation: ccFadeIn 0.3s ease;
}

.cc-fcra-inline-text {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 18px;
  max-height: 140px;
  overflow-y: auto;
  margin-bottom: 4px;
}

.cc-fcra-inline-text p {
  font-size: 13px;
  line-height: 1.6;
  color: #475569;
  margin: 0;
}

.cc-fcra-inline-text a {
  color: #12715B;
  text-decoration: underline;
}

.cc-google-agreements-fcra {
  margin-bottom: 20px;
}

.cc-google-agreements-submit {
  margin-top: 16px;
  width: 100%;
  transition: opacity 0.2s ease;
}

.cc-google-agreements-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cc-google-agreements-message {
  margin-top: 12px;
}

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

/* === RESPONSIVE === */
@media (max-width: 480px) {
  .cc-auth {
    padding: 24px 16px 48px;
  }

  .cc-auth-panel {
    padding: 20px 18px 18px;
  }

  .cc-auth-trust {
    gap: 6px;
  }

  .cc-trust-pill {
    font-size: 10px;
    padding: 5px 10px;
  }

  #cc-otp-panel {
    padding: 20px 18px 18px;
  }

  .cc-otp-digit {
    width: 40px;
    height: 48px;
    font-size: 20px;
  }

  .cc-otp-digits {
    gap: 5px;
  }

  .cc-modal {
    margin: 0 12px;
  }

  .cc-modal-header {
    padding: 20px;
  }

  .cc-modal-body {
    padding: 20px;
  }

  .cc-modal-actions {
    padding: 16px 20px;
    flex-direction: column;
  }

  .cc-modal-btn {
    width: 100%;
    text-align: center;
  }
}
