/* ================================
   Modern Premium Auth CSS
   ================================ */

:root {
  --primary: #e63946;
  --primary-dark: #c42532;
  --accent: #1d3557;
  --accent-light: #457b9d;
  --dark: #0a0e27;
  --light: #f8f9fa;
  --white: #ffffff;
  --muted: #6b7280;
  --gradient-primary: linear-gradient(135deg, #e63946 0%, #c42532 100%);
  --gradient-dark: linear-gradient(135deg, #1d3557 0%, #0a0e27 100%);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.16);
  --shadow-glow: 0 0 40px rgba(230, 57, 70, 0.3);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Urbanist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin: 0;
  padding: 0;
  background: var(--dark);
  color: var(--dark);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Fix body padding for auth pages to account for navbar */
body[class*="auth-page"],
body.page-login,
body.page-register {
  padding-top: var(--nav-height-scrolled);
}

@media (max-width: 768px) {
  body[class*="auth-page"],
  body.page-login,
  body.page-register {
    padding-top: calc(var(--nav-height-scrolled) - 23px);
  }
}

main,
.form-section {
  flex: 1 0 auto;
}

/* ===== Navbar Override for Auth Pages ===== */
body[class*="auth-page"] #site-navbar,
.page-login #site-navbar,
.page-register #site-navbar {
  background: var(--nav-bg-scrolled) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}

body[class*="auth-page"] #site-navbar .container,
.page-login #site-navbar .container,
.page-register #site-navbar .container {
  height: var(--nav-height-scrolled) !important;
}

body[class*="auth-page"] #site-navbar .logo a img,
.page-login #site-navbar .logo a img,
.page-register #site-navbar .logo a img {
  height: 58px !important;
  max-height: calc(var(--nav-height-scrolled) - 16px) !important;
}

/* ===== Footer Override ===== */
.site-footer,
.footer {
  background: var(--dark);
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  padding: 2rem 0;
  margin-top: auto;
  font-size: 0.9rem;
  width: 100%;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  border-top: 1px solid rgba(230, 57, 70, 0.1);
}

/* ===== Form Section - Hero Style ===== */
.form-section {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8rem 2rem 6rem;
  min-height: calc(100vh - 120px);
  position: relative;
  background: var(--dark);
  overflow: hidden;
}

.form-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 30%, rgba(230, 57, 70, 0.15), transparent 45%),
    radial-gradient(ellipse at 80% 70%, rgba(232, 240, 247, 0.08), transparent 45%),
    linear-gradient(180deg, transparent 0%, rgba(10, 14, 39, 0.5) 100%);
  z-index: 1;
}

.form-section::after {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at center, transparent 30%, rgba(10, 14, 39, 0.6) 100%);
  z-index: 2;
  pointer-events: none;
}

.form-container {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px) saturate(180%);
  padding: 3.5rem 3rem;
  border-radius: 28px;
  max-width: 600px;
  width: 100%;
  box-shadow: 
    0 16px 48px rgba(0, 0, 0, 0.2),
    0 8px 24px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin: 0 auto;
  position: relative;
  z-index: 10;
  border: 2px solid rgba(230, 57, 70, 0.1);
  animation: slideIn 0.6s ease-out;
}

/* Wider container for register page */
body.page-register .form-container {
  max-width: 700px;
}

.form-container::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: var(--gradient-primary);
  border-radius: 28px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
  filter: blur(10px);
}

.form-container:hover::before {
  opacity: 0.1;
}

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

.form-container h2 {
  margin: 0 0 0.5rem;
  text-align: center;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -2px;
  position: relative;
  display: block;
  width: 100%;
  line-height: 1.2;
}

.form-container h2::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 5px;
  background: var(--gradient-primary);
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(230, 57, 70, 0.4);
}

/* ===== Form Structure ===== */
.styled-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.styled-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  text-transform: none;
  letter-spacing: 0.3px;
  color: var(--accent);
}

/* ===== Grouped Fields ===== */
.field-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.field-group > .input-wrapper {
  flex: 1 1 calc(50% - 0.5rem);
  min-width: 0;
}

/* ===== Input Wrapper + Icon ===== */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper .icon {
  position: absolute;
  left: 1rem;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.3s ease, transform 0.3s ease;
  width: 20px;
  height: 20px;
  z-index: 1;
}

.input-wrapper.focused .icon {
  color: var(--primary);
  transform: scale(1.1);
}

/* ===== Inputs ===== */
.styled-form input {
  width: 100%;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid rgba(230, 57, 70, 0.2);
  font-size: 1rem;
  background: var(--white);
  transition: all 0.3s ease;
  outline: none;
  color: var(--dark);
  box-shadow: var(--shadow-sm);
}

.input-wrapper .icon + input {
  padding-left: 3rem;
}

.styled-form input::placeholder {
  color: var(--muted);
}

.styled-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15);
  transform: translateY(-2px);
}

.styled-form input[readonly] {
  background: rgba(248, 250, 252, 0.8);
  color: var(--muted);
  cursor: not-allowed;
  border-color: rgba(230, 57, 70, 0.1);
}

/* ===== Password Strength ===== */
.password-strength {
  height: 8px;
  background: rgba(232, 236, 243, 0.8);
  border-radius: 50px;
  overflow: hidden;
  margin: 0.75rem 0 0.5rem;
}

