/**
 * MyVideoStudio Login Page CSS — v3 Mesh Gradient.
 *
 * Inspiration: Linear / Vercel / Stripe 2026 — refined, premium, slightly futuristic.
 *
 * Layout: split-screen (form left, brand right with mesh bg)
 *   - Mobile: brand collapses, form full width
 *   - Tablet+: 50/50 split
 *
 * Theme: light-first with dark via [data-theme="dark"] on .mvs-auth-page.
 *
 * @since 1.17.0
 */

/* ====================================================================
   1. TOKENS — LIGHT (default)
   ==================================================================== */

.mvs-auth-page {
  /* Surfaces */
  --auth-bg: #FFFFFF;
  --auth-bg-soft: #F9FAFB;
  --auth-bg-form: #FFFFFF;
  --auth-card: #FFFFFF;
  --auth-card-border: rgba(15, 23, 42, 0.08);
  --auth-card-border-focus: rgba(99, 102, 241, 0.4);

  /* Text */
  --auth-text: #0F172A;
  --auth-text-soft: #475569;
  --auth-text-muted: #94A3B8;

  /* Brand */
  --auth-brand-500: #6366F1;
  --auth-brand-600: #4F46E5;
  --auth-brand-700: #4338CA;
  --auth-accent-500: #D946EF;
  --auth-accent-600: #C026D3;
  --auth-pink-500: #EC4899;

  /* Mesh palette (used on the brand panel right side) */
  --mesh-1: #6366F1; /* indigo */
  --mesh-2: #C026D3; /* fuchsia */
  --mesh-3: #EC4899; /* pink */
  --mesh-4: #F59E0B; /* amber */
  --mesh-5: #06B6D4; /* cyan */

  /* Semantic */
  --auth-success: #10B981;
  --auth-warning: #F59E0B;
  --auth-danger: #EF4444;

  /* Gradients */
  --auth-grad-cta: linear-gradient(135deg, #6366F1 0%, #C026D3 55%, #EC4899 100%);
  --auth-grad-text: linear-gradient(135deg, #FFFFFF 0%, #E0E7FF 100%);

  /* Shadows */
  --auth-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --auth-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --auth-shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --auth-shadow-lg: 0 12px 24px -6px rgba(15, 23, 42, 0.10);
  --auth-shadow-cta: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 8px 24px -8px rgba(192, 38, 211, 0.4);

  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "ss01", "cv01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--auth-bg);
  color: var(--auth-text);
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;

  /* v1.20 — Viewport breakout for Astra page-builder compat */
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

/* ====================================================================
   2. TOKENS — DARK (opt-in)
   ==================================================================== */

.mvs-auth-page[data-theme="dark"] {
  --auth-bg: #0A0A0F;
  --auth-bg-soft: #14141F;
  --auth-bg-form: #14141F;
  --auth-card: rgba(255, 255, 255, 0.03);
  --auth-card-border: rgba(255, 255, 255, 0.08);
  --auth-card-border-focus: rgba(129, 140, 248, 0.5);

  --auth-text: #F8FAFC;
  --auth-text-soft: #CBD5E1;
  --auth-text-muted: #94A3B8;

  --auth-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --auth-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --auth-shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.5);
  --auth-shadow-lg: 0 12px 24px -6px rgba(0, 0, 0, 0.6);
}

.mvs-auth-page *, .mvs-auth-page *::before, .mvs-auth-page *::after { box-sizing: border-box; }

/* ====================================================================
   3. LAYOUT (split-screen)
   ==================================================================== */

.mvs-auth-page__layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

@media (min-width: 1024px) {
  .mvs-auth-page__layout {
    grid-template-columns: 1fr 1fr;
  }
}

/* ====================================================================
   4. BRAND PANEL (right side, mesh background)
   ==================================================================== */

.mvs-auth-page__brand {
  position: relative;
  display: none;
  overflow: hidden;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 35%, #C026D3 70%, #EC4899 100%);
  color: white;
  padding: 56px;
  flex-direction: column;
  justify-content: space-between;
}

@media (min-width: 1024px) {
  .mvs-auth-page__brand { display: flex; }
}

/* Mesh canvas — animated blobs */
.mvs-auth-page__brand-mesh {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.mvs-auth-page__brand-mesh-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.65;
}

.mvs-auth-page__brand-mesh-blob--1 {
  width: 480px;
  height: 480px;
  top: -120px;
  left: -120px;
  background: radial-gradient(circle, var(--mesh-1), transparent);
  animation: mesh-float-1 18s ease-in-out infinite;
}

.mvs-auth-page__brand-mesh-blob--2 {
  width: 420px;
  height: 420px;
  bottom: -100px;
  right: -100px;
  background: radial-gradient(circle, var(--mesh-3), transparent);
  animation: mesh-float-2 22s ease-in-out infinite;
}

.mvs-auth-page__brand-mesh-blob--3 {
  width: 320px;
  height: 320px;
  top: 40%;
  right: 25%;
  background: radial-gradient(circle, var(--mesh-4), transparent);
  animation: mesh-float-3 26s ease-in-out infinite;
  opacity: 0.5;
}

.mvs-auth-page__brand-mesh-blob--4 {
  width: 280px;
  height: 280px;
  top: 20%;
  left: 35%;
  background: radial-gradient(circle, var(--mesh-5), transparent);
  animation: mesh-float-4 20s ease-in-out infinite;
  opacity: 0.4;
}

@keyframes mesh-float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(80px, 100px) scale(1.1); }
}
@keyframes mesh-float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-90px, -70px) scale(1.15); }
}
@keyframes mesh-float-3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-60px, 80px) scale(0.95); }
}
@keyframes mesh-float-4 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(50px, -40px) scale(1.05); }
  66% { transform: translate(-30px, 60px) scale(0.95); }
}

