/* =====================================================================
   XPRINT PREMIUM LOGIN PAGE STYLING
   Framer-inspired glassmorphism dark canvas.
   Designed by a long-time UI/UX application developer.
   ===================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
}

.d-none {
  display: none !important;
}

/* Custom browser autofill styling for dark premium appearance */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--x-ink) !important;
  -webkit-box-shadow: 0 0 0px 1000px #161617 inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

html, body {
  height: 100%;
  margin: 0;
  background-color: var(--x-canvas);
  color: var(--x-ink);
  font-family: var(--x-font);
  font-feature-settings: var(--x-font-features);
  overflow: hidden; /* Hide scrollbars due to ambient animation blooms */
}

.login-stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--x-sp-lg);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

/* ---------- Ambient Blob Mesh Background ---------- */
.blob-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

/* Mouse-tracking reactive light source */
.blob-light {
  position: absolute;
  width: 550px; height: 550px;
  top: 50%; left: 50%;
  background: radial-gradient(circle at center, rgba(99, 102, 241, 0.16) 0%, rgba(139, 92, 246, 0.06) 40%, transparent 70%);
  border-radius: 50%;
  filter: blur(50px);
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
  will-change: transform;
}

/* Drifting organic atmosphere blobs */
.blob-ambient-1 {
  position: absolute;
  width: 600px; height: 600px;
  top: -150px; left: -100px;
  background: radial-gradient(circle at center, rgba(192, 38, 211, 0.12) 0%, rgba(139, 92, 246, 0.04) 50%, transparent 70%);
  border-radius: 50%;
  filter: blur(80px);
  animation: driftAmbient1 24s infinite alternate ease-in-out;
}

.blob-ambient-2 {
  position: absolute;
  width: 550px; height: 550px;
  bottom: -150px; right: -100px;
  background: radial-gradient(circle at center, rgba(6, 182, 212, 0.10) 0%, rgba(0, 153, 255, 0.04) 50%, transparent 70%);
  border-radius: 50%;
  filter: blur(70px);
  animation: driftAmbient2 20s infinite alternate-reverse ease-in-out;
}

@keyframes driftAmbient1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(80px, 60px) scale(1.08); }
  100% { transform: translate(-30px, 100px) scale(0.95); }
}

@keyframes driftAmbient2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-60px, 80px) scale(1.1); }
  100% { transform: translate(40px, -40px) scale(0.9); }
}

/* ---------- Premium Frosted Glass Card ---------- */
.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 380px;
  background: rgba(22, 22, 23, 0.72); /* Translucent surface-1 */
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--x-r-xl);
  box-shadow: 
    0 4px 30px rgba(0, 0, 0, 0.4),
    0 15px 50px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: var(--x-sp-xl);
  animation: cardEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 
    0 4px 30px rgba(0, 0, 0, 0.45),
    0 25px 65px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(25px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Brand Header */
.login-logo-container {
  display: flex;
  align-items: center;
  gap: var(--x-sp-sm);
  margin-bottom: var(--x-sp-lg);
}

.login-logo {
  width: 40px; height: 40px;
  border-radius: var(--x-r-md);
  background: var(--x-inverse);
  color: var(--x-on-primary);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.3s ease;
}

.login-card:hover .login-logo {
  transform: rotate(5deg) scale(1.05);
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--x-ink);
  opacity: 0.9;
}

.login-title {
  font-size: 26px; font-weight: 600; line-height: 1.15;
  letter-spacing: -0.8px; margin: 0 0 6px;
  color: var(--x-ink);
}

.login-sub {
  color: var(--x-ink-muted);
  font-size: 14px; letter-spacing: -0.15px;
  margin: 0 0 var(--x-sp-lg);
}

/* ---------- Premium Error Alert ---------- */
.login-error-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 92, 92, 0.08);
  border: 1px solid rgba(255, 92, 92, 0.22);
  border-radius: var(--x-r-md);
  padding: 10px 14px;
  margin-bottom: var(--x-sp-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 100px;
  opacity: 1;
  overflow: hidden;
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); max-height: 0; }
  to { opacity: 1; transform: translateY(0); max-height: 100px; }
}

.login-error {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ff9e9e;
  font-size: 13.5px;
  font-weight: 500;
}

.error-icon {
  flex-shrink: 0;
  color: var(--x-danger);
}

.alert-close-btn {
  background: transparent;
  border: none;
  color: rgba(255, 92, 92, 0.6);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--x-r-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.alert-close-btn:hover {
  color: #ff9e9e;
  background-color: rgba(255, 92, 92, 0.12);
}

/* ---------- Sleek Icon-based Inputs ---------- */
.login-field { margin-bottom: var(--x-sp-md); }

.login-field-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--x-sp-xs);
}

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

.forgot-password-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--x-ink-muted);
  transition: color 0.15s ease;
}

.forgot-password-link:hover {
  color: var(--x-accent);
  text-decoration: none;
}

