/* Reset and base */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Inter", sans-serif;
  background: linear-gradient(135deg, #f0fdf4 0%, #d1fae5 100%);
  color: #1f2937;
  height: 100vh;
  overflow: hidden;
}

/* Main container */
.main-container {
  display: flex;
  height: 100vh;
  width: 100%;
}

/* Left section - Image (40%) */
.image-section {
  flex: 0 0 40%;
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 50%, #10b981 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.image-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  opacity: 0.3;
}

.image-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 1rem;
  max-width: 450px;
}

.main-illustration {
  width: 100%;
  max-width: 320px;
  height: auto;
  margin-bottom: 1.5rem;
  animation: float 6s ease-in-out infinite;
  filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.2));
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-15px);
  }
}

.image-text {
  color: white;
  text-align: center;
}

.image-text h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.75rem 0;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  animation: slideInLeft 1s ease-out;
}

.image-text p {
  font-size: 1rem;
  margin: 0;
  opacity: 0.9;
  line-height: 1.5;
  animation: slideInLeft 1s ease-out 0.3s both;
}

@keyframes slideInLeft {
  0% {
    opacity: 0;
    transform: translateX(-50px);
  }

  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Right section - Login Form (60%) */
.login-section {
  flex: 0 0 60%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #f0fdf4 0%, #d1fae5 100%);
  overflow-y: auto;
}

.container {
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  animation: slideInRight 0.8s ease-out;
}

@keyframes slideInRight {
  0% {
    opacity: 0;
    transform: translateX(50px);
  }

  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #16a34a, #22c55e, #10b981);
  border-radius: 18px 18px 0 0;
  animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {

  0%,
  100% {
    background: linear-gradient(90deg, #16a34a, #22c55e, #10b981);
  }

  50% {
    background: linear-gradient(90deg, #10b981, #16a34a, #22c55e);
  }
}

/* Logo wrapper */
.logo-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.logo-wrapper img {
  width: 140px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
  animation: logoGlow 2s ease-in-out infinite alternate;
}

@keyframes logoGlow {
  0% {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
  }

  100% {
    filter: drop-shadow(0 4px 12px rgba(22, 163, 74, 0.2));
  }
}

/* Title */
.title-wrapper {
  text-align: center;
  margin-bottom: 0.5rem;
}

.title-wrapper h2 {
  font-weight: 700;
  font-size: 1.5rem;
  margin: 0 0 0.25rem 0;
  background: linear-gradient(135deg, #1f2937 0%, #16a34a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleSlide 1s ease-out 0.3s both;
}

@keyframes titleSlide {
  0% {
    opacity: 0;
    transform: translateX(-20px);
  }

  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.title-wrapper p {
  color: #6b7280;
  font-size: 0.9rem;
  margin: 0;
  font-weight: 400;
  animation: titleSlide 1s ease-out 0.5s both;
}

/* Message box */
#messageBox {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.4s ease;
  min-height: 0.8rem;
  padding: 0.4rem;
  border-radius: 10px;
  margin-bottom: 0.25rem;
}

#messageBox.show {
  opacity: 1;
  transform: translateY(0);
}

#messageBox.success {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

#messageBox.error {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Form */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: formFadeIn 1s ease-out 0.7s both;
}

@keyframes formFadeIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Role selector */
#roleSelector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

#roleSelector label {
  cursor: pointer;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.75rem 0.5rem;
  text-align: center;
  transition: all 0.3s ease;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 0.85rem;
  background: #fff;
  position: relative;
  overflow: hidden;
  transform: translateY(0);
  animation: roleButtonsSlide 0.6s ease-out forwards;
}

@keyframes roleButtonsSlide {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

#roleSelector label:nth-child(1) {
  animation-delay: 0.8s;
}

#roleSelector label:nth-child(2) {
  animation-delay: 0.9s;
}

#roleSelector label:nth-child(3) {
  animation-delay: 1s;
}

#roleSelector label::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(22, 163, 74, 0.1), transparent);
  transition: left 0.5s ease;
}

#roleSelector label:hover::before {
  left: 100%;
}

#roleSelector label.selected {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  border-color: #15803d;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(22, 163, 74, 0.3);
}

#roleSelector input[type="radio"] {
  display: none;
}

#roleSelector label:hover:not(.selected) {
  border-color: #16a34a;
  background: #f0fdf4;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.15);
}

/* Input groups */
.input-group {
  position: relative;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.3rem;
}

.input-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.3s ease;
  background: #fff;
  transform: translateX(0);
}

.input-group input:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
  background: #f0fdf4;
  transform: translateX(2px);
}

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