/* Subtle grain overlay */
.mvs-auth-page__brand-grain {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.03) 1px, transparent 2px),
    radial-gradient(circle at 80% 60%, rgba(255, 255, 255, 0.03) 1px, transparent 2px);
  background-size: 24px 24px;
  z-index: 1;
  pointer-events: none;
}

.mvs-auth-page__brand-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.mvs-auth-page__brand-top {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mvs-auth-page__brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(20px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mvs-auth-page__brand-middle {
  max-width: 460px;
  margin-top: auto;
  margin-bottom: auto;
}

.mvs-auth-page__brand-headline {
  font-size: 44px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 0 0 18px;
  background: var(--auth-grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mvs-auth-page__brand-subline {
  font-size: 17px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
}

/* Feature pills */
.mvs-auth-page__brand-pills {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 36px;
}

.mvs-auth-page__brand-pill {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  transition: all 0.3s ease;
}

.mvs-auth-page__brand-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateX(4px);
}

.mvs-auth-page__brand-pill-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.mvs-auth-page__brand-pill-text {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
}

.mvs-auth-page__brand-bottom {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

/* ====================================================================
   5. FORM PANEL (left side)
   ==================================================================== */

.mvs-auth-page__form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  min-height: 100vh;
  background: var(--auth-bg);
  position: relative;
}

@media (min-width: 768px) {
  .mvs-auth-page__form-wrap { padding: 48px; }
}

/* Top-right theme toggle on mobile */
.mvs-auth-page__theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--auth-card-border);
  background: var(--auth-card);
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--auth-text-soft);
  transition: all 0.2s ease;
  z-index: 50;
  box-shadow: var(--auth-shadow-sm);
}

.mvs-auth-page__theme-toggle:hover {
  color: var(--auth-text);
  border-color: var(--auth-card-border-focus);
  transform: scale(1.05);
}

.mvs-auth-page__theme-toggle .icon-dark { display: none; }
.mvs-auth-page[data-theme="dark"] .mvs-auth-page__theme-toggle .icon-light { display: none; }
.mvs-auth-page[data-theme="dark"] .mvs-auth-page__theme-toggle .icon-dark { display: inline; }

.mvs-auth-page__form {
  width: 100%;
  max-width: 420px;
}

/* Mobile brand line */
.mvs-auth-page__form-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
  font-size: 16px;
  font-weight: 700;
  color: var(--auth-text);
  letter-spacing: -0.02em;
}

.mvs-auth-page__form-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--auth-grad-cta);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

.mvs-auth-page__form-header {
  margin-bottom: 24px;
}

.mvs-auth-page__form-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
  color: var(--auth-text);
}

.mvs-auth-page__form-subtitle {
  font-size: 14px;
  color: var(--auth-text-soft);
  margin: 0;
}

/* ====================================================================
   6. TABS
   ==================================================================== */

.mvs-auth-page__tabs {
  display: flex;
  background: var(--auth-bg-soft);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 28px;
  border: 1px solid var(--auth-card-border);
}

.mvs-auth-page__tab {
  flex: 1;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--auth-text-soft);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.mvs-auth-page__tab--active {
  background: var(--auth-card);
  color: var(--auth-text);
  box-shadow: var(--auth-shadow-sm);
}

.mvs-auth-page__tab:not(.mvs-auth-page__tab--active):hover {
  color: var(--auth-text);
}

/* ====================================================================
   7. FIELDS
   ==================================================================== */

.mvs-auth-page__field {
  margin-bottom: 16px;
}

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