/* Input container wrapper */
.x-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.x-input-icon {
  position: absolute;
  left: 14px;
  color: var(--x-ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: color 0.15s ease, transform 0.15s ease;
  z-index: 2;
}

/* Input adjustments */
.x-input-with-icon {
  padding-left: 42px !important;
}

.x-input {
  background: rgba(32, 32, 34, 0.45) !important; /* Semi-transparent charcoal */
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
  border-radius: var(--x-r-md);
  height: 44px;
  padding: 10px 14px;
  color: var(--x-ink) !important;
  transition: all 0.2s ease;
}

.x-input:hover {
  border-color: rgba(255, 255, 255, 0.18) !important;
  background: rgba(32, 32, 34, 0.6) !important;
}

.x-input:focus {
  border-color: var(--x-accent) !important;
  background: rgba(22, 22, 23, 0.85) !important;
  box-shadow: 
    0 0 0 3px var(--x-accent-ring),
    inset 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

/* Glow icon on focus */
.x-input-wrapper:focus-within .x-input-icon {
  color: var(--x-accent);
  transform: scale(1.05);
}

/* Password Toggle Icon */
.password-toggle-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--x-ink-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--x-r-xs);
  transition: color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
  z-index: 2;
}

.password-toggle-btn:hover {
  color: var(--x-ink);
  background-color: var(--x-hairline-soft);
}

.password-toggle-btn:active {
  transform: scale(0.92);
}

/* ---------- Custom Styled Checkbox ---------- */
.login-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: var(--x-sp-md) 0 var(--x-sp-lg);
}

.x-checkbox-container {
  display: inline-flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  color: var(--x-ink-muted);
  transition: color 0.15s ease;
}

.x-checkbox-container:hover {
  color: var(--x-ink);
}

.x-checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0; width: 0;
}

.x-checkbox-checkmark {
  height: 18px; width: 18px;
  background-color: rgba(32, 32, 34, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  margin-right: 8px;
  display: inline-block;
  position: relative;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.x-checkbox-container:hover input ~ .x-checkbox-checkmark {
  border-color: rgba(255, 255, 255, 0.25);
  background-color: rgba(32, 32, 34, 0.8);
}

.x-checkbox-container input:checked ~ .x-checkbox-checkmark {
  background-color: var(--x-accent);
  border-color: var(--x-accent);
}

.x-checkbox-container input:checked:focus ~ .x-checkbox-checkmark,
.x-checkbox-container input:checked ~ .x-checkbox-checkmark {
  box-shadow: 0 0 0 3px var(--x-accent-ring);
}

.x-checkbox-checkmark::after {
  content: "";
  position: absolute;
  display: none;
  left: 6px; top: 2px;
  width: 5px; height: 9px;
  border: solid var(--x-on-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.x-checkbox-container input:checked ~ .x-checkbox-checkmark::after {
  display: block;
}

.x-checkbox-text {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.13px;
}

/* ---------- Buttons & Micro-interactions ---------- */
.login-submit {
  width: 100%;
  height: 44px;
  margin-top: var(--x-sp-xs);
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: -0.15px;
  position: relative;
  background: var(--x-inverse) !important;
  color: var(--x-on-primary) !important;
  transition: background-color 0.18s ease, transform 0.1s ease, box-shadow 0.18s ease !important;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.1);
}

.login-submit:hover {
  background: #f0f0f0 !important;
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.15);
}

.login-submit:active {
  transform: scale(0.975);
}

.login-submit:disabled {
  background: rgba(255, 255, 255, 0.6) !important;
  cursor: not-allowed;
}

/* Button Spinner */
.btn-text {
  transition: opacity 0.15s ease;
}

.btn-spinner {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.spinner-svg {
  animation: spin 1s linear infinite;
  width: 20px;
  height: 20px;
  color: var(--x-on-primary);
}

.spinner-path {
  stroke-linecap: round;
  animation: dash 1.5s ease-in-out infinite;
  stroke: currentColor;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

@keyframes dash {
  0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
  100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

/* ---------- Divider ---------- */
.login-divider {
  display: flex; align-items: center; gap: var(--x-sp-md);
  margin: var(--x-sp-lg) 0;
  color: var(--x-ink-muted);
  font-size: 12.5px; font-weight: 500; letter-spacing: -0.13px;
}

.login-divider::before,
.login-divider::after {
  content: ""; flex: 1; border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---------- Google Login Button ---------- */
.login-oauth {
  width: 100%;
  height: 44px;
  gap: 10px;
  font-weight: 500;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: var(--x-ink) !important;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease !important;
}

.login-oauth:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

.login-oauth:active {
  transform: scale(0.975);
}

.login-oauth svg {
  flex-shrink: 0;
}

/* Responsive Scaling */
@media (max-width: 480px) {
  .login-card {
    padding: var(--x-sp-lg);
  }
  .login-title {
    font-size: 22px;
  }
}
