@import url("https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #1e3a5f;
  --secondary-color: #d4af37;
  --dark-blue: #1e3a5f;
  --accent-blue: #2d4a6f;
  --light-bg: #F0F4FA;
  --success-color: #10b981;
  --text-dark: #1f2937;
  --text-light: #6b7280;
  --bg-light: #f8fafc;
  --white: #ffffff;
  --gradient-primary: linear-gradient(135deg, #1e3a5f 0%, #2d4a6f 100%);
  --gradient-accent: linear-gradient(135deg, #d4af37 0%, #e8c547 100%);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

body,
input {
  font-family: "Cairo", sans-serif;
}

.messages-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: 500px;
  width: 90%;
}

.message {
  padding: 12px 20px;
  margin-bottom: 10px;
  border-radius: 8px;
  font-family: "Cairo", sans-serif;
  font-size: 0.95rem;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.error {
  background-color: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.message.success {
  background-color: #d1fae5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.message.warning {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.message.info {
  background-color: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.message a {
  color: inherit;
  font-weight: bold;
  text-decoration: underline;
}

.auth-container {
  position: relative;
  width: 100%;
  background-color: #fff;
  min-height: 100vh;
  overflow: hidden;
}

.forms-container {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.signin-signup {
  position: absolute;
  top: 50%;
  transform: translate(50%, -50%);
  right: 75%;
  left: auto;
  width: 50%;
  transition: 1s 0.7s ease-in-out;
  display: grid;
  grid-template-columns: 1fr;
  z-index: 5;
  max-height: 95vh;
  overflow-y: auto;
  padding: 20px 0;
}

/* Improved scrollbar styling */
.signin-signup::-webkit-scrollbar {
  width: 8px;
}

.signin-signup::-webkit-scrollbar-track {
  background: rgba(30, 58, 95, 0.05);
  border-radius: 10px;
}

.signin-signup::-webkit-scrollbar-thumb {
  background: rgba(30, 58, 95, 0.2);
  border-radius: 10px;
}

.signin-signup::-webkit-scrollbar-thumb:hover {
  background: rgba(30, 58, 95, 0.3);
}

form {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 2rem 5rem;
  transition: all 0.2s 0.7s;
  overflow: visible;
  grid-column: 1 / 2;
  grid-row: 1 / 2;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(30, 58, 95, 0.15);
  backdrop-filter: blur(10px);
  max-width: 100%;
}

form.sign-up-form {
  opacity: 0;
  z-index: 1;
  padding: 2rem 4rem;
}

form.sign-in-form {
  z-index: 2;
}

.title {
  font-size: 2rem;
  color: var(--dark-blue);
  margin-bottom: 15px;
  font-family: "Cairo", sans-serif;
  font-weight: 800;
}

.title i {
  color: var(--primary-color);
  margin-left: 0.5rem;
}

.input-field {
  max-width: 380px;
  width: 100%;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  margin: 8px 0;
  height: 55px;
  border-radius: 16px;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  padding: 0 1.5rem;
  position: relative;
  border: 2px solid #e2e8f0;
  box-shadow: 0 4px 15px rgba(30, 58, 95, 0.08);
  transition: all 0.3s ease;
}

.input-field i {
  color: var(--accent-blue);
  transition: all 0.3s ease;
  font-size: 1.2rem;
  margin-left: 12px;
}

.input-field:focus-within i {
  color: var(--primary-color);
  transform: scale(1.1);
}

.input-field input {
  flex: 1;
  background: none;
  outline: none;
  border: none;
  line-height: 55px;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-dark);
  text-align: right;
  font-family: "Cairo", sans-serif;
}

.input-field:hover {
  border-color: var(--secondary-color);
  box-shadow: 0 6px 20px rgba(30, 58, 95, 0.12);
  transform: translateY(-2px);
}

.input-field:focus-within {
  border-color: var(--primary-color);
  background: #ffffff;
  box-shadow: 0 8px 25px rgba(30, 58, 95, 0.2);
  transform: translateY(-2px);
}

.input-field input::placeholder {
  color: var(--text-light);
  font-weight: 500;
  font-family: "Cairo", sans-serif;
}

.social-text {
  padding: 0.8rem 0;
  font-size: 0.9rem;
  font-family: "Cairo", sans-serif;
  color: var(--text-light);
  position: relative;
  margin-top: 10px;
}

.social-text::before,
.social-text::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 60px;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(30, 58, 95, 0.3), transparent);
}

.social-text::before {
  right: -70px;
}

.social-text::after {
  left: -70px;
}

.social-media {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.social-icon {
  height: 46px;
  width: 46px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 0.4rem;
  color: var(--accent-blue);
  border-radius: 14px;
  border: 2px solid #e2e8f0;
  text-decoration: none;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(30, 58, 95, 0.08);
}

.social-icon:hover {
  color: #ffffff;
  background: var(--gradient-primary);
  border-color: var(--primary-color);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(30, 58, 95, 0.3);
}

.auth-btn {
  width: 170px;
  background: var(--gradient-primary);
  background-size: 200% 100%;
  border: none;
  outline: none;
  height: 50px;
  border-radius: 16px;
  color: #fff;
  text-transform: uppercase;
  font-weight: 700;
  margin: 12px 0;
  cursor: pointer;
  transition: all 0.4s ease;
  font-family: "Cairo", sans-serif;
  font-size: 0.95rem;
  box-shadow: 0 8px 25px rgba(30, 58, 95, 0.3);
  position: relative;
  overflow: hidden;
}

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

.auth-btn:hover::before {
  left: 100%;
}

.auth-btn:hover {
  background: var(--gradient-accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(30, 58, 95, 0.4);
}

.auth-btn:active {
  transform: translateY(-1px);
}

.panels-container {
  position: absolute;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.auth-container:before {
  content: "";
  position: absolute;
  height: 2000px;
  width: 2000px;
  top: -10%;
  left: 48%;
  right: auto;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #1e3a5f 0%, #2d4a6f 50%, #3d5a7f 100%);
  transition: 1.8s ease-in-out;
  border-radius: 50%;
  z-index: 6;
  box-shadow: 0 20px 60px rgba(30, 58, 95, 0.4);
}

.image {
  width: 100%;
  max-width: 350px;
  transition: transform 1.1s ease-in-out;
  transition-delay: 0.4s;
}

.panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-around;
  text-align: center;
  z-index: 6;
}

.right-panel {
  pointer-events: all;
  padding: 3rem 12% 2rem 17%;
}

.left-panel {
  pointer-events: none;
  padding: 3rem 17% 2rem 12%;
}

.panel .content {
  color: #fff;
  transition: transform 0.9s ease-in-out;
  transition-delay: 0.6s;
  text-align: right;
}

.panel h3 {
  font-weight: 800;
  line-height: 1.2;
  font-size: 1.6rem;
  font-family: "Cairo", sans-serif;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.panel p {
  font-size: 0.95rem;
  padding: 0.8rem 0;
  font-family: "Cairo", sans-serif;
  opacity: 0.95;
  line-height: 1.6;
}

.auth-btn.transparent {
  margin: 0;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.8);
  width: 130px;
  height: 42px;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.auth-btn.transparent:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.left-panel .image,
.left-panel .content {
  transform: translateX(-800px);
}

.auth-container.sign-up-mode:before {
  transform: translate(-100%, -50%);
  left: 52%;
}

.auth-container.sign-up-mode .right-panel .image,
.auth-container.sign-up-mode .right-panel .content {
  transform: translateX(800px);
}

.auth-container.sign-up-mode .signin-signup {
  right: 25%;
  left: auto;
}

.auth-container.sign-up-mode form.sign-up-form {
  opacity: 1;
  z-index: 2;
}

.auth-container.sign-up-mode form.sign-in-form {
  opacity: 0;
  z-index: 1;
}

.auth-container.sign-up-mode .left-panel .image,
.auth-container.sign-up-mode .left-panel .content {
  transform: translateX(0%);
}

.auth-container.sign-up-mode .right-panel {
  pointer-events: none;
}

.auth-container.sign-up-mode .left-panel {
  pointer-events: all;
}

/* Animation for form elements */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.input-field {
  animation: fadeInUp 0.5s ease forwards;
}

.input-field:nth-child(1) { animation-delay: 0.1s; }
.input-field:nth-child(2) { animation-delay: 0.2s; }
.input-field:nth-child(3) { animation-delay: 0.3s; }
.input-field:nth-child(4) { animation-delay: 0.4s; }

/* Focus ring effect */
.input-field:focus-within::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 20px;
  border: 2px solid rgba(30, 58, 95, 0.3);
  pointer-events: none;
}

/* Button loading state */
.auth-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.auth-btn.loading::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

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

/* iPad and Tablet Specific */
@media (min-width: 571px) and (max-width: 1024px) {
  .auth-container {
    background: var(--light-bg);
  }

  /* Hide circular background on tablets */
  .auth-container:before {
    display: none !important;
  }

  /* Hide all panels on tablets */
  .panels-container {
    display: none !important;
  }

  .signin-signup {
    width: 90%;
    max-width: 550px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    position: fixed;
    max-height: 90vh;
  }

  .auth-container.sign-up-mode .signin-signup {
    left: 50%;
    transform: translate(-50%, -50%);
  }

  form {
    padding: 2.5rem 2.5rem;
  }

  form.sign-up-form {
    padding: 2rem 2.5rem;
  }

  .title {
    font-size: 1.8rem;
    margin-bottom: 12px;
  }

  .input-field {
    height: 52px;
    max-width: 100%;
    margin: 7px 0;
  }

  .auth-btn {
    height: 48px;
    width: 160px;
  }
}

/* Responsive Design */
@media (max-width: 870px) {
  .auth-container {
    min-height: 100vh;
    height: 100vh;
    background: var(--light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Hide circular background */
  .auth-container:before {
    display: none !important;
  }

  /* Hide all panels */
  .panels-container {
    display: none !important;
  }

  .signin-signup {
    width: 100%;
    max-width: 500px;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: none;
    right: auto;
    left: 50%;
    position: fixed;
    padding: 15px;
    max-height: 92vh;
  }

  .signin-signup,
  .auth-container.sign-up-mode .signin-signup {
    left: 50%;
    right: auto;
    top: 50%;
    transform: translate(-50%, -50%);
  }

  form {
    padding: 2rem 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(30, 58, 95, 0.15);
  }

  form.sign-up-form {
    padding: 1.8rem 2rem;
  }

  .title {
    font-size: 1.6rem;
    margin-bottom: 12px;
  }

  .input-field {
    height: 50px;
    border-radius: 14px;
    max-width: 100%;
    margin: 7px 0;
  }

  .auth-btn {
    height: 48px;
    border-radius: 14px;
    width: 150px;
    margin: 10px 0;
  }

  .social-text {
    padding: 0.6rem 0;
    margin-top: 8px;
  }

  .social-media {
    flex-wrap: wrap;
    margin-bottom: 8px;
  }

  .social-icon {
    height: 42px;
    width: 42px;
    font-size: 1rem;
  }
}

@media (max-width: 570px) {
  .auth-container {
    padding: 10px;
  }

  .signin-signup {
    width: 100%;
    padding: 8px;
    max-height: 94vh;
  }

  form {
    padding: 1.5rem 1.2rem;
  }

  form.sign-up-form {
    padding: 1.3rem 1.2rem;
  }

  .title {
    font-size: 1.4rem;
    margin-bottom: 10px;
  }

  .input-field {
    height: 48px;
    margin: 6px 0;
    padding: 0 1.2rem;
  }

  .input-field input {
    font-size: 0.95rem;
  }

  .input-field i {
    font-size: 1.1rem;
  }

  .auth-btn {
    height: 46px;
    width: 140px;
    font-size: 0.9rem;
    margin: 8px 0;
  }

  .social-text {
    font-size: 0.85rem;
    padding: 0.5rem 0;
  }

  .social-icon {
    height: 40px;
    width: 40px;
    font-size: 0.95rem;
    margin: 0 0.3rem;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .auth-container {
    background-color: var(--text-dark);
  }

  form {
    background: rgba(30, 30, 50, 0.95);
  }

  .title {
    color: #ffffff;
  }

  .input-field {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
  }

  .input-field input {
    color: #ffffff;
  }

  .input-field input::placeholder {
    color: rgba(255, 255, 255, 0.5);
  }
}