:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --secondary: #a855f7;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  --white: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --glass: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.2);
  --shadow-premium: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  --radius: 20px;
  --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  min-height: 100vh;
  overflow-x: hidden;
  background-color: #0f172a;
}

.auth-wrapper {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-gradient);
  padding: 20px;
}

/* Dynamic Background Elements */
.background-blobs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  width: 500px;
  height: 500px;
  background: var(--primary);
  filter: blur(80px);
  opacity: 0.15;
  border-radius: 50%;
  animation: move 20s infinite alternate;
}

.blob-1 {
  top: -10%;
  left: -10%;
  background: var(--primary);
}

.blob-2 {
  bottom: -10%;
  right: -10%;
  background: var(--secondary);
  animation-delay: -5s;
}

.blob-3 {
  top: 40%;
  left: 30%;
  background: #06b6d4;
  animation-delay: -10s;
}

@keyframes move {
  from {
    transform: translate(0, 0) scale(1);
  }

  to {
    transform: translate(100px, 100px) scale(1.2);
  }
}

/* Main Card */
.content-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1000px;
  height: 600px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  display: flex;
  overflow: hidden;
  box-shadow: var(--shadow-premium);
}

.card-inner {
  position: relative;
  width: 55%;
  height: 100%;
  perspective: 2000px;
  z-index: 5;
}

.side {
  position: absolute;
  width: 100%;
  height: 100%;
  padding: 40px 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.side.back {
  transform: rotateY(180deg);
}

#flip:checked~.content-card .card-inner .front {
  transform: rotateY(-180deg);
}

#flip:checked~.content-card .card-inner .back {
  transform: rotateY(0deg);
}

/* Typography & Content */
.header {
  margin-bottom: 30px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 15px;
}

.brand-logo {
  position: absolute;
  top: 30px;
  left: 35px;
  z-index: 10;
}

.brand-logo i {
  font-size: 2.2rem;
  color: var(--primary);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15));
}

.header-logo {
  height: 50px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.header p {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Form Styling */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 8px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper i {
  position: absolute;
  left: 15px;
  color: var(--text-muted);
  font-size: 1rem;
  transition: var(--transition);
}

.input-wrapper input {
  width: 100%;
  padding: 12px 15px 12px 45px;
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid transparent;
  border-radius: 12px;
  font-size: 1rem;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.input-wrapper input:focus {
  background: var(--white);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.input-wrapper input:focus+i {
  color: var(--primary);
}

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.forgot-link {
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

.forgot-link:hover {
  text-decoration: underline;
}

.error-msg {
  font-size: 0.85rem;
  color: #ef4444;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Mobile Only Header Image */
.mobile-header-image {
  display: none;
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
}

.mobile-header-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mobile-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, transparent, rgba(15, 23, 42, 0.4));
}

.switch-side {
  margin-top: 25px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.switch-side label {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  margin-left: 5px;
}

.switch-side label:hover {
  text-decoration: underline;
}

/* Visual Side */
.side-visual {
  position: relative;
  width: 45%;
  background: url('../../img/auth/frontImg.jpg') center/cover no-repeat;
  display: flex;
  align-items: flex-end;
  padding: 60px;
  z-index: 5;
}

.side-visual .overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.9), transparent);
}

.visual-text {
  position: relative;
  z-index: 6;
  color: var(--white);
}

.visual-text h2 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 10px;
}

/* Responsiveness */
@media (max-width: 900px) {
  .content-card {
    max-width: 520px;
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .side-visual {
    display: none;
  }

  .card-inner {
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
  }

  .mobile-header-image {
    display: block;
  }

  .side {
    position: relative;
    padding: 20px 40px 30px 40px;
    height: auto;
    justify-content: flex-start;
    transform: none !important;
  }

  /* Logic to completely hide inactive form on mobile to resolve height leakage */
  .side.back {
    display: none;
  }

  #flip:checked~.content-card .card-inner .front {
    display: none;
  }

  #flip:checked~.content-card .card-inner .back {
    display: flex;
    transform: none;
  }
}

@media (max-width: 768px) {
  .auth-wrapper {
    padding: 20px 15px;
    align-items: center;
  }

  .content-card {
    border-radius: 16px;
  }

  .side {
    padding: 15px 25px 20px 25px;
  }

  .header {
    margin-top: 10px;
    margin-bottom: 10px;
  }

  .logo {
    gap: 10px;
  }

  .header-logo {
    height: 40px;
  }
}

/* Specific fix for very short viewports like the user's 500x382 */
@media (max-height: 550px) and (max-width: 768px) {
  .auth-wrapper {
    align-items: flex-start;
    padding-top: 10px;
    padding-bottom: 40px;
  }

  .mobile-header-image {
    height: 100px;
  }

  .side {
    padding: 10px 25px 20px 25px !important;
  }

  .header {
    margin-top: 0 !important;
    margin-bottom: 5px !important;
  }

  h1 {
    font-size: 1.3rem;
    margin-bottom: 4px !important;
  }

  .logo {
    font-size: 1.6rem;
    margin-bottom: 4px !important;
    gap: 8px !important;
  }

  .header-logo {
    height: 35px !important;
  }

  p {
    margin-bottom: 4px !important;
    font-size: 0.9rem !important;
  }

  .form-group {
    margin-bottom: 10px !important;
  }

  .form-group label {
    margin-bottom: 4px !important;
    font-size: 0.8rem !important;
  }

  .input-wrapper input {
    padding: 10px 12px 10px 40px !important;
    font-size: 0.9rem !important;
  }

  .btn-primary {
    padding: 10px !important;
  }

  .switch-side {
    margin-top: 10px !important;
  }
}