/**
 * FYOOL auth popup — tabbed login/register modal triggered from header.
 */

/* ── Modal shell (uses same fyool-modal base as cart-checkout-modals.css) ── */

.fyool-auth-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.fyool-auth-modal[hidden] {
  display: none !important;
}

.fyool-auth-modal .modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
}

.fy-auth-modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.2);
  padding: 32px 32px 28px;
  max-height: calc(100svh - 48px);
  overflow-y: auto;
}

/* Scroll snap on small viewports */
@media (max-height: 640px) {
  .fy-auth-modal-content {
    padding: 24px 24px 20px;
  }
}

/* ── Close button ─────────────────────────────────────────────────────────── */

.fyool-auth-modal .button-close-modal {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 2;
}

.fyool-auth-modal .button-close-modal:hover {
  background: var(--border);
}

.fyool-auth-modal .button-close-modal::before,
.fyool-auth-modal .button-close-modal::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 2px;
  background: var(--muted);
  border-radius: 1px;
  transform: translate(-50%, -50%) rotate(45deg);
}

.fyool-auth-modal .button-close-modal::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* ── Tabs ─────────────────────────────────────────────────────────────────── */

.fy-auth-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 24px;
  border-bottom: 2px solid var(--border);
}

.fy-auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 8px 12px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.fy-auth-tab.active {
  color: var(--text);
  border-bottom-color: var(--blue);
}

.fy-auth-tab:hover:not(.active) {
  color: var(--text);
}

/* ── Panels ───────────────────────────────────────────────────────────────── */

.fy-auth-panel {
  display: block;
}

.fy-auth-panel[hidden],
.fy-auth-panel:not(.active) {
  display: none;
}

/* ── Form base ────────────────────────────────────────────────────────────── */

.fy-auth-form {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  max-width: none !important;
  box-shadow: none !important;
}

.fy-auth-form .form-row {
  float: none !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 0 16px !important;
  clear: both;
}

.fy-auth-form .form-row label {
  display: block;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.fy-auth-form .form-row .required {
  color: #b91c1c;
  margin-left: 2px;
}

.fy-auth-form .input-text,
.fy-auth-form input[type="text"],
.fy-auth-form input[type="email"],
.fy-auth-form input[type="password"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-family: 'Barlow', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: block;
  -webkit-appearance: none;
  box-sizing: border-box;
}

.fy-auth-form .input-text:focus,
.fy-auth-form input[type="text"]:focus,
.fy-auth-form input[type="email"]:focus,
.fy-auth-form input[type="password"]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.12);
  outline: none;
}

/* ── Password + show/hide toggle ──────────────────────────────────────────── */

.fy-auth-pwd-wrap {
  position: relative;
}

.fy-auth-pwd-wrap .input-text,
.fy-auth-pwd-wrap input[type="password"] {
  padding-right: 44px;
}

.fy-auth-toggle-pwd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.fy-auth-toggle-pwd:hover {
  color: var(--text);
}

/* ── Remember + lost password row ─────────────────────────────────────────── */

.fy-auth-remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.fy-auth-remember {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.fy-auth-remember input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
  cursor: pointer;
}

.fy-auth-lost-pwd {
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  white-space: nowrap;
}

.fy-auth-lost-pwd:hover {
  text-decoration: underline;
}

/* ── Submit button ────────────────────────────────────────────────────────── */

.fy-auth-submit {
  width: 100%;
  display: block;
  background: linear-gradient(90deg, var(--blue), #1677d2) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 10px !important;
  font-family: 'Barlow Condensed', sans-serif !important;
  font-weight: 700 !important;
  font-size: 16px !important;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 13px 20px !important;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  margin-top: 2px;
}

.fy-auth-submit:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ── Hint text (password auto-generated) ──────────────────────────────────── */

.fy-auth-hint {
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 16px !important;
}

/* ── Privacy policy text ──────────────────────────────────────────────────── */

.fy-auth-privacy,
.fy-auth-privacy p {
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 14px !important;
}

.fy-auth-privacy a {
  color: var(--blue);
  font-weight: 600;
}

/* ── Switch tab hint ("Don't have an account? Register") ─────────────────── */

.fy-auth-switch-hint {
  text-align: center;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  color: var(--muted);
  margin: 16px 0 0 !important;
}

.fy-auth-switch-tab {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  color: var(--blue);
}

.fy-auth-switch-tab:hover {
  text-decoration: underline;
}

/* ── WooCommerce notices inside popup ─────────────────────────────────────── */

.fyool-auth-modal .woocommerce-error,
.fyool-auth-modal .woocommerce-message,
.fyool-auth-modal .woocommerce-info {
  margin: 0 0 16px !important;
  border-radius: 10px !important;
  padding: 12px 16px !important;
  font-size: 14px;
}

/* ── body overflow lock when modal is open ────────────────────────────────── */

body.fy-auth-open {
  overflow: hidden;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .fyool-auth-modal {
    padding: 0;
    align-items: flex-end;
  }

  .fy-auth-modal-content {
    max-width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-radius: 18px 18px 0 0;
    max-height: 88svh;
    padding: 24px 20px 28px;
  }
}
