/* ===== PERFECT RESPONSIVE LOGIN DESIGN ===== */

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8f9fa;
  color: #333;
  height: 100%;
  overflow: hidden; /* Prevent scrolling */
  line-height: 1.6;
}

/* ===== DESKTOP DESIGN ===== */
.auth-container {
  display: flex;
  flex-direction: row;
  height: 100vh; /* Fixed height */
  background-color: #ffffff;
  position: relative;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.08);
  overflow: hidden; /* Prevent container scrolling */
}

/* Logo */
.logo {
  position: absolute;
  top: 25px;
  left: 30px;
  font-weight: 700;
  font-size: 28px;
  color: #333;
  z-index: 100;
  text-decoration: none;
}

/* Desktop Form Area */
.auth-left {
  width: 55%;
  padding: 40px 50px; /* Reduced padding */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #ffffff;
  height: 100vh; /* Fixed height */
  position: relative;
  overflow: hidden; /* No scrolling */
}

/* Desktop Image Area - PERFECTLY POSITIONED */
.auth-right {
  width: 45%;
  background-image: url('/static/media/login.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  position: relative;
  height: 100vh; /* Fixed height */
  background-color: #f0f4ff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.auth-right::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(78, 110, 242, 0.08) 0%, rgba(78, 110, 242, 0.03) 100%);
  pointer-events: none;
}

/* Content Wrapper */
.content-wrapper {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

/* Form Styling */
.login-section {
  background: #ffffff;
  padding: 30px 25px; /* Reduced padding */
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.08);
  width: 100%;
  position: relative;
  backdrop-filter: blur(10px);
  /* max-height: 80vh; Limit height */
  overflow: hidden; /* No scrolling */
}

.login-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #333;
  border-radius: 20px 20px 0 0;
}

/* Typography */
h1 {
  font-size: 28px; /* Reduced size */
  margin-bottom: 8px; /* Reduced margin */
  text-align: center;
  color: #333;
  font-weight: 700;
  line-height: 1.2;
}

.highlight {
  color: #4e6ef2;
  font-weight: 700;
}

/* Tab Navigation */
.tab-container {
  margin-top: 15px; /* Reduced margin */
  width: 100%;
}

.tab-nav {
  display: flex;
  gap: 10px; /* Reduced gap */
  margin-bottom: 20px; /* Reduced margin */
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1vh;
}

.tab-btn {
  background-color: #f8f9fa;
  padding: 12px 28px;
  border-radius: 50px;
  border: 2px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 15px;
  min-width: 130px;
  text-align: center;
  color: #666;
  position: relative;
  overflow: hidden;
}

.tab-btn:hover {
  background-color: #e9ecef;
  border-color: #4e6ef2;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(78, 110, 242, 0.15);
}

.tab-btn.active {
  background-color: #333;
  color: white;
  border-color: #4e6ef2;
  box-shadow: 0 6px 20px rgba(78, 110, 242, 0.3);
  transform: translateY(-2px);
}

/* Form Elements */
form {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 5px;
}

label {
  font-weight: 600;
  margin-top: 10px; /* Reduced margin */
  margin-bottom: 6px; /* Reduced margin */
  color: #333;
  font-size: 14px;
  letter-spacing: 0.5px;
}

input, select, textarea {
  padding: 12px 14px; /* Further reduced padding */
  border: 2px solid #e8ecef;
  border-radius: 12px;
  margin-bottom: 6px; /* Reduced margin */
  width: 100%;
  font-size: 15px;
  background-color: #ffffff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  color: #333;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: #4e6ef2;
  box-shadow: 0 0 0 4px rgba(78, 110, 242, 0.1);
  background-color: #ffffff;
  transform: translateY(-1px);
}

button, button[type="submit"] {
  /* margin-top: 20px; Reduced margin */
  padding: 14px 35px; /* Reduced padding */
  background: #333;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 600;
  align-self: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* min-width: 180px; Reduced width */
  box-shadow: 0 6px 20px rgba(78, 110, 242, 0.3);
  letter-spacing: 0.5px;
}

button:hover {
  background: #333;
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(78, 110, 242, 0.4);
}

/* Form Layout */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px; /* Reduced gap */
  margin-bottom: 8px; /* Reduced margin */
}