.password-strength-inner {
  height: 100%;
  width: 0;
  background: #f87171;
  border-radius: 50px;
  transition: width 0.3s ease, background 0.3s ease;
}

.strength-text {
  font-size: 0.85rem;
  margin-top: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.5;
}

.match-info {
  font-size: 0.85rem;
  margin-top: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.match-info.good {
  color: #16a34a;
}

.match-info.good::before {
  content: '✓';
  font-size: 1rem;
  background: rgba(34, 197, 94, 0.15);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.match-info.bad {
  color: #dc2626;
}

.match-info.bad::before {
  content: '✗';
  font-size: 1rem;
  background: rgba(220, 38, 38, 0.15);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== Submit Button ===== */
.styled-form button {
  cursor: pointer;
  background: var(--gradient-primary);
  border: none;
  color: var(--white);
  padding: 1.125rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 50px;
  width: 100%;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: var(--shadow-glow);
  margin-top: 0.5rem;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.styled-form button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.styled-form button:hover::before {
  transform: translateX(100%);
}

.styled-form button:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 40px rgba(230, 57, 70, 0.5);
}

.styled-form button:active {
  transform: translateY(-2px) scale(1);
}

/* ===== Links ===== */
.extra-link {
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.extra-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  transition: all 0.3s ease;
  position: relative;
  padding: 0.25rem 0;
}

.extra-link a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width 0.3s ease;
}

.extra-link a:hover {
  color: var(--primary-dark);
}

.extra-link a:hover::after {
  width: 100%;
}

/* ===== Feedback Messages ===== */
.error {
  background: linear-gradient(135deg, rgba(255, 227, 227, 0.98), rgba(255, 235, 235, 0.98));
  backdrop-filter: blur(10px);
  border: 2px solid rgba(230, 57, 70, 0.2);
  padding: 1.125rem 1.5rem;
  border-radius: 16px;
  color: #c42532;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  font-weight: 600;
  animation: shake 0.5s ease;
  box-shadow: 0 4px 16px rgba(230, 57, 70, 0.15);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.error::before {
  content: '⚠️';
  font-size: 1.2rem;
  flex-shrink: 0;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.info {
  background: linear-gradient(135deg, rgba(232, 245, 255, 0.98), rgba(240, 250, 255, 0.98));
  backdrop-filter: blur(10px);
  border: 2px solid rgba(29, 53, 87, 0.2);
  padding: 1.125rem 1.5rem;
  border-radius: 16px;
  color: #1d3557;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(29, 53, 87, 0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.info::before {
  content: 'ℹ️';
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* ===== Success Message ===== */
.success {
  background: linear-gradient(135deg, rgba(220, 252, 231, 0.98), rgba(240, 253, 244, 0.98));
  backdrop-filter: blur(10px);
  border: 2px solid rgba(34, 197, 94, 0.2);
  padding: 1.125rem 1.5rem;
  border-radius: 16px;
  color: #15803d;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.15);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.success::before {
  content: '✓';
  font-size: 1.2rem;
  flex-shrink: 0;
  background: rgba(34, 197, 94, 0.2);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.success-actions {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid rgba(230, 57, 70, 0.1);
}

.success-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  background: var(--gradient-primary);
  color: var(--white);
  text-decoration: none;
  border-radius: 16px;
  font-weight: 700;
  font-size: 1.05rem;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: var(--shadow-md);
}

.success-link:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

.success-link svg {
  width: 20px;
  height: 20px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .field-group {
    flex-direction: column;
  }
  
  .field-group > .input-wrapper {
    flex: 1 1 100%;
  }
  
  .form-container {
    padding: 2.5rem 2rem;
    max-width: 100%;
  }
  
  .form-section {
    padding: 6rem 1.5rem 4rem;
  }
  
  .form-container h2 {
    font-size: 2rem;
    letter-spacing: -1px;
  }

  .form-container h2::after {
    width: 60px;
    height: 4px;
  }
}

@media (max-width: 480px) {
  .form-container {
    padding: 2rem 1.25rem;
  }
  
  .styled-form input {
    padding: 0.875rem 1rem;
  }
  
  .input-wrapper .icon + input {
    padding-left: 2.75rem;
  }
}

/* ===== Focus Styles for Accessibility ===== */
.styled-form input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.styled-form button:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 4px;
}

/* ===== Scroll to Top Button ===== */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 56px;
  height: 56px;
  background: var(--gradient-primary);
  color: var(--white);
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 
    0 16px 48px rgba(0, 0, 0, 0.2),
    0 0 40px rgba(230, 57, 70, 0.3);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.8);
  line-height: 1;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.scroll-to-top:hover {
  transform: translateY(-8px) scale(1.1);
  box-shadow: 
    0 24px 64px rgba(0, 0, 0, 0.25),
    0 0 60px rgba(230, 57, 70, 0.5);
  background: var(--gradient-primary);
}

.scroll-to-top:active {
  transform: translateY(-4px) scale(1.05);
}

.scroll-to-top::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

.scroll-to-top:hover::before {
  opacity: 1;
}

@media (max-width: 768px) {
  .scroll-to-top {
    width: 48px;
    height: 48px;
    bottom: 1.5rem;
    right: 1.5rem;
    font-size: 1.3rem;
  }
}