/* ==========================================================================
   auth-glass.css — Liquid Glass Authentication Gate, Home Hub Link & User Bar
   Synchronized with NexusGlass Ecosystem & tienganh2epu Light/Dark Themes
   ========================================================================== */

:root {
  --glass-bg-light: rgba(255, 255, 255, 0.78);
  --glass-bg-card-light: rgba(255, 255, 255, 0.88);
  --glass-border-light: rgba(148, 163, 184, 0.32);
  --glass-shadow-light: 0 24px 60px -15px rgba(15, 23, 42, 0.14), 0 0 1px 1px rgba(255, 255, 255, 0.7) inset;

  --glass-bg-dark: rgba(15, 23, 42, 0.78);
  --glass-bg-card-dark: rgba(30, 41, 59, 0.82);
  --glass-border-dark: rgba(148, 163, 184, 0.22);
  --glass-shadow-dark: 0 24px 60px -15px rgba(2, 6, 23, 0.65), 0 0 1px 1px rgba(255, 255, 255, 0.08) inset;
}

/* Lock Protected Learning Shell When Unauthenticated */
body.auth-locked #app.app-shell {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.auth-locked {
  overflow-x: hidden;
}

/* Fullscreen Liquid Glass Auth Gate */
.auth-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: 20px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 15% 18%, rgba(56, 189, 248, 0.22), transparent 42%),
    radial-gradient(circle at 85% 22%, rgba(99, 102, 241, 0.20), transparent 45%),
    radial-gradient(circle at 50% 85%, rgba(16, 185, 129, 0.15), transparent 45%),
    linear-gradient(145deg, #f0f6ff 0%, #e6effa 50%, #eef2ff 100%);
  color: var(--color-text-primary, #0f172a);
  transition: opacity 0.25s ease;
}

[data-theme="dark"] .auth-gate-overlay {
  background:
    radial-gradient(circle at 15% 18%, rgba(56, 189, 248, 0.18), transparent 42%),
    radial-gradient(circle at 85% 22%, rgba(99, 102, 241, 0.22), transparent 45%),
    radial-gradient(circle at 50% 85%, rgba(16, 185, 129, 0.14), transparent 45%),
    linear-gradient(145deg, #060b16 0%, #0b1326 52%, #0f172a 100%);
  color: #f8fafc;
}

.auth-gate-overlay.hidden {
  display: none !important;
}

/* Topbar inside Auth Gate */
.auth-gate-topbar {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-gate-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-gate-brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.45);
}

.auth-gate-brand-text {
  display: flex;
  flex-direction: column;
}

.auth-gate-brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.auth-gate-brand-sub {
  font-size: 0.78rem;
  opacity: 0.75;
}

.auth-gate-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Liquid Glass Ecosystem Home Hub Button (Used in Auth Gate, Header & Sidebar) */
.btn-home-hub {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(59, 130, 246, 0.32);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.10), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-home-hub:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18);
}

.btn-home-hub:active {
  transform: translateY(0);
}

[data-theme="dark"] .btn-home-hub {
  color: #f1f5f9;
  background: rgba(30, 41, 59, 0.78);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 4px 16px rgba(2, 6, 23, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

[data-theme="dark"] .btn-home-hub:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: 0 8px 22px rgba(14, 165, 233, 0.25);
}

.btn-home-hub-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(6, 182, 212, 0.22));
  color: #2563eb;
  font-size: 0.85rem;
}

[data-theme="dark"] .btn-home-hub-icon {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(99, 102, 241, 0.26));
  color: #38bdf8;
}

/* Sidebar Home Hub Banner */
.sidebar-ecosystem-box {
  margin: 10px 12px 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.09), rgba(6, 182, 212, 0.09));
  border: 1px solid rgba(59, 130, 246, 0.22);
}

[data-theme="dark"] .sidebar-ecosystem-box {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(6, 182, 212, 0.14));
  border-color: rgba(56, 189, 248, 0.25);
}

.sidebar-ecosystem-btn {
  width: 100%;
  justify-content: flex-start;
  padding: 9px 12px;
  border-radius: 10px;
}

/* Main Auth Container */
.auth-gate-main {
  width: 100%;
  max-width: 1040px;
  margin: 24px auto;
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  gap: 28px;
  align-items: stretch;
}

@media (max-width: 860px) {
  .auth-gate-main {
    grid-template-columns: 1fr;
    max-width: 520px;
  }
}

/* Left Info Panel */
.auth-gate-showcase {
  padding: 32px;
  border-radius: 24px;
  background: var(--glass-bg-light);
  border: 1px solid var(--glass-border-light);
  box-shadow: var(--glass-shadow-light);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

[data-theme="dark"] .auth-gate-showcase {
  background: var(--glass-bg-dark);
  border-color: var(--glass-border-dark);
  box-shadow: var(--glass-shadow-dark);
}

.auth-showcase-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.25);
}