.form-group {
  display: flex;
  flex-direction: column;
}

.full-width {
  grid-column: 1 / -1;
}

/* ===== TABLET RESPONSIVE (769px - 1023px) ===== */
@media screen and (min-width: 769px) and (max-width: 1023px) {
  .auth-left {
    width: 60%;
    padding: 40px 35px;
  }

  .auth-right {
    width: 40%;
    background-size: contain;
    background-position: center center;
  }

  .content-wrapper {
    max-width: 450px;
  }

  .login-section {
    padding: 30px;
    border-radius: 16px;
  }

  h1 {
    font-size: 28px;
    margin-bottom: 8px;
  }
}

/* ===== MOBILE RESPONSIVE DESIGN (≤768px) ===== */
@media screen and (max-width: 768px) {
  body, html {
    background-color: #f8f9fa;
    overflow: hidden; /* No scrolling on mobile */
  }

  .auth-container {
    flex-direction: column;
    height: 100vh; /* Fixed height */
    box-shadow: none;
    background-color: #f8f9fa;
    overflow: hidden; /* No container scrolling */
    position: relative;
  }

  /* MOBILE: Image Section First (Top 50%) */
  .auth-right {
    width: 100%;
    height: 50vh; /* Fixed height */
    background-size: cover;
    background-position: center center;
    background-color: #f0f4ff;
    background-repeat: no-repeat;
    order: 1;
    position: relative;
    border-radius: 0;
    box-shadow: none;
    margin-top: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .auth-right::after {
    background: linear-gradient(135deg, rgba(78, 110, 242, 0.08) 0%, rgba(78, 110, 242, 0.04) 100%);
    border-radius: 0;
  }

  /* MOBILE: Forms Section Overlapping (Bottom 50% + Overlap) */
  .auth-left {
    width: 100%;
    height: 60vh; /* Slightly more to create overlap */
    padding: 0 20px 20px; /* No top padding */
    background-color: transparent;
    position: relative;
    overflow: hidden; /* No scrolling */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    order: 2;
    z-index: 10;
    margin-top: -10vh; /* Overlap the image */
  }  /* Mobile Content */
  .content-wrapper {
    width: 100%;
    max-width: 380px; /* Reduced width */
    margin: 0 auto;
    height: 100%; /* Full height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 20px; /* Add top padding for overlap */
  }

  /* Mobile Logo - Position on Image */
  .logo {
    position: absolute;
    top: 25px; /* Position on image */
    left: 25px;
    font-size: 24px;
    color: #ffffff; /* White text on image */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); /* Shadow for readability */
    z-index: 50;
    font-weight: 700;
  }

  /* Mobile Login Section - Floating Above Image */
  .login-section {
    padding: 25px; /* Good padding for mobile */
    background: #ffffff;
    border-radius: 25px; /* Large radius for modern look */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15); /* Strong shadow for floating effect */
    border: 1px solid rgba(0, 0, 0, 0.06);
    margin: 0;
    width: 100%;    position: relative;
    max-height: none; /* Remove height restriction */
    overflow: hidden; /* Prevent content overflow */
    backdrop-filter: blur(20px); /* Enhanced blur for glass effect */
  }
  .login-section::before {
    height: 4px; /* Prominent accent */
    border-radius: 25px 25px 0 0;
  }
  
  /* Handle signup forms overflow */
  #signup {
    max-height: 60vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  }

  /* Hide scrollbar but allow scrolling within signup tab only */
  #signup::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  /* More compact form layout for signup forms */
  .form-row {
    margin-bottom: 5px;
  }

  .form-group {
    margin-bottom: 5px;
  }

  /* More compact textarea */
  textarea {
    height: 60px;
    min-height: 60px;
  }
  
  /* Mobile Typography */
  h1 {
    font-size: 24px; /* Slightly larger for prominence */
    text-align: center;
    margin-bottom: 10px;
    color: #333;
    margin-top: 0;
    line-height: 1.3;
  }

  /* Mobile Tab Navigation */
  .tab-container {
    margin-top: 12px;
  }

  .tab-nav {
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
    margin-top: 1vh;
  }

  .tab-btn {
    flex: 1;
    min-width: 115px;
    max-width: 145px;
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 50px;
  }

  .tab-btn.active {
    transform: translateY(-1px);
  }  /* Mobile Form Layout */
  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 6px;
  }

  /* Mobile Form Inputs */
  input, select, textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: 12px;
    margin-bottom: 10px;
  }

  /* Mobile Button */
  button, button[type="submit"] {
    width: 100%;
    padding: 14px 22px;
    font-size: 16px;
    border-radius: 12px;
    /* margin-top: 18px; */
    min-width: unset;
  }

  /* Mobile Labels */
  label {
    font-size: 14px;
    margin-top: 10px;
    margin-bottom: 6px;
  }
}