/* Submit button */
#loginBtn {
  width: 100%;
  padding: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: white;
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  animation: buttonPulse 2s ease-in-out infinite alternate;
}

@keyframes buttonPulse {
  0% {
    box-shadow: 0 4px 15px rgba(22, 163, 74, 0.3);
  }

  100% {
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.4);
  }
}

#loginBtn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

#loginBtn:hover::before {
  left: 100%;
}

#loginBtn:hover:not(:disabled) {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.4);
}

#loginBtn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
}

/* Spinner */
#loader {
  width: 1.1rem;
  height: 1.1rem;
  color: white;
  animation: spin 1s linear infinite;
  display: none;
}

#loader.visible {
  display: inline-block;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Footer text */
.footer-text {
  text-align: center;
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.5rem;
}

.footer-text a {
  color: #16a34a;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-text a:hover {
  color: #15803d;
}

/* 14-inch laptop optimization (1366x768 and similar) */
@media (max-width: 1440px) and (min-width: 1200px) {
  .image-section {
    flex: 0 0 35%;
  }

  .login-section {
    flex: 0 0 65%;
    padding: 1.2rem;
  }

  .container {
    max-width: 380px;
    padding: 1.3rem;
  }

  .main-illustration {
    max-width: 280px;
  }

  .image-text h1 {
    font-size: 1.8rem;
  }

  .title-wrapper h2 {
    font-size: 1.4rem;
  }
}

/* Medium laptops and tablets */
@media (max-width: 1200px) and (min-width: 900px) {
  .image-section {
    flex: 0 0 35%;
  }

  .login-section {
    flex: 0 0 65%;
    padding: 1rem;
  }

  .container {
    max-width: 360px;
    padding: 1.2rem;
  }

  .main-illustration {
    max-width: 260px;
  }

  .image-text h1 {
    font-size: 1.7rem;
  }
}

/* 700px to 900px - Reduced login section width */
@media (max-width: 900px) and (min-width: 700px) {

  html,
  body {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .main-container {
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
  }

  .image-section {
    flex: 0 0 50%;
    /* Increased image section */
    min-height: 100vh;
  }

  .login-section {
    flex: 0 0 50%;
    /* Reduced login section */
    min-height: 100vh;
    overflow-y: auto;
    padding: 0.8rem;
  }

  .container {
    max-width: 280px;
    /* Reduced container width */
    padding: 0.9rem;
  }

  .logo-wrapper img {
    width: 100px;
  }

  .main-illustration {
    max-width: 200px;
  }

  .image-text h1 {
    font-size: 1.4rem;
  }

  .image-text p {
    font-size: 0.85rem;
  }

  .title-wrapper h2 {
    font-size: 1.2rem;
  }

  .title-wrapper p {
    font-size: 0.8rem;
  }

  #roleSelector {
    gap: 0.4rem;
  }

  #roleSelector label {
    padding: 0.5rem 0.3rem;
    font-size: 0.7rem;
  }

  .input-group input {
    padding: 0.6rem 0.7rem;
    font-size: 0.8rem;
  }

  #loginBtn {
    padding: 0.6rem;
    font-size: 0.8rem;
  }
}

/* Between 774px to 845px - Optimized layout */
@media (max-width: 845px) and (min-width: 774px) {

  html,
  body {
    height: 100vh;
    overflow: hidden;
  }

  .main-container {
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
  }

  .image-section {
    flex: 0 0 45%;
    min-height: 100vh;
  }

  .login-section {
    flex: 0 0 55%;
    min-height: 100vh;
    overflow-y: auto;
    padding: 0.8rem;
  }

  .container {
    max-width: 320px;
    padding: 0.9rem;
    gap: 0.8rem;
  }

  .logo-wrapper img {
    width: 110px;
  }

  .title-wrapper h2 {
    font-size: 1.3rem;
  }

  .title-wrapper p {
    font-size: 0.85rem;
  }

  #roleSelector {
    gap: 0.5rem;
  }

  #roleSelector label {
    padding: 0.6rem 0.4rem;
    font-size: 0.75rem;
  }

  .input-group input {
    padding: 0.65rem 0.8rem;
    font-size: 0.85rem;
  }

  #loginBtn {
    padding: 0.65rem;
    font-size: 0.85rem;
  }

  .main-illustration {
    max-width: 200px;
  }

  .image-text h1 {
    font-size: 1.4rem;
  }

  .image-text p {
    font-size: 0.85rem;
  }
}

