/* ---
   File: public/css/stylelogin.css
   (Replace the entire content of this file)
--- */

/* --- 1. Reset & Global --- */
:root {
  --primary-color: #55297f;
  --primary-dark: #442166;
  --primary-light: #7F56D9; /* A slightly lighter purple */
  --text-dark: #1D2939;
  --text-light: #475467;
  --bg-split-light: #f3f0f7; /* Very light purple tint */
  --bg-white: #FFFFFF;
  --border-color: #D0D5DD; /* Slightly darker border */
  --border-focus: #a98bce; /* Lighter purple for focus */
  --radius-md: 8px;
  --radius-lg: 16px; /* Larger radius for container */
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* Softer shadow */
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --primary-color-rgb: 85, 41, 127; /* For focus ring */
  --gradient-start: #7F56D9;
  --gradient-end: #55297f;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-split-light); /* Light background */
  color: var(--text-light);
  line-height: 1.6;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px; /* Add padding for small screens */
}

/* --- 2. Login Container --- */
.login-container {
  display: flex;
  width: 100%;
  max-width: 950px; /* Wider container */
  min-height: 600px;
  background-color: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden; /* Important for rounded corners */
}

/* --- 3. Visual Side (Left) --- */
.visual-side {
  flex-basis: 45%; /* Adjust width ratio */
  background: #6D28D9;
  color: var(--bg-white);
  padding: 50px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center; /* Center content vertically */
  align-items: flex-start; /* Align text left */
  position: relative; /* For potential pseudo-elements */
}
.visual-side::before { /* Subtle pattern overlay */
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 15px 15px;
    opacity: 0.5;
    pointer-events: none;
}

.visual-content {
    position: relative; /* Ensure content is above pseudo-element */
    z-index: 1;
}

/* --- NEW SVG LOGO STYLES --- */
.logo-visual-svg {
    display: inline-block;
    color: var(--bg-white); /* SVG uses currentColor */
    width: 80px; /* Adjust size as needed */
    height: auto;
    margin-bottom: 24px;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}
.logo-visual-svg:hover {
    opacity: 1;
}
/* --- END SVG LOGO STYLES --- */

.visual-side h2 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.3;
}

.visual-side p {
  font-size: 16px;
  opacity: 0.85;
  max-width: 300px;
}

/* --- 4. Form Side (Right) --- */
.form-side {
  flex-basis: 55%; /* Adjust width ratio */
  padding: 40px 60px; /* More padding */
  display: flex;
  justify-content: center;
  align-items: center;
}

.form-wrapper {
    width: 100%;
    max-width: 360px; /* Max width for the form itself */
    text-align: center;
}


/* --- 5. Welcome Text --- */
.welcome {
  margin-bottom: 32px; /* Increased space */
  text-align: left; /* Align text left */
}

.welcome h1 {
  font-size: 28px; /* Larger heading */
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.welcome p {
  font-size: 16px; /* Slightly larger paragraph */
  color: var(--text-light);
}

/* --- 6. Form --- */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 24px; /* Increased gap */
  width: 100%;
  text-align: left;
}

/* --- 7. Input Fields --- */
.input-field {
  position: relative;
  width: 100%;
}

.input-field input {
  width: 100%;
  padding: 14px 16px 14px 44px; /* Adjusted padding for icon */
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-dark);
  font-size: 16px;
  background-color: var(--bg-white);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  line-height: 1.5; /* Ensure consistent line height */
}

.input-field input:focus {
  outline: none;
  border-color: var(--border-focus); /* Use lighter focus color */
  box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

/* Floating Label Styles */
.input-field label {
  position: absolute;
  top: 15px; /* Adjust vertical position */
  left: 44px; /* Adjust horizontal position for icon */
  font-size: 16px;
  color: var(--text-light);
  transition: all 0.2s ease;
  pointer-events: none;
  background: var(--bg-white);
  padding: 0 5px;
}

.input-field input:focus + label,
.input-field input:not(:placeholder-shown) + label {
  top: -10px; /* Move label up */
  left: 40px; /* Adjust left slightly */
  font-size: 12px;
  color: #6D28D9;
}
/* Input Icon */
.input-icon {
    position: absolute;
    left: 14px;
    /* Vertically center the icon more reliably */
    top: 0;
    bottom: 0;
    margin: auto 0;
    height: 20px; /* Explicit height */
    width: 20px; /* Explicit width */
    color: var(--text-light);
    opacity: 0.6;
    pointer-events: none; /* Make icon non-interactive */
    transition: color 0.2s ease, opacity 0.2s ease;
}

.input-field input:focus ~ .input-icon {
    color:#6D28D9;
    opacity: 1;
}

/* --- 8. Forgot Password Link --- */
.forgot-link-container {
  text-align: right;
  /* Pull the link up to be closer to the password field, overriding the form's gap */
  margin-top: -16px; 
  margin-bottom: 0; /* Let form gap handle space below */
}

.forgot-link {
  font-size: 14px; /* Slightly larger */
  color: #6D28D9;
  text-decoration: none;
  font-weight: 500;
}

.forgot-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* --- 9. Login Button --- */
.btn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px; /* Space between text and icon/loader */
  width: 100%;
  padding: 14px 20px; /* Larger padding */
  background:#6D28D9;
  color: var(--bg-white);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative; /* For loader positioning */
  overflow: hidden;
}

