/* ═══════════════════════════════════════════════════════════════════
   CyberSense.Solutions — auth.css
   Authentication UI: modal, nav user menu, toasts, tier gates,
   account page, password strength, form states
   ═══════════════════════════════════════════════════════════════════ */

/* ── Modal Overlay ─────────────────────────────────────────────── */
.cs-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: cs-modal-in 0.18s ease;
}

.cs-modal-overlay.closing {
  animation: cs-modal-out 0.18s ease forwards;
}

@keyframes cs-modal-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes cs-modal-out { from { opacity: 1; } to { opacity: 0; } }

.cs-modal-card {
  background: #fff;
  border-radius: 14px;
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 440px;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.28);
  animation: cs-card-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cs-card-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.cs-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
}
.cs-modal-close:hover { color: #1e293b; }

.cs-modal-logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--cs-navy);
  margin-bottom: 20px;
  text-align: center;
}
.cs-modal-logo span { color: var(--cs-cyan); }

/* ── Auth Message (context-specific prompt) ─────────────────────── */
.auth-modal-message {
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: #0369a1;
  margin-bottom: 20px;
  text-align: center;
}

/* ── Auth Tabs ──────────────────────────────────────────────────── */
.auth-tabs {
  display: flex;
  border-bottom: 1.5px solid #e2e8f0;
  margin-bottom: 24px;
  gap: 0;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  transition: all 0.15s;
}

.auth-tab:hover { color: var(--cs-navy); }
.auth-tab.active {
  color: var(--cs-navy);
  border-bottom-color: var(--cs-cyan);
  font-weight: 600;
}

/* ── Auth Forms ─────────────────────────────────────────────────── */
.auth-submit-btn {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
  padding: 13px;
  font-size: 15px;
}

.auth-forgot-link {
  display: block;
  width: 100%;
  text-align: center;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  margin-top: 12px;
  padding: 4px;
  transition: color 0.15s;
}
.auth-forgot-link:hover { color: var(--cs-cyan); }

.auth-terms {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  margin-top: 12px;
  line-height: 1.5;
}
.auth-terms a { color: var(--cs-cyan); }

/* ── Auth Error/Success States ──────────────────────────────────── */
.auth-error {
  display: none;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13.5px;
  color: #dc2626;
  margin-top: 4px;
  margin-bottom: 8px;
}

.auth-success {
  display: none;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13.5px;
  color: #16a34a;
  margin-top: 4px;
  margin-bottom: 8px;
}

/* ── Password Strength Meter ────────────────────────────────────── */
.password-strength {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pw-bar {
  flex: 1;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}

.pw-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s;
}

.pw-fill-weak   { background: #ef4444; }
.pw-fill-fair   { background: #f59e0b; }
.pw-fill-good   { background: #3b82f6; }
.pw-fill-strong { background: #10b981; }

.pw-label { font-size: 11px; font-weight: 600; min-width: 44px; text-align: right; }
.pw-label-weak   { color: #ef4444; }
.pw-label-fair   { color: #f59e0b; }
.pw-label-good   { color: #3b82f6; }
.pw-label-strong { color: #10b981; }

/* ── Email Verification Success ─────────────────────────────────── */
.auth-verify-message {
  text-align: center;
  padding: 16px 0 8px;
}

.auth-verify-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #f0fdf4;
  border: 2px solid #bbf7d0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #16a34a;
  margin: 0 auto 16px;
}

.auth-verify-message h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--cs-navy);
  margin-bottom: 10px;
}

.auth-verify-message p {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
}

/* ── Nav User Menu ──────────────────────────────────────────────── */
.nav-user-menu {
  position: relative;
  flex-shrink: 0;
}

.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 6px 10px 6px 6px;
  cursor: pointer;
  transition: all 0.15s;
  color: #fff;
}

.nav-user-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(0,212,255,0.4);
}

.nav-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--cs-cyan);
  color: var(--cs-navy);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-user-name {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Tier Badges (nav) ──────────────────────────────────────────── */
.nav-tier-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.3px;
}

.nav-tier-free       { background: rgba(148,163,184,0.15); color: #94a3b8; }
.nav-tier-freemium   { background: rgba(0,212,255,0.12);   color: var(--cs-cyan); }
.nav-tier-monthly    { background: rgba(16,185,129,0.12);  color: #10b981; }
.nav-tier-enterprise { background: rgba(127,119,221,0.15); color: #a78bfa; }

/* ── Nav Dropdown ───────────────────────────────────────────────── */
.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 6px;
  min-width: 220px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: all 0.15s ease;
}

.nav-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-header {
  padding: 8px 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 4px;
}

.nav-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: #334155;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.12s;
  text-decoration: none;
}

.nav-dropdown-item:hover { background: #f8fafc; color: #1e293b; text-decoration: none; }

.nav-dropdown-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 4px 0;
}

.nav-dropdown-signout { color: #ef4444; }
.nav-dropdown-signout:hover { background: #fef2f2; color: #dc2626; }

/* ── Toast Notifications ────────────────────────────────────────── */
#cs-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  pointer-events: none;
}

.cs-toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  animation: cs-toast-in 0.2s ease;
  pointer-events: all;
}

@keyframes cs-toast-in  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }

.cs-toast.cs-toast-exit { animation: cs-toast-out 0.25s ease forwards; }
@keyframes cs-toast-out { to { opacity: 0; transform: translateX(16px); } }

.cs-toast-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.cs-toast-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.cs-toast-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.cs-toast-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

.cs-toast-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.5;
  color: inherit;
  line-height: 1;
  flex-shrink: 0;
}
.cs-toast-close:hover { opacity: 1; }

/* ── Account Page ───────────────────────────────────────────────── */
.account-section { max-width: 900px; margin: 0 auto; }

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.account-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
}

.account-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--cs-cyan);
  color: var(--cs-navy);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.account-card-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 14px;
}

.account-tier-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  margin-top: 10px;
}

.account-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: #334155;
  margin-bottom: 8px;
}

.account-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--cs-cyan);
}

/* ── Form Input Dark (dashboard login) ──────────────────────────── */
.form-input-dark {
  background: rgba(255,255,255,0.06) !important;
  border-color: rgba(255,255,255,0.12) !important;
  color: #fff !important;
}
.form-input-dark::placeholder { color: rgba(255,255,255,0.3) !important; }
.form-input-dark:focus {
  border-color: rgba(0,212,255,0.5) !important;
  background: rgba(255,255,255,0.08) !important;
}

/* ── Freemium Banner (newsletter / intel pages) ─────────────────── */
.freemium-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 14px 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.freemium-banner p {
  font-size: 14px;
  color: #1e40af;
  font-weight: 500;
  margin: 0;
}

/* ── Tier Gate Locked state ─────────────────────────────────────── */
.tier-locked {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .cs-modal-card {
    padding: 28px 20px 24px;
  }

  #cs-toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
  }

  .nav-user-name { display: none; }
  .nav-tier-badge { display: none; }

  .account-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .cs-modal-overlay { padding: 12px; align-items: flex-end; }
  .cs-modal-card {
    border-radius: 16px 16px 0 0;
    padding: 24px 16px 32px;
    max-width: 100%;
    animation: cs-card-slide-up 0.25s cubic-bezier(0.34,1.56,0.64,1);
  }
  @keyframes cs-card-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
}