/* ===== SMALL MOBILE (≤480px) ===== */
@media screen and (max-width: 480px) {
  .auth-right {
    height: 45vh; /* Adjusted height */
  }

  .auth-left {
    height: 65vh; /* Adjusted height */
    padding: 0 15px 15px;
    margin-top: -10vh; /* Maintain overlap */
  }

  .content-wrapper {
    max-width: 100%;
    padding-top: 15px;
  }

  .logo {
    font-size: 22px;
    top: 20px;
    left: 20px;
  }

  .login-section {
    padding: 22px;
    border-radius: 22px;
  }

  h1 {
    font-size: 22px;
    margin-bottom: 8px;
  }

  .tab-btn {
    min-width: 105px;
    padding: 10px 16px;
    font-size: 13px;
  }

  input, select, textarea {
    padding: 13px 15px;
    font-size: 16px;
  }

  button, button[type="submit"] {
    padding: 13px 20px;
    font-size: 15px;
  }
}

/* ===== EXTRA SMALL MOBILE (≤360px) ===== */
@media screen and (max-width: 360px) {
  .auth-right {
    height: 40vh; /* Adjusted height */
  }

  .auth-left {
    height: 70vh; /* Adjusted height */
    padding: 0 12px 12px;
    margin-top: -10vh; /* Maintain overlap */
  }

  .content-wrapper {
    padding-top: 12px;
  }

  .logo {
    font-size: 20px;
    top: 15px;
    left: 15px;
  }

  .login-section {
    padding: 20px;
    border-radius: 20px;
  }

  h1 {
    font-size: 20px;
    margin-bottom: 6px;
  }

  .tab-nav {
    gap: 8px;
    margin-top: 1vh;
  }

  .tab-btn {
    min-width: 95px;
    padding: 9px 14px;
    font-size: 12px;
  }

  input, select, textarea {
    padding: 12px 14px;
    font-size: 16px;
  }

  button, button[type="submit"] {
    padding: 12px 18px;
    font-size: 14px;
  }
}

/* ===== LANDSCAPE MOBILE ORIENTATION ===== */
@media screen and (max-width: 768px) and (orientation: landscape) {
  .auth-right {
    height: 55vh; /* More space for image in landscape */
  }

  .auth-left {
    height: 55vh; /* Adjusted for landscape */
    margin-top: -10vh; /* Maintain overlap */
  }

  .content-wrapper {
    padding-top: 15px;
  }

  .login-section {
    padding: 18px;
  }

  h1 {
    font-size: 20px;
    margin-bottom: 6px;
  }

  .tab-container {
    margin-top: 8px;
  }

  .tab-nav {
    margin-bottom: 12px;
    margin-top: 1vh;
  }

  .tab-btn {
    padding: 8px 14px;
    font-size: 12px;
  }

  input, select, textarea {
    padding: 11px 13px;
  }

  button, button[type="submit"] {
    padding: 11px 18px;
    /* margin-top: 14px; */
  }
}

/* ===== PERFECT IMAGE POSITIONING UTILITIES ===== */

/* High Resolution Display Support */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
  .auth-right {
    background-image: url('/static/media/login@2x.png'), url('/static/media/login.png');
  }
}

/* Image Display Options */
.auth-right.image-contain {
  background-size: contain !important;
}

.auth-right.image-cover {
  background-size: cover !important;
}

.auth-right.image-custom {
  background-size: 90% auto !important;
  background-position: center center !important;
}

/* Perfect Image Sync Across Devices */
@media screen and (min-width: 769px) {
  .auth-right {
    background-attachment: scroll;
    background-size: cover;
  }
}

