@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700&display=swap");

/* ===== RESET & BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: "Barlow Condensed", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #161616;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

.loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.loading-logo img {
  width: 100px;
  height: auto;
  object-fit: contain;
  opacity: 0.9;
}

.loading-bar {
  width: 200px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.loading-bar::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 50%;
  background: white;
  animation: loading 1.5s infinite ease-in-out;
}

@keyframes loading {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

/* ===== GLOBAL ERROR CONTAINER ===== */
.error-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 500px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.error-container > * {
  pointer-events: auto;
}

/* ===== MAIN LAYOUT ===== */
.login-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* Background covers entire screen on desktop */
.login-background {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.login-background video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Form positioned on the right side */
.login-form-wrapper {
  flex: 0 0 500px;
  width: 500px;
  height: 100vh;
  background-color: rgba(22, 22, 22);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  z-index: 1;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* ===== BRANDING ===== */
.login-branding {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  padding: 2rem 3rem 1.5rem;
  background-color: rgba(22, 22, 22, 0.95);
  backdrop-filter: blur(10px);
  text-align: center;
  z-index: 10;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.login-logo {
  width: 60px;
  height: auto;
  margin-bottom: 1rem;
}

.login-branding h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ===== FORM CONTENT (Scrollable area) ===== */
.form-content {
  flex: 1;
  padding: 0 3rem 3rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(227, 25, 55, 0.5) rgba(255, 255, 255, 0.1);
}

/* Custom scrollbar for form content */
.form-content::-webkit-scrollbar {
  width: 6px;
}

.form-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.form-content::-webkit-scrollbar-thumb {
  background: rgba(227, 25, 55, 0.5);
  border-radius: 3px;
}

.form-content::-webkit-scrollbar-thumb:hover {
  background: rgba(227, 25, 55, 0.7);
}

/* ===== FORM STYLES ===== */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

/* Fixed Icon Positioning */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 16px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
  z-index: 1;
  pointer-events: none;
}

.input-with-icon input {
  width: 100%;
  padding: 15px 15px 15px 48px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1rem;
  transition: all 0.3s ease;
  position: relative;
}

.input-with-icon input:focus {
  outline: none;
  border-color: #e31937;
  background-color: rgba(227, 25, 55, 0.05);
  box-shadow: 0 0 0 3px rgba(227, 25, 55, 0.1);
}

/* Password Toggle */
.toggle-password {
  position: absolute;
  right: 16px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.toggle-password:hover {
  color: #fff;
}

/* ===== FORM OPTIONS ===== */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: -0.25rem;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  user-select: none;
}

.remember-me input {
  width: 16px;
  height: 16px;
  accent-color: #e31937;
}

.forgot-password {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.3s ease;
}

.forgot-password:hover {
  color: #e31937;
  text-decoration: underline;
}

/* ===== BUTTONS ===== */
.login-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: linear-gradient(135deg, #e31937 0%, #c8102e 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.login-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(227, 25, 55, 0.3);
}

.login-button:active:not(:disabled) {
  transform: translateY(0);
}

.login-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== SOCIAL LOGIN ===== */
.social-login-divider {
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.social-login-divider::before,
.social-login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
}

.social-login-divider span {
  padding: 0 1rem;
}

.social-login-options {
  display: flex;
  justify-content: center;
  width: 100%;
}

.social-login-btn {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 6px;
  color: #3c4043;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
}

.social-login-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.social-login-btn:active {
  transform: translateY(0);
}

/* ===== VALIDATION ===== */
.validation-message {
  height: 0;
  overflow: hidden;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  min-height: 0;
}

.validation-message.error {
  height: auto;
  min-height: 24px;
  color: #e31937;
  display: flex;
  align-items: center;
  gap: 3px;
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.validation-message.error i {
  font-size: 0.9rem;
}

.input-with-icon input.invalid {
  border-color: #e31937;
  background-color: rgba(227, 25, 55, 0.05);
}

/* ===== ERROR MESSAGES ===== */
.login-error {
  padding: 16px 20px;
  background: rgba(22, 22, 22, 0.95);
  border: 1px solid #e31937;
  border-radius: 8px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  animation: slideInError 0.3s ease forwards;
  font-size: 0.95rem;
}

@keyframes slideInError {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-error i.fa-exclamation-circle {
  color: #e31937;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.login-error span {
  flex-grow: 1;
}

.error-close {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.error-close:hover {
  color: #fff;
}

/* ===== FOOTER ===== */
.login-footer {
  padding-top: 2rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  flex-shrink: 0;
}

.login-footer a {
  color: #e31937;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* ===== AUTOFILL FIX ===== */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #1a1a1a inset !important;
  -webkit-text-fill-color: #fff !important;
  caret-color: #fff !important;
  border-color: #e31937 !important;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  /* Hide video completely on mobile */
  .login-background {
    display: none !important;
  }

  /* Make form take full screen on mobile */
  .login-form-wrapper {
    position: relative;
    max-width: 100%;
    width: 100%;
    height: 100vh;
    background-color: #161616;
    box-shadow: none;
  }

  /* Adjust branding for mobile */
  .login-branding {
    padding: 1.5rem 2rem 1rem;
    position: relative;
    border-bottom: none;
  }

  .login-branding h1 {
    font-size: 1.6rem;
  }

  /* Adjust form content for mobile */
  .form-content {
    padding: 0 2rem 4rem;
    overflow-y: auto;
    flex: 1;
  }

  /* Better touch targets for mobile */
  .input-with-icon input,
  .login-button,
  .social-login-btn {
    min-height: 50px;
  }

  .toggle-password {
    padding: 8px;
    width: 44px;
    height: 44px;
  }

  /* Prevent scrollbar on mobile form content */
  .form-content::-webkit-scrollbar {
    display: none;
  }

  .form-content {
    scrollbar-width: none;
  }
}

@media (max-width: 480px) {
  .login-branding {
    padding: 1.25rem 1.5rem 1rem;
  }

  .form-content {
    padding: 0 1.5rem 1.5rem;
  }

  .login-branding h1 {
    font-size: 1.4rem;
  }

  .login-logo {
    width: 50px;
    margin-bottom: 0.75rem;
  }

  .form-options {
    align-items: flex-start;
  }

  .forgot-password {
    align-self: flex-end;
  }

  .login-error {
    padding: 14px 16px;
    font-size: 0.9rem;
  }

  .social-login-btn {
    padding: 12px 16px;
    font-size: 0.95rem;
  }

  .social-login-btn i {
    font-size: 1.1rem;
  }
}

/* ================================
   REGISTER ↔ OTP TRANSITION
================================ */

/* Shared animation base */
.login-form {
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.login-form.hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  position: absolute;
  width: 100%;
}

/* OTP specific styling */
.otp-form {
  margin-top: 1rem;
}

.otp-header {
  text-align: center;
  margin-bottom: 2rem;
}

.otp-header h2 {
  font-size: 1.5rem;
  color: #fff;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.otp-header p {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.5;
}

/* OTP actions */
.otp-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
}

.text-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s ease;
}

.text-btn:hover {
  color: #fff;
}

.text-btn.danger:hover {
  color: #e31937;
}

/* ================================
   GLOBAL ALERT SYSTEM
================================ */
#global-alert-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
  width: calc(100% - 32px);
}

/* Base alert */
.global-alert {
  min-width: 320px;
  max-width: 420px;
  padding: 16px 20px;
  border-radius: 10px;
  background: rgba(22, 22, 22, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.35);
  animation: slideInAlert 0.35s ease forwards;
}

/* Icon */
.global-alert i {
  font-size: 1.2rem;
  margin-top: 2px;
}

/* Content */
.global-alert .alert-message {
  flex-grow: 1;
  line-height: 1.4;
}

/* Close button */
.global-alert .alert-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 2px;
  transition: color 0.2s ease;
}

.global-alert .alert-close:hover {
  color: #fff;
}

/* Variants */
.global-alert.error {
  border: 1px solid #e31937;
}

.global-alert.error i {
  color: #e31937;
}

.global-alert.warning {
  border: 1px solid #fbbf24;
}

.global-alert.warning i {
  color: #fbbf24;
}

.global-alert.success {
  border: 1px solid #22c55e;
}

.global-alert.success i {
  color: #22c55e;
}

.global-alert.info {
  border: 1px solid #3b82f6;
}

.global-alert.info i {
  color: #3b82f6;
}

/* Animation */
@keyframes slideInAlert {
  from {
    opacity: 0;
    transform: translateY(-15px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ================================
   OTP FORM — CONSISTENT WITH REGISTER
================================ */

/* OTP form uses same layout rules */
.otp-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Header matches branding style */
.otp-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.otp-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.otp-header p {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
}

/* OTP input behaves like other inputs */
.otp-form .input-with-icon input {
  text-align: center;
  letter-spacing: 0.4em;
  font-size: 1.2rem;
  font-weight: 600;
}

/* Focus effect consistency */
.otp-form .input-with-icon input:focus {
  border-color: #e31937;
  background-color: rgba(227, 25, 55, 0.05);
  box-shadow: 0 0 0 3px rgba(227, 25, 55, 0.12);
}

/* Main OTP button matches register button */
.otp-form .login-button {
  margin-top: 0.75rem;
}

/* OTP actions aligned like form options */
.otp-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
}

/* Text buttons styled like links */
.text-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: color 0.25s ease;
}

.text-btn:hover {
  color: #fff;
}

.text-btn.danger:hover {
  color: #e31937;
}

.password-strength-container {
  margin-top: 6px;
  font-size: 0.85rem;
  display: flex;
  border-radius:6px;
  background:white;
  align-items: center;
  justify-content: space-between;
}

.password-strength-bar {
  flex: 1;
  height: 7px;
  border-radius: 4px;
  overflow: hidden;
  margin-right: 10px;
}

.strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.social-login-btn.google {
  cursor: pointer;
}

.social-login-btn.google:hover {
  cursor: pointer;
}

.social-login-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.social-login-btn.loading i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.hidden {
  display: none;
}