[data-theme="dark"] .auth-showcase-badge {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.3);
}

.auth-showcase-title {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 12px 0 10px;
  letter-spacing: -0.02em;
}

.auth-showcase-desc {
  font-size: 0.94rem;
  line-height: 1.6;
  opacity: 0.85;
  margin: 0;
}

.auth-feature-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

@media (max-width: 520px) {
  .auth-feature-list {
    grid-template-columns: 1fr;
  }
}

.auth-feature-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.22);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

[data-theme="dark"] .auth-feature-item {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.16);
}

.auth-feature-icon {
  font-size: 1.2rem;
  line-height: 1;
  margin-top: 2px;
}

.auth-feature-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.auth-feature-sub {
  font-size: 0.76rem;
  opacity: 0.75;
}

.auth-sso-notice {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.8rem;
  line-height: 1.5;
  background: rgba(6, 182, 212, 0.09);
  border: 1px solid rgba(6, 182, 212, 0.26);
}

/* Right Auth Form Card */
.auth-gate-card {
  padding: 32px;
  border-radius: 24px;
  background: var(--glass-bg-card-light);
  border: 1px solid var(--glass-border-light);
  box-shadow: var(--glass-shadow-light);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

[data-theme="dark"] .auth-gate-card {
  background: var(--glass-bg-card-dark);
  border-color: var(--glass-border-dark);
  box-shadow: var(--glass-shadow-dark);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.16);
  margin-bottom: 20px;
}

.auth-tab-btn {
  padding: 8px 10px;
  border: none;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: inherit;
  opacity: 0.72;
  transition: all 0.18s ease;
}

.auth-tab-btn.active {
  opacity: 1;
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.10);
}

[data-theme="dark"] .auth-tab-btn.active {
  background: #1e293b;
  color: #38bdf8;
}

.auth-card-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0 0 6px;
}

.auth-card-subtitle {
  font-size: 0.85rem;
  opacity: 0.78;
  margin: 0 0 18px;
}

/* Alert / Banner inside Auth Card */
.auth-alert {
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.83rem;
  line-height: 1.45;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.auth-alert.hidden {
  display: none !important;
}

.auth-alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #b91c1c;
}

[data-theme="dark"] .auth-alert-error {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

.auth-alert-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #047857;
}

[data-theme="dark"] .auth-alert-success {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(52, 211, 153, 0.4);
  color: #6ee7b7;
}

.auth-alert-warning {
  background: rgba(245, 158, 11, 0.13);
  border: 1px solid rgba(245, 158, 11, 0.38);
  color: #b45309;
}

[data-theme="dark"] .auth-alert-warning {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(251, 191, 36, 0.4);
  color: #fcd34d;
}

.auth-alert-info {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.32);
  color: #1d4ed8;
}

[data-theme="dark"] .auth-alert-info {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

/* Form Controls */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-label {
  font-size: 0.82rem;
  font-weight: 600;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.85);
  color: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

[data-theme="dark"] .auth-input {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.28);
  color: #f8fafc;
}

.auth-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.auth-password-toggle {
  position: absolute;
  right: 10px;
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.65;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.78rem;
  border-radius: 6px;
}

.auth-password-toggle:hover {
  opacity: 1;
}

.auth-submit-btn {
  margin-top: 4px;
  padding: 12px 18px;
  border-radius: 12px;
  border: none;
  font-size: 0.94rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #0891b2);
  box-shadow: 0 10px 24px -6px rgba(37, 99, 235, 0.48);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.auth-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.auth-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.auth-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: auth-spin 0.75s linear infinite;
}

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

/* Env Configuration Collapse inside Auth Card (when .env.local not yet filled) */
.auth-env-config-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px dashed rgba(148, 163, 184, 0.4);
  font-size: 0.8rem;
}

.auth-env-config-title {
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.auth-gate-footer {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  text-align: center;
  font-size: 0.78rem;
  opacity: 0.72;
  padding-top: 8px;
}

/* Header User Account Pill & Logout Button */
.header-user-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 11px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.26);
  max-width: 280px;
}

.header-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.header-user-email {
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.header-user-status {
  font-size: 0.66rem;
  color: #10b981;
  font-weight: 600;
}

.btn-header-logout {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, 0.32);
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

[data-theme="dark"] .btn-header-logout {
  color: #f87171;
  background: rgba(239, 68, 68, 0.16);
}

.btn-header-logout:hover {
  background: rgba(239, 68, 68, 0.22);
}

@media (max-width: 720px) {
  .btn-home-hub-label {
    display: none;
  }
  .header-user-info {
    display: none;
  }
  .header-user-box {
    padding: 4px;
  }
  .auth-gate-card,
  .auth-gate-showcase {
    padding: 22px 18px;
  }
}
