/* ══════════════════════════════════════════════════════════════════════════════
   AUTHENTICATION STYLES ONLY - NETSUITE INSPIRED
   ══════════════════════════════════════════════════════════════════════════════
   
   This file handles ONLY the login/register authentication screens.
   System buttons and main app UI are styled in style.css (your Firebase design).
   
   Color Palette: NetSuite Dark Blue (#003087)
   ══════════════════════════════════════════════════════════════════════════════ */

/* -------------------- AUTH CONTAINER (Login/Register Screen) -------------------- */
.auth-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('https://images.unsplash.com/photo-1557804506-669a67965ba0?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1920&q=80') center/cover no-repeat fixed;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
  position: relative;
}

.auth-container.show {
  display: flex;
}

/* Dark overlay for readability */
.auth-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1;
  pointer-events: none;
}

/* Subtle vignette effect */
.auth-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, transparent 40%, rgba(0,0,0,0.3) 100%);
  z-index: 1;
  pointer-events: none;
}

/* -------------------- AUTH BOX -------------------- */
.auth-box {
  background: white;
  border-radius: 6px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 100%;
  overflow: hidden;
  animation: fadeInUp 0.4s ease-out;
  position: relative;
  z-index: 2;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* -------------------- AUTH HEADER -------------------- */
.auth-header {
  background: white;
  padding: 28px 32px 20px;
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
}

.auth-logo {
  width: 160px;
  height: auto;
  margin: 0 auto 20px;
  display: block;
}

#authTitle {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.4px;
}

#authSubtitle {
  margin: 0;
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

/* -------------------- AUTH TABS (Login/Register switcher) -------------------- */
.auth-tabs {
  display: flex;
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
}

.auth-tab {
  flex: 1;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.auth-tab:hover {
  background: white;
  color: #374151;
}

.auth-tab.active {
  background: white;
  color: #003087; /* NetSuite Blue */
  border-bottom-color: #003087;
}

/* -------------------- AUTH MESSAGES -------------------- */
.auth-message {
  display: none;
  margin: 20px 32px 0;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
}

.message-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.message-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.message-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.message-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* -------------------- AUTH FORMS (Login/Register/Forgot) -------------------- */
.auth-form {
  display: none;
  padding: 24px 32px 32px;
  background: white;
}

.auth-form.active {
  display: block;
}

.auth-form .form-group {
  margin-bottom: 16px;
}

.auth-form .form-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.auth-form .form-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-sizing: border-box;
  background: white;
}

.auth-form .form-input:hover {
  border-color: #9ca3af;
}

.auth-form .form-input:focus {
  outline: none;
  border-color: #003087;
  box-shadow: 0 0 0 4px rgba(0, 48, 135, 0.1);
}

.auth-form .form-input::placeholder {
  color: #94a3b8;
  font-weight: 500;
}

/* -------------------- PASSWORD STRENGTH INDICATOR -------------------- */
.password-strength-container {
  margin-top: 6px;
}

.password-strength-bar {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

#passwordStrengthBar {
  height: 100%;
  width: 0%;
  transition: all 0.3s ease;
  background: #e5e7eb;
}

#strengthText {
  font-size: 12px;
  font-weight: 600;
}

/* -------------------- AUTH FORM CHECKBOX -------------------- */
.auth-form .checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.auth-form .checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #003087;
}

.auth-form .checkbox-group label {
  font-size: 14px;
  color: #4b5563;
  cursor: pointer;
  user-select: none;
  margin: 0;
}

/* -------------------- AUTH FORM BUTTONS ONLY -------------------- */
/* These styles ONLY apply to buttons INSIDE auth forms */
.auth-form button,
.auth-form .btn-primary,
#loginBtn,
#registerBtn,
#forgotBtn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #003087 0%, #002654 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-shadow: 0 4px 12px rgba(0, 48, 135, 0.2);
}

.auth-form button:hover,
.auth-form .btn-primary:hover,
#loginBtn:hover:not(:disabled),
#registerBtn:hover:not(:disabled),
#forgotBtn:hover:not(:disabled) {
  background: linear-gradient(135deg, #002654 0%, #001f4a 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 48, 135, 0.3);
}

.auth-form button:active,
.auth-form .btn-primary:active,
#loginBtn:active,
#registerBtn:active,
#forgotBtn:active {
  transform: translateY(0);
}

.auth-form button:disabled,
.auth-form .btn-primary:disabled,
#loginBtn:disabled,
#registerBtn:disabled,
#forgotBtn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* -------------------- AUTH LINKS -------------------- */
.auth-form .auth-link,
.auth-footer .auth-link,
#showForgotLink,
#backToLogin {
  color: #003087;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: color 0.2s ease;
  display: inline-block;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.auth-form .auth-link:hover,
.auth-footer .auth-link:hover,
#showForgotLink:hover,
#backToLogin:hover {
  color: #001f4a;
  text-decoration: underline;
}

/* -------------------- AUTH FOOTER -------------------- */
.auth-footer {
  background: #f9fafb;
  padding: 16px 32px;
  border-top: 1px solid #e5e7eb;
  text-align: center;
}

.auth-footer p {
  margin: 0;
  font-size: 13px;
  color: #9ca3af;
}

/* -------------------- LOADING SPINNER (Auth forms only) -------------------- */
.auth-form .spinner-inline {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: authSpin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* -------------------- RESPONSIVE -------------------- */
@media (max-width: 640px) {
  .auth-container {
    padding: 16px;
  }

  .auth-box {
    max-width: none;
    border-radius: 0;
  }

  .auth-header,
  .auth-form,
  .auth-footer {
    padding-left: 24px;
    padding-right: 24px;
  }

  #authTitle {
    font-size: 22px;
  }
}

/* -------------------- ACCESSIBILITY -------------------- */
.auth-form *:focus-visible,
.auth-tabs *:focus-visible {
  outline: 2px solid #003087;
  outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .auth-container *,
  .auth-box * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
