/* ==========================================================================
   AUTHENTICATION SCREEN & MODAL (ĐĂNG NHẬP / ĐĂNG KÝ BẮT BUỘC)
   ========================================================================== */

/* Fullscreen Login Gateway Screen when unauthenticated */
#auth-gateway-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, rgba(30, 20, 22, 0.82), rgba(15, 12, 13, 0.9)), 
              url('https://images.unsplash.com/photo-1519741497674-611481863552?auto=format&fit=crop&w=1800&q=80') center/cover;
  z-index: 9999;
  display: none; /* Ẩn mặc định — JS sẽ show sau khi checkSession() xong */
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
}

/* JS dùng class này để hiện gateway thay vì inline style */
#auth-gateway-screen.auth-visible {
  display: flex;
}

.auth-gateway-card {
  width: 100%;
  max-width: 460px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(212, 175, 55, 0.4);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: cardFadeInUp 0.6s ease-out;
}

.auth-header {
  background: linear-gradient(135deg, var(--burgundy), var(--rose-gold-dark));
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  color: white;
  position: relative;
}

.auth-header-icon {
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
  display: inline-block;
  animation: floatGentle 3s ease-in-out infinite;
}

.auth-header h3 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: #FFF;
  letter-spacing: -0.01em;
  margin-bottom: 0.3rem;
}

.auth-header p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.88);
  margin: 0;
}

.auth-tabs {
  display: flex;
  background: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-subtle);
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 0.85rem 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all var(--transition-fast);
}

.auth-tab.active {
  color: var(--burgundy);
  border-bottom-color: var(--rose-gold);
  background: #FFF;
}

.auth-body {
  padding: 2rem;
}

.auth-error-banner {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.84rem;
  margin-bottom: 1.25rem;
  display: none;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgba(217, 4, 41, 0.2);
}

.password-input-wrapper {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.password-input-wrapper input {
  width: 100%;
  box-sizing: border-box;
  padding-right: 2.8rem;
}

.toggle-password-btn {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.25rem 0;
  color: var(--text-subtle);
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}

.auth-divider:not(:empty)::before { margin-right: 1em; }
.auth-divider:not(:empty)::after { margin-left: 1em; }

.google-auth-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: #FFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.google-auth-btn:hover {
  background: var(--bg-surface-alt);
  border-color: #CBD5E1;
  box-shadow: var(--shadow-sm);
}

.google-auth-btn svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   DEMO MODE BANNER & FLOATING CONVERSION CTA (ĐIỂM CHỐT HẠ)
   ========================================================================== */

/* Top Sticky Banner in Demo Mode */
.demo-mode-banner {
  background: linear-gradient(90deg, #580B0C, #7B1113, #C65A3E);
  color: #FFF;
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 95;
  border-bottom: 1px solid rgba(212, 175, 55, 0.4);
}

.demo-banner-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
}

.demo-badge {
  background: rgba(212, 175, 55, 0.25);
  border: 1px solid var(--primary-gold);
  color: #FFF;
  font-size: 12px;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  text-transform: none;
  letter-spacing: normal;
}

/* Shimmer Gold Button */
.btn-shimmer-gold {
  background: linear-gradient(135deg, #D4AF37, #F3E5AB, #D4AF37);
  background-size: 200% auto;
  color: #580B0C !important;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.5);
  animation: shimmerMove 3s infinite linear, pulseGlow 2s infinite ease-in-out;
  cursor: pointer;
}

.btn-shimmer-gold:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 25px rgba(212, 175, 55, 0.75);
}

@keyframes shimmerMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4); }
  50% { box-shadow: 0 4px 25px rgba(224, 122, 95, 0.7); }
}

/* Floating Bottom Corner CTA (placed on the left side to avoid colliding with Taylor Floating Assistant on the right) */
.floating-conversion-cta {
  position: fixed;
  bottom: 2rem;
  left: 18rem; /* Next to sidebar on desktop */
  z-index: 950;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(35, 34, 32, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px solid var(--primary-gold);
  border-radius: var(--radius-full);
  padding: 0.5rem 0.6rem 0.5rem 1.25rem;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.45);
  animation: floatGentle 3.5s ease-in-out infinite;
  transition: all 0.3s ease;
}

.floating-cta-close-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(30, 25, 20, 0.95);
  border: 1.5px solid var(--primary-gold);
  color: #FFF;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.floating-cta-close-btn:hover {
  background: var(--burgundy, #7B1113);
  border-color: #FFF;
  color: #FFF;
  transform: scale(1.15);
}

/* Hide floating CTAs and assistant button when any modal is open to prevent UI overlap */
body.modal-open .floating-conversion-cta,
body.modal-open .taylor-floating-btn,
body.modal-open #floating-conversion-cta,
body.modal-open #taylor-floating-toggle-btn,
.modal-overlay.active ~ .floating-conversion-cta,
.modal-overlay.active ~ .taylor-floating-btn,
.modal-overlay.active ~ #floating-conversion-cta,
.modal-overlay.active ~ #taylor-floating-toggle-btn {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

@supports selector(:has(*)) {
  body:has(.modal-overlay.active) .floating-conversion-cta,
  body:has(.modal-overlay.active) .taylor-floating-btn,
  body:has(.modal-overlay.active) #floating-conversion-cta,
  body:has(.modal-overlay.active) #taylor-floating-toggle-btn {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }
}

.floating-conversion-cta:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: #FFF;
}

.floating-cta-text {
  color: #FFF;
  font-size: 0.86rem;
  font-weight: 600;
}

@media (max-width: 1024px) {
  .floating-conversion-cta {
    left: 2rem;
    bottom: 5.5rem;
  }
}

@media (max-width: 768px) {
  .demo-mode-banner {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    padding: 0.75rem 1rem;
  }
  .floating-conversion-cta {
    bottom: 4.75rem;
    right: 1rem;
    left: 1rem;
    justify-content: space-between;
  }
}