/* Between 769px to 773px - Transition layout */
@media (max-width: 773px) and (min-width: 769px) {

  html,
  body {
    height: 100vh;
    overflow: hidden;
  }

  .main-container {
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
  }

  .image-section {
    flex: 0 0 42%;
    min-height: 100vh;
  }

  .login-section {
    flex: 0 0 58%;
    min-height: 100vh;
    overflow-y: auto;
    padding: 0.7rem;
  }

  .container {
    max-width: 300px;
    padding: 0.8rem;
    gap: 0.7rem;
  }

  .logo-wrapper img {
    width: 100px;
  }

  .title-wrapper h2 {
    font-size: 1.2rem;
  }

  .title-wrapper p {
    font-size: 0.8rem;
  }

  #roleSelector {
    gap: 0.4rem;
  }

  #roleSelector label {
    padding: 0.55rem 0.3rem;
    font-size: 0.7rem;
  }

  .input-group input {
    padding: 0.6rem 0.7rem;
    font-size: 0.8rem;
  }

  #loginBtn {
    padding: 0.6rem;
    font-size: 0.8rem;
  }

  .main-illustration {
    max-width: 180px;
  }

  .image-text h1 {
    font-size: 1.3rem;
  }

  .image-text p {
    font-size: 0.8rem;
  }
}

/* Mobile devices - Hide image section */
@media (max-width: 768px) {

  html,
  body {
    height: 100vh;
    overflow: hidden;
  }

  .main-container {
    flex-direction: column;
    height: 100vh;
  }

  .image-section {
    display: none;
  }

  .login-section {
    flex: 1;
    height: 100vh;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .container {
    width: 100%;
    max-width: 400px;
    padding: 1.5rem;
    border-radius: 16px;
  }

  #roleSelector {
    gap: 0.6rem;
  }

  #roleSelector label {
    padding: 0.65rem 0.4rem;
    font-size: 0.8rem;
  }

  .title-wrapper h2 {
    font-size: 1.4rem;
  }

  .title-wrapper p {
    font-size: 0.9rem;
  }
}

/* Small tablets and large phones */
@media (max-width: 600px) {
  .container {
    max-width: 360px;
    padding: 1.2rem;
  }

  .title-wrapper h2 {
    font-size: 1.3rem;
  }

  .title-wrapper p {
    font-size: 0.85rem;
  }

  .logo-wrapper img {
    width: 120px;
  }

  #roleSelector {
    gap: 0.5rem;
  }

  #roleSelector label {
    padding: 0.6rem 0.3rem;
    font-size: 0.75rem;
  }

  .input-group input {
    padding: 0.7rem 0.9rem;
    font-size: 0.85rem;
  }

  #loginBtn {
    font-size: 0.85rem;
    padding: 0.7rem;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  .login-section {
    padding: 0.8rem;
  }

  .container {
    max-width: 320px;
    padding: 1rem;
    border-radius: 14px;
  }

  .logo-wrapper img {
    width: 100px;
  }

  .title-wrapper h2 {
    font-size: 1.2rem;
  }

  .title-wrapper p {
    font-size: 0.8rem;
  }

  #roleSelector {
    gap: 0.4rem;
  }

  #roleSelector label {
    padding: 0.5rem 0.2rem;
    font-size: 0.7rem;
  }

  .input-group label {
    font-size: 0.8rem;
  }

  .input-group input {
    padding: 0.65rem 0.8rem;
    font-size: 0.8rem;
  }

  #loginBtn {
    font-size: 0.8rem;
    padding: 0.65rem;
  }

  .footer-text {
    font-size: 0.75rem;
  }
}

/* Very small mobile phones */
@media (max-width: 360px) {
  .login-section {
    padding: 0.6rem;
  }

  .container {
    max-width: 280px;
    padding: 0.8rem;
    border-radius: 12px;
  }

  .logo-wrapper img {
    width: 90px;
  }

  .title-wrapper h2 {
    font-size: 1.1rem;
  }

  .title-wrapper p {
    font-size: 0.75rem;
  }

  #roleSelector {
    gap: 0.3rem;
  }

  #roleSelector label {
    padding: 0.4rem 0.15rem;
    font-size: 0.65rem;
  }

  .input-group label {
    font-size: 0.75rem;
  }

  .input-group input {
    padding: 0.6rem 0.7rem;
    font-size: 0.75rem;
  }

  #loginBtn {
    font-size: 0.75rem;
    padding: 0.6rem;
  }

  .footer-text {
    font-size: 0.7rem;
  }

  form {
    gap: 0.8rem;
  }

  #messageBox {
    font-size: 0.8rem;
    padding: 0.3rem;
  }
}