.mvs-auth-page__label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--auth-text-soft);
  margin-bottom: 6px;
}

.mvs-auth-page__input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  background: var(--auth-card);
  border: 1px solid var(--auth-card-border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--auth-text);
  transition: all 0.2s ease;
}

.mvs-auth-page__input:focus {
  outline: 0;
  border-color: var(--auth-brand-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.mvs-auth-page__input--error {
  border-color: var(--auth-danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.mvs-auth-page__link {
  font-size: 12px;
  color: var(--auth-brand-600);
  text-decoration: none;
  font-weight: 600;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.mvs-auth-page__link:hover { color: var(--auth-brand-700); text-decoration: underline; }

/* Password strength meter */
.mvs-auth-page__strength {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.mvs-auth-page__strength-bar {
  flex: 1;
  height: 4px;
  background: var(--auth-card-border);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.mvs-auth-page__strength-bar--filled-1 { background: var(--auth-danger); }
.mvs-auth-page__strength-bar--filled-2 { background: var(--auth-warning); }
.mvs-auth-page__strength-bar--filled-3 { background: var(--auth-brand-500); }
.mvs-auth-page__strength-bar--filled-4 { background: var(--auth-success); }

.mvs-auth-page__strength-label {
  font-size: 11px;
  color: var(--auth-text-muted);
  margin-top: 4px;
}

/* ====================================================================
   8. SUBMIT BUTTON
   ==================================================================== */

.mvs-auth-page__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  margin-top: 10px;
  background: var(--auth-grad-cta);
  color: white;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--auth-shadow-cta);
  letter-spacing: -0.005em;
}

.mvs-auth-page__submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 16px 36px -10px rgba(192, 38, 211, 0.55);
}

.mvs-auth-page__submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ====================================================================
   9. MESSAGE BANNER
   ==================================================================== */

.mvs-auth-page__message {
  display: none;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid;
  line-height: 1.5;
  animation: msg-slide-in 0.25s ease;
}

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

.mvs-auth-page__message--show { display: block; }

.mvs-auth-page__message--error {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.25);
  color: #991B1B;
}

.mvs-auth-page[data-theme="dark"] .mvs-auth-page__message--error {
  color: #FCA5A5;
}

.mvs-auth-page__message--success {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.25);
  color: #065F46;
}

.mvs-auth-page[data-theme="dark"] .mvs-auth-page__message--success {
  color: #6EE7B7;
}

.mvs-auth-page__message--info {
  background: rgba(59, 130, 246, 0.06);
  border-color: rgba(59, 130, 246, 0.25);
  color: #1E40AF;
}

.mvs-auth-page[data-theme="dark"] .mvs-auth-page__message--info {
  color: #93C5FD;
}

/* ====================================================================
   10. FOOTER LINKS
   ==================================================================== */

.mvs-auth-page__form-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--auth-text-muted);
}

.mvs-auth-page__form-footer a {
  color: var(--auth-brand-600);
  text-decoration: none;
  font-weight: 500;
}

.mvs-auth-page__form-footer a:hover { text-decoration: underline; }

/* ====================================================================
   11. SPINNER
   ==================================================================== */

.mvs-auth-page__spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ====================================================================
   12. VIEW STATES (login / register / forgot / reset)
   ==================================================================== */

.mvs-auth-page__view { display: none; }
.mvs-auth-page__view--active { display: block; animation: view-fade 0.3s ease; }

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

/* ====================================================================
   13. ALREADY LOGGED IN STATE
   ==================================================================== */

.mvs-auth-page__authed {
  text-align: center;
  padding: 40px 20px;
}

.mvs-auth-page__authed-avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  background: var(--auth-grad-cta);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
  font-weight: 700;
  box-shadow: var(--auth-shadow-lg);
}

.mvs-auth-page__authed-name {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
  color: var(--auth-text);
}

.mvs-auth-page__authed-email {
  font-size: 13px;
  color: var(--auth-text-muted);
  margin: 0 0 24px;
}

/* ====================================================================
   14. ACCESSIBILITY & MOTION
   ==================================================================== */

.mvs-auth-page button:focus-visible,
.mvs-auth-page input:focus-visible,
.mvs-auth-page a:focus-visible {
  outline: 2px solid var(--auth-brand-500);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .mvs-auth-page__brand-mesh-blob { animation: none !important; }
  .mvs-auth-page__brand-pill:hover { transform: none !important; }
  .mvs-auth-page__submit:hover:not(:disabled) { transform: none !important; }
}

/* Hide mobile brand text when desktop brand visible */
@media (min-width: 1024px) {
  .mvs-auth-page__form-brand { display: none; }
}