.btn-login::before { /* Subtle hover glow */
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: var(--radius-md);
}

.btn-login:hover::before {
    opacity: 1;
}

.btn-login:hover {
  box-shadow: 0 4px 15px rgba(var(--primary-color-rgb), 0.3);
  transform: translateY(-2px);
}
.btn-login:active {
  transform: translateY(0);
   box-shadow: 0 2px 5px rgba(var(--primary-color-rgb), 0.2);
}
.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn-login:disabled::before {
    opacity: 0;
}

.btn-icon {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.btn-login:hover .btn-icon {
    transform: translateX(3px);
}

/* Loading Spinner */
.loader {
  display: inline-block;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  width: 18px;
  height: 18px;
  animation: spin 1s ease-in-out infinite;
}

.loader.hidden {
  display: none;
}

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


/* --- 10. Register Link --- */
.register-link-container {
  margin-top: 32px; /* Increased space */
  text-align: center;
}

.register-text {
  font-size: 14px; /* Slightly larger */
  color: var(--text-light);
}

.register-link {
  color: var(--primary-color);
  font-size: 14px;
  text-decoration: none;
  font-weight: 600; /* Bolder link */
  margin-left: 4px;
  transition: color 0.2s ease;
}

.register-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* --- 11. Flash Messages --- */
.flash-container {
    position: fixed; /* Keep fixed */
    top: 20px; /* Position from top */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%);
    width: auto; /* Auto width */
    max-width: 500px;
    z-index: 1001; /* Above everything */
    display: flex;
    flex-direction: column;
    gap: 10px; /* Space between multiple messages */
}

.flash-message {
  padding: 14px 20px; /* Slightly more padding */
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  opacity: 0;
  transform: translateY(-20px); /* Start slightly above */
  transition: opacity 0.3s ease, transform 0.3s ease;
  width: 100%; /* Take width from container */
  pointer-events: none; /* Initially non-interactive */
}
.flash-message.show {
  opacity: 1;
  transform: translateY(0); /* Animate into view */
  pointer-events: auto; /* Allow interaction once shown */
}

.flash-message.success {
  background-color: #E6F7F0; /* Lighter green */
  color: #065F46; /* Dark green text */
  border-left: 4px solid #10B981; /* Green accent border */
}

.flash-message.error {
  background-color: #FEF2F2; /* Lighter red */
  color: #991B1B; /* Dark red text */
  border-left: 4px solid #EF4444; /* Red accent border */
}

.flash-message .close-btn {
  background: none;
  border: none;
  color: inherit; /* Use parent color */
  opacity: 0.7;
  font-size: 20px;
  cursor: pointer;
  padding: 0 0 0 15px; /* Space before button */
  line-height: 1;
}
.flash-message .close-btn:hover {
    opacity: 1;
}


/* --- 12. Responsiveness --- */
@media (max-width: 850px) {
  .login-container {
    flex-direction: column;
    max-width: 450px; /* Max width for single column */
    min-height: auto; /* Auto height */
  }

  .visual-side {
    display: none; /* Hide visual side on smaller screens */
  }

  .form-side {
    flex-basis: 100%;
    padding: 40px 30px; /* Adjust padding */
  }
  .form-wrapper {
      max-width: none; /* Allow form to use full width */
  }
}

@media (max-width: 480px) {
  body {
      padding: 0; /* Remove body padding on smallest screens */
  }
  .login-container {
      border-radius: 0; /* Full width card */
      box-shadow: none;
      min-height: 100vh; /* Ensure it takes full height */
      justify-content: center;
  }
   .form-side {
    padding: 30px 20px; /* Further reduce padding */
  }
  .welcome h1 {
    font-size: 24px;
  }
  .welcome p {
    font-size: 15px;
  }
  .login-form {
    gap: 20px;
  }
   .input-field input, .btn-login {
    font-size: 15px;
  }
   .input-field label {
    font-size: 15px;
   }
   /* Adjust icon position slightly for smaller inputs */
   .input-icon {
       left: 12px;
       width: 18px;
       height: 18px;
   }
    .input-field input {
       padding-left: 40px;
   }
   .input-field label {
       left: 40px;
   }
   .input-field input:focus + label,
   .input-field input:not(:placeholder-shown) + label {
       left: 36px;
   }

   .forgot-link {
       font-size: 13px;
   }
   .register-text, .register-link {
    font-size: 14px;
  }
  .flash-container {
      width: calc(100% - 30px); /* Full width minus padding */
      left: 15px;
      transform: translateX(0);
      top: 15px;
  }
  .flash-message {
      font-size: 14px;
      padding: 12px 15px;
  }
}