@media screen and (max-width: 768px) {
  .auth-right {
    background-attachment: scroll;
    background-size: contain;
  }
}

/* Accessibility & Performance */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print Styles */
@media print {
  .auth-container {
    box-shadow: none;
    background: white;
  }
  
  .auth-right {
    display: none;
  }
    .auth-left {
    width: 100%;
    padding: 20px;
  }
}

/* Extra Small Mobile Screens */
@media (max-width: 375px) {
  .login-section {
    padding: 15px;
    margin-top: -50vh; /* Move form higher up to maximize space */
  }
  
  input, select, textarea {
    padding: 8px 10px; /* Minimal padding */
    margin-bottom: 5px;
    font-size: 13px;
  }
  
  label {
    font-size: 11px;
    margin-top: 5px;
    margin-bottom: 3px;
  }
  
  h1 {
    font-size: 18px;
    margin-bottom: 8px;
  }
  
  .tab-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  /* Further optimize signup form elements */
  .form-row {
    margin-bottom: 2px;
  }
  
  .form-group {
    margin-bottom: 2px;
  }
  
  button[type="submit"] {
    padding: 8px;
    margin-top: 8px;
  }
}

/* Tab Content Animations */
.tab-content {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-content.active {
  display: block;
  opacity: 1;  transform: translateY(0);
}

/* Landscape Mode Optimization */
@media (max-height: 600px) and (orientation: landscape) {
  body, html {
    height: 100%;
    overflow: hidden;
  }
  
  .auth-container {
    flex-direction: row;
    height: 100vh;
  }
  
  .auth-left {
    width: 60%;
    height: 100vh;
    padding: 15px;
  }
  
  .auth-right {
    width: 40%;
    height: 100vh;
  }
  
  .login-section {
    margin-top: 0;
    padding: 15px;
    max-height: 90vh;
    overflow: scroll;
  }
  
  /* Super compact elements for landscape */
  input, select, textarea {
    padding: 6px 8px;
    margin-bottom: 4px;
    font-size: 12px;
  }
  
  label {
    font-size: 10px;
    margin-top: 4px;
    margin-bottom: 2px;
  }
  
  h1 {
    font-size: 16px;
    margin-bottom: 6px;
  }
  
  /* Allow internal scrolling just for the signup tab in landscape */
  #signup {
    max-height: 70vh;
    overflow: auto;
  }
}

/* Focus States for Accessibility */
input:focus, select:focus, textarea:focus, button:focus {
  outline: 3px solid rgba(78, 110, 242, 0.3);
  outline-offset: 2px;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 350px;
  pointer-events: none;
}

.toast {
  padding: 15px 45px 15px 15px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  color: #333;
  background-color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 10px;
  animation: slideInToast 0.3s ease-out forwards;
  border-left: 4px solid #ccc;
  word-wrap: break-word;
  pointer-events: auto;
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.4;
}

.toast.success {
    border-left-color: #000000;
  }

.toast.info {
    border-left-color: #000000;
  }

.toast.warning {
    border-left-color: #000000;
  }

.toast.error {
    border-left-color: #000000;
  }

.toast-close {
  position: absolute;
  /* top: 50%; */
  right: 12px;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #666;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, sans-serif;
}

.toast-close:hover {
  color: #333;
  background-color: rgba(0, 0, 0, 0.1);
  transform: translateY(-50%) scale(1.1);
}

.toast-close:focus {
  outline: 2px solid rgba(78, 110, 242, 0.5);
  outline-offset: 1px;
}

@keyframes slideInToast {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOutToast {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Mobile Toast Adjustments */
@media screen and (max-width: 768px) {
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .toast {
    padding: 12px 40px 12px 12px;
    font-size: 13px;
    border-radius: 6px;
  }
  
  .toast-close {
    right: 10px;
    width: 22px;
    height: 22px;
    font-size: 18px;
  }
}

@media screen and (max-width: 480px) {
  .toast-container {
    top: 5px;
    right: 5px;
    left: 5px;
  }
  
  .toast {
    padding: 10px 35px 10px 10px;
    font-size: 12px;
  }
  
  .toast-close {
    right: 8px;
    width: 20px;
    height: 20px;
    font-size: 16px;
  }
}
