/* Fonts - Playfair for a book/literary feel, Inter for modern UI */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --ink: #192231;
  --ink-soft: rgba(25, 34, 49, 0.7);
  --paper: #ffffff;
  --paper-subtle: #fcfcfc;
  --accent: #8c6a3d; /* Premium Bronze/Gold */
  --radius: 16px;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.6);
  --shadow-luxe: 0 20px 40px rgba(25, 34, 49, 0.08), 0 1px 3px rgba(0, 0, 0, 0.02);
}

/* Base Body Style */
body.login-body {
  font-family: 'Inter', sans-serif;
  /* Replaced greys with a modern, very light off-white/paper tone */
  background-color: #f9f9f9;
  background-image: 
    radial-gradient(at 0% 0%, rgba(255,255,255,1) 0, transparent 50%),
    radial-gradient(at 100% 100%, rgba(233, 236, 241, 0.5) 0, transparent 50%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--ink);
  margin: 0;
  overflow-x: hidden;
  padding: 20px 0;
  box-sizing: border-box;
}

/* Center wrapper */
.center-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 16px;
  box-sizing: border-box;
}

/* Main glass card */
.login-container {
  width: min(600px, 92%);
  background: var(--glass-bg);
  padding: 40px 32px;
  border-radius: var(--radius);
  border: 2px solid #ffffff;
  border-bottom: 5px solid #e5e5e5;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-luxe);
  margin-bottom: 40px;
  animation: fadeSlide 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  text-align: center;
}

/* Logo Animation (The Smooth Pop) */
.book-container {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 20px auto 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.book-container .libriax-logo {
  width: 100px;  
  height: auto; 
  /* Combined fall and smooth pop sequence */
  animation: fall-smooth-pop 1.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform-origin: center;
}

/* Typography Refinements */
.typing-wrapper {
  font-family: 'Playfair Display', serif; 
  font-size: 34px;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.typing-text {
  font-family: 'Inter', sans-serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
  display: inline-block;
  opacity: 0;
  transform: translateY(-10px);
  animation: slideDownFade 0.6s ease-out 0.4s forwards;
}

.cta, .subtitle {
  text-align: center;
  font-size: 15px;
  color: var(--ink-soft);
  opacity: 0;
  animation: fadeIn 0.9s ease forwards;
}
.cta { animation-delay: 0.5s; }
.subtitle { animation-delay: 0.6s; }

/* Form Containers (Login, Register, Forgot, Reset) */
#login-container,
#registration-container,
#forgot-password-container,
#resend-email-container,
#reset-password-container {
  background: #ffffff; /* Solid white for maximum contrast on glass */
  padding: 28px;
  border-radius: 14px;
  border: 2px solid #ffffff;
  border-bottom: 4px solid #e5e5e5;
  box-shadow: 0 10px 25px rgba(0,0,0,0.04);
  width: min(340px, 100%);
  opacity: 0;
  transform: translateY(20px);
  animation: rise-up 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Titles inside forms */
#login-container h1,
#registration-container h1,
#forgot-password-container h1,
#resend-email-container h1,
#reset-password-container h1 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  letter-spacing: -0.01em;
}

/* Modern Labels */
label {
  display: block;
  text-align: left;
  margin-bottom: 6px;
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Updated Input Fields */
input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 2px solid #eee; /* Clean, light border */
  border-radius: 8px;
  background-color: #fafafa;
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  transition: all 0.2s ease;
}

input:focus {
  outline: none !important;
  background-color: #ffffff;
  border-color: #c9ced6 !important;
}

/* Primary Buttons — Raised Dark Blue (Export Style) */
button[type="submit"], 
.button {
  width: 100%;
  padding: 14px;

  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;

  background: #3a4a6b;              /* lighter navy base */
  color: #ffffff;

  border: 2px solid #2f3e5a;        /* mid navy */
  border-bottom: 4px solid #1f2d45; /* darkest for depth */

  transition: all 0.1s ease;
  font-family: 'Inter', sans-serif;

  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

/* NO hover colour change */
button[type="submit"]:hover,
.button:hover {
  background: #3a4a6b;
  color: #ffffff;
}

/* Pressed state only */
button[type="submit"]:active,
.button:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

/* Disabled */
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.login-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}

/* Force last link onto its own row */
.login-links a:last-child {
  flex-basis: 100%;
  text-align: center;
}

/* Switch Link Buttons (The "Interest" contrast) */
#switch-to-register, #switch-to-login,
#switch-to-forgot-password, #switch-to-login-from-forgot,
#switch-to-login-from-resend, #resend-activation-link {
  display: inline-block;
  margin-top: 15px;
  background: none;
  border: none;
  color: var(--accent); /* Using the bronze accent here for sleek contrast */
  font-weight: 500;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  transition: color 0.2s ease;
  font-family: 'Inter', sans-serif;
}

#switch-to-register:hover,
#switch-to-login:hover,
#switch-to-forgot-password:hover,
#switch-to-login-from-forgot:hover,
#switch-to-login-from-resend:hover,
#resend-activation-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* Animations */
@keyframes fall-smooth-pop {
  0% { opacity: 0; transform: translateY(-80px) scale(0.8); }
  60% { opacity: 1; transform: translateY(0) scale(1); }
  80% { transform: translateY(0) scale(1.08); } /* Subtle pop */
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rise-up {
  0% { opacity: 0; transform: translateY(25px); }
  100% { opacity: 1; transform: translateY(0); }
}

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

/* Mobile responsive - Unchanged logic, refined padding */
@media (max-width: 768px) {
  .login-container {
    padding: 30px 20px;
    width: 94%;
  }
  .typing-wrapper {
    font-size: 28px;
  }
  #login-container, #registration-container {
    width: 100%;
    padding: 20px;
  }
}

.reset-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding-top: 0;
}

#registration-container {
  display: none; /* Controlled by JS */
}