/* 50/50 Split Auth Layout - Exact Reference Design */

/* CSS Variables */
:root {
  --radius: 0.5rem; /* 8px */
  --primary: hsl(0, 0%, 20%); /* #323232 */
  --background: #ffffff; /* White background */
  --card-bg: #ffffff; /* White background */
  --border: hsl(0, 0%, 20%, 0.1); /* 10% opacity */
  --input-border: hsl(41, 20%, 64%); /* Neutral gray */
  --button-primary: hsl(8, 84%, 7%); /* Very dark brown/black */
}

/* ==============================================
   LAYOUT SHIFT PREVENTION
   Hide content until JS manipulations complete,
   then fade in smoothly
   ============================================== */

/* Initially hide the card content to prevent layout shift from JS DOM manipulation */
/* Animation is now triggered by JavaScript after all DOM manipulations complete */
[data-testid="ui/card"],
[data-testid$="-auth-card"] {
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

/* Class added by JavaScript when ready to show */
[data-testid="ui/card"].card-ready,
[data-testid$="-auth-card"].card-ready {
  opacity: 1;
}

@keyframes fadeInCard {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Ensure smooth transition when content is ready */
.auth-page-content {
  will-change: opacity;
}

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

body {
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  font-family: "Matter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif !important;
  /* Override main.css flex styles */
  display: block !important;
  flex-direction: unset !important;
  min-height: 100vh !important;
  height: 100vh !important;
}

/* Hide any footer elements on auth pages */
footer {
  display: none !important;
}

/* ==============================================
   MAIN CONTAINER - flex h-screen w-full
   ============================================== */
.auth-split-container {
  display: flex;
  height: 100vh; /* h-screen */
  width: 100%; /* w-full */
  overflow: hidden;
  /* Mobile: flex-col, Desktop: md:flex-row */
  flex-direction: column;
  position: relative; /* Ensure proper positioning */
  max-height: 100vh; /* Prevent any overflow beyond viewport */
}

@media (min-width: 768px) {
  .auth-split-container {
    flex-direction: row; /* md:flex-row */
  }
}

/* ==============================================
   LEFT PANEL - IMAGE SIDE
   w-full md:w-1/2 h-1/3 md:h-full (improved mobile ratio)
   ============================================== */
.auth-image-panel {
  width: 100%; /* w-full */
  height: 35vh; /* Better mobile ratio - less space for image, more for form */
  min-height: 200px; /* Ensure image is never too small */
  max-height: 320px; /* Prevent image from being too large on mobile */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Changed from auto to hidden for cleaner look */
}

@media (min-width: 768px) {
  .auth-image-panel {
    width: 50%; /* md:w-1/2 */
    height: 100%; /* md:h-full */
    max-height: none; /* Remove max-height on desktop */
  }
}

/* Mobile Header - md:hidden (only visible on mobile) */
.auth-mobile-header {
  display: flex; /* Visible on mobile */
  align-items: center; /* items-center - centered since no divider */
  justify-content: center;
  gap: 0.5rem; /* gap-2 = 8px */
  padding: 1rem 0.75rem 0.5rem 0.75rem; /* More top padding, less bottom */
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .auth-mobile-header {
    display: none; /* md:hidden */
  }
}

.auth-brand {
  /* Display logo image instead of text */
  font-size: 0 !important; /* Hide text */
  line-height: 0 !important;
  color: transparent !important;
  text-indent: -9999px !important;
  overflow: hidden !important;
  display: block !important;
  width: 140px !important; /* Logo width */
  height: 36px !important; /* Logo height */
  background-image: url("sarvam-text-logo.png") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: contain !important;
  margin: 0 !important;
}

/* Vertical separator - w-[2px] h-4 */
.auth-divider {
  width: 2px; /* w-[2px] */
  height: 1rem; /* h-4 = 16px */
  background: var(--border);
  margin-bottom: 0.375rem; /* mb-1.5 = 6px */
}

.auth-subtitle {
  font-size: 1.25rem; /* text-xl = 20px */
  color: hsl(0, 0%, 20%, 0.7); /* text-primary/70 */
  font-weight: 400;
  line-height: 1;
  font-family: "Matter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
}

/* Image Container - flex-1 overflow-hidden */
.auth-image-container {
  flex: 1; /* flex-1 */
  overflow: hidden;
}

/* Image - object-cover h-full w-full */
.auth-image {
  width: 100%; /* w-full */
  height: 100%; /* h-full */
  object-fit: cover; /* object-cover */
  object-position: center;
}

/* ==============================================
   RIGHT PANEL - FORM SIDE
   Flexible height on mobile for better content fit
   ============================================== */
.auth-form-panel {
  width: 100%; /* w-full */
  flex: 1; /* Take remaining space on mobile */
  min-height: 0; /* Allow proper flex shrinking */
  display: flex;
  align-items: center; /* items-center */
  justify-content: center; /* justify-center */
  padding: 0; /* Remove padding - let inner content handle spacing */
  overflow-y: auto; /* Vertical scroll only */
  overflow-x: hidden; /* Prevent horizontal scroll */
  background-color: var(--background);
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

@media (min-width: 768px) {
  .auth-form-panel {
    width: 50%; /* md:w-1/2 */
    height: 100%; /* md:h-full */
    flex: none; /* Reset flex on desktop */
    padding: 0; /* Ensure no padding on desktop too */
  }
}

/* ==============================================
   FORM CONTENT STRUCTURE
   w-full h-full flex flex-col
   ============================================== */

/* Page wrapper inside form panel */
#login,
#signup,
#recovery,
#verification,
#settings {
  width: 100%; /* w-full */
  min-height: 100%; /* min-height instead of height for better flexibility */
  display: flex;
  flex-direction: column; /* flex-col */
  max-width: 100%; /* Prevent overflow */
  padding: 0.5rem; /* Add padding here instead of on panel */
}

@media (min-width: 640px) {
  #login,
  #signup,
  #recovery,
  #verification,
  #settings {
    padding: 1rem; /* More padding on tablets */
  }
}

@media (min-width: 1024px) {
  #login,
  #signup,
  #recovery,
  #verification,
  #settings {
    padding: 1.5rem; /* Even more padding on desktop */
  }
}

/* Desktop Header - md:flex hidden */
.auth-desktop-header {
  display: none; /* Hidden on mobile */
  align-items: center; /* items-center - centered since no divider */
  justify-content: flex-start; /* justify-start */
  gap: 0.5rem; /* gap-2 = 8px */
  padding: 2rem 2rem 0 2rem; /* Top padding for breathing room */
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .auth-desktop-header {
    display: flex; /* md:flex */
  }
}

@media (min-width: 1024px) {
  .auth-desktop-header {
    padding: 2.5rem 3rem 0 3rem; /* More padding on larger screens */
  }
}

/* Main Content - Compact padding for cleaner look */
.auth-page-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem !important; /* Minimal padding */
  max-width: 100%;
  min-height: auto !important;
}

@media (min-width: 640px) {
  .auth-page-content {
    padding: 1.5rem !important; /* Minimal padding on tablets */
  }
}

@media (min-width: 1024px) {
  .auth-page-content {
    padding: 2rem !important; /* Minimal padding on desktop */
  }
}

/* Footer - p-2 text-center */
.auth-page-footer {
  padding: 0.75rem 1.5rem 1rem 1.5rem; /* Compact padding on mobile */
  text-align: center; /* text-center */
  flex-shrink: 0;
  order: 999 !important; /* Ensure footer always appears last */
  margin-top: auto !important; /* Push to bottom in flex container */
}

@media (min-width: 640px) {
  .auth-page-footer {
    padding: 0 2rem 1.5rem 2rem; /* More padding on tablets */
  }
}

@media (min-width: 1024px) {
  .auth-page-footer {
    padding: 0 3rem 2rem 3rem; /* More padding on larger screens */
  }
}

.auth-page-footer p {
  font-size: 0.875rem; /* text-sm */
  color: hsl(0, 0%, 20%, 0.7); /* text-primary/70 */
  margin: 0;
  line-height: 1.6; /* Slightly more line-height for better readability */
}

/* Different footer message types */
.auth-legal-text {
  font-size: 0.8125rem !important; /* 13px - slightly smaller for legal text */
  opacity: 0.85;
  line-height: 1.6;
}

.auth-help-text {
  font-size: 0.875rem !important;
  color: hsl(0, 0%, 20%, 0.8) !important;
  margin-bottom: 0.625rem !important; /* Slightly more space between footer items */
  line-height: 1.6;
}

.auth-help-text:last-child {
  margin-bottom: 0 !important;
}

.auth-support-text {
  font-size: 0.8125rem !important;
  color: hsl(0, 0%, 20%, 0.65) !important;
  line-height: 1.6;
}

/* Responsive footer adjustments */
@media (max-width: 480px) {
  .auth-legal-text {
    font-size: 0.75rem !important; /* 12px on very small screens */
  }

  .auth-help-text {
    font-size: 0.8125rem !important; /* 13px on very small screens */
  }

  .auth-support-text {
    font-size: 0.75rem !important; /* 12px on very small screens */
  }
}

.auth-page-footer a {
  text-decoration: underline;
  color: hsl(14, 70%, 50%); /* Brand orange */
  transition: color 0.2s ease;
  text-underline-offset: 2px;
}

.auth-page-footer a:hover {
  color: hsl(14, 80%, 45%); /* Darker orange on hover */
}

/* Card styling - Completely remove card appearance */
[data-testid="ui/card"],
.card,
.auth-card {
  width: 100% !important;
  max-width: 400px !important; /* Compact width matching Figma */
  background: none !important;
  background-color: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 auto !important;
  border: none !important;
  box-shadow: none !important;
  display: block !important; /* Simple block display */
  min-height: auto !important;
}

/* Remove all card-related spacing */
[data-testid="ui/card"] > *,
.card > *,
.auth-card > * {
  margin: 0 !important;
  padding: 0 !important;
}

/* Card inner content - remove all spacing */
[data-testid="ui/card"] > div,
.card > div,
.auth-card > div {
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Typography - Headings (Hide default Ory heading) */
h1:not(.auth-brand):not(.auth-welcome-heading),
h2:not(.auth-welcome-subheading),
h3 {
  display: none !important; /* Hide Ory's default "Sign in" heading */
}

/* Apply SeasonMix font to all headings */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "SeasonMix", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif !important;
}

/* Custom Welcome heading - Ultra compact for first fold */
.auth-welcome-heading {
  font-size: 0.875rem !important; /* 14px - smaller */
  font-weight: 400 !important;
  color: rgba(24, 24, 24, 0.5) !important;
  font-family: "SeasonMix", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif !important;
  margin-bottom: 0.125rem !important; /* 2px gap - very tight */
  margin-top: 0 !important;
  line-height: 1.3;
  text-align: left !important;
  letter-spacing: 0;
  padding: 0 !important;
}

/* Subheading - Ultra compact */
.auth-welcome-subheading {
  font-size: 1.25rem !important; /* 20px */
  font-weight: 600 !important;
  color: rgba(24, 24, 24, 1) !important;
  font-family: "SeasonMix", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif !important;
  margin-bottom: 10px !important; /* Even more reduced */
  margin-top: 0 !important;
  line-height: 1.2;
  text-align: left !important;
  letter-spacing: -0.02em;
  padding: 0 !important;
}

@media (min-width: 640px) {
  .auth-welcome-heading {
    font-size: 1rem !important;
  }

  .auth-welcome-subheading {
    font-size: 1.5rem !important;
    margin-bottom: 12px !important;
  }
}

@media (min-width: 1024px) {
  .auth-welcome-heading {
    font-size: 1rem !important;
  }

  .auth-welcome-subheading {
    font-size: 1.75rem !important;
    margin-bottom: 14px !important;
  }
}

/* Descriptions and paragraphs */
p,
.description {
  color: hsl(0, 0%, 20%, 0.7); /* text-primary/70 */
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  font-family: "Matter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
}

/* Form spacing - Compact for first fold */
form {
  display: flex;
  flex-direction: column;
  gap: 8px !important; /* Reduced from 12px */
}

form > div {
  margin-bottom: 0;
}

/* Registration flow back button positioning */
/* The back button is in form[data-testid="registration-flow"] */
/* The password/signup is in form[data-testid="registration-flow-profile"] */
/* We want the back button form to appear AFTER the profile form */

/* CSS fallback: Use order to push back button form to the end */
form[data-testid="registration-flow"]:has(button[name="screen"]) {
  order: 100 !important; /* Push to end of flex container */
  margin-top: 12px !important;
}

/* Ensure the profile form (password + signup) comes first */
form[data-testid="registration-flow-profile"],
form[data-testid*="-profile"] {
  order: 1 !important;
}

/* Style the back button container when it's moved outside the form */
[data-testid*="node"]:has(button[name="screen"]) {
  margin-top: 12px !important;
}

/* Section spacing within cards - Custom per requirements */
.form-section,
[data-testid="node/group/oidc"],
[data-testid="node/group/password"],
[data-testid="node/group/default"] {
  margin-bottom: 0 !important; /* Reset, will be controlled by specific rules */
}

/* Last section in card shouldn't have bottom margin */
.form-section:last-child,
[data-testid="node/group/oidc"]:last-child,
[data-testid="node/group/password"]:last-child,
[data-testid="node/group/default"]:last-child {
  margin-bottom: 0;
}

/* Reorder form sections: Email/Password fields first, SSO buttons below */
/* Make sure the card's content container is a flex container */
[data-testid="ui/card"] > div,
[data-testid$="-auth-card"] > div {
  display: flex !important;
  flex-direction: column !important;
}

/* Welcome heading container should stay at the top */
[data-testid="ui/card"] > div > div:first-child,
[data-testid$="-auth-card"] > div > div:first-child {
  order: 0 !important;
}

/* Headings should stay at the top - target headings that are direct children of card content */
/* Also target headings that might be siblings to the grid container */
[data-testid="ui/card"] > div > h1,
[data-testid="ui/card"] > div > h2,
[data-testid="ui/card"] > div > h3,
[data-testid="ui/card"] > div > h4,
[data-testid="ui/card"] > div > h5,
[data-testid="ui/card"] > div > h6,
[data-testid$="-auth-card"] > div > h1,
[data-testid$="-auth-card"] > div > h2,
[data-testid$="-auth-card"] > div > h3,
[data-testid$="-auth-card"] > div > h4,
[data-testid$="-auth-card"] > div > h5,
[data-testid$="-auth-card"] > div > h6 {
  order: 0 !important; /* Headings stay at top */
  /* Hide default Ory headings - our custom welcome heading will show */
  display: none !important;
}

/* Show our custom welcome headings */
h1.auth-welcome-heading,
h2.auth-welcome-subheading {
  display: block !important;
}

/* Grid container - Minimal spacing */
/* NOTE: Do NOT add display:flex here - it breaks login page layout */
[data-testid="ui/card"] > div > div[class*="grid"],
[data-testid$="-auth-card"] > div > div[class*="grid"],
div[class*="ory_elements__grid"][class*="grid_gap"] {
  gap: 0.75rem !important; /* Very compact spacing (12px) */
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* ============================================
   REGISTRATION PAGE ONLY - Flex ordering
   These rules ONLY apply within #signup
   ============================================ */
#signup div[class*="ory_elements__grid"][class*="grid_gap"] {
  display: flex !important;
  flex-direction: column !important;
}

#signup div[class*="ory_elements__grid"] > * {
  order: 99 !important; /* Default: push to end */
}

#signup
  div[class*="ory_elements__grid"]
  > form[data-testid="registration-flow-profile"] {
  order: 1 !important;
}

#signup div[class*="ory_elements__grid"] > .sso-divider,
#signup div[class*="ory_elements__grid"] > div.sso-divider {
  order: 2 !important;
}

#signup
  div[class*="ory_elements__grid"]
  > form[data-testid="registration-flow-oidc"] {
  order: 3 !important;
}

#signup
  div[class*="ory_elements__grid"]
  > form[data-testid="registration-flow"]:has(button[name="screen"]) {
  order: 50 !important;
  margin-top: 12px !important;
}

/* ============================================
   GLOBAL STYLES - Apply to all pages
   ============================================ */
/* Hide Ory's default dividers */
[data-testid="divider"]:not(.sso-divider) {
  display: none !important;
}

/* Custom divider styling - Compact */
.sso-divider,
div.sso-divider {
  display: flex !important;
  margin-top: 12px !important; /* Reduced from 24px */
  margin-bottom: 12px !important; /* Reduced from 24px */
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* OIDC form (SSO buttons) styling - Force horizontal layout */
form[data-testid$="-flow-oidc"] {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important; /* Two equal columns */
  gap: 8px !important;
}

/* Make ALL children in OIDC form fit the grid */
form[data-testid$="-flow-oidc"] > * {
  min-width: 0 !important; /* Allow shrinking */
  width: 100% !important;
}

/* SSO buttons themselves should fill their container */
form[data-testid$="-flow-oidc"] button[name="provider"] {
  width: 100% !important;
}

/* Input container for floating label effect */
[data-testid^="node/input"] {
  position: relative !important;
  display: block !important;
  margin-bottom: 0 !important; /* No margin, controlled by form gap */
}

/* Input fields - Compact for first fold */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  height: 42px !important; /* Reduced from 48px */
  padding: 12px 16px !important; /* More compact padding */
  border-radius: 21px !important; /* Proportionally smaller */
  border: 1px solid transparent !important;
  background-color: #f7f7f7 !important;
  font-size: 14px !important; /* Slightly smaller */
  color: #a5a5a5 !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  font-family: "Matter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  font-weight: 400;
  line-height: 1.2 !important;
  box-shadow: none !important;
}

/* Hide placeholder initially - labels will act as placeholders */
input::placeholder {
  color: transparent !important;
  opacity: 0 !important;
  transition: all 0.3s ease;
}

/* Show placeholder when input is empty - center text vertically */
input:placeholder-shown {
  padding: 12px 16px !important; /* Match compact input padding */
}

input:focus,
textarea:focus,
select:focus {
  outline: none !important;
  border: 1px solid transparent !important;
  background-color: #ffffff !important; /* Change to white on focus */
  box-shadow: 0 0 0 1px rgba(19, 19, 19, 0.05) !important; /* Subtle border on focus */
}

input:not(:placeholder-shown),
textarea:not(:placeholder-shown) {
  color: #a5a5a5 !important;
  padding: 18px 16px 6px 16px !important; /* Compact with space for floating label */
}

/* Floating Labels - Compact for smaller inputs */
label {
  position: absolute !important;
  left: 16px !important; /* Match compact input padding */
  top: 50% !important;
  transform: translateY(-50%) !important;
  font-size: 14px !important; /* Match compact input font */
  font-weight: 400 !important;
  color: rgba(24, 24, 24, 0.5) !important;
  pointer-events: none !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  background-color: transparent !important;
  padding: 0 4px !important;
  display: block !important;
  font-family: "Matter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  line-height: 1 !important;
  z-index: 1 !important;
  white-space: nowrap !important;
  max-width: calc(100% - 32px) !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  margin-bottom: 0 !important;
}

/* Floating label - when input is focused or has content - compact positioning */
input:focus ~ label,
input:not(:placeholder-shown) ~ label,
textarea:focus ~ label,
textarea:not(:placeholder-shown) ~ label,
select:focus ~ label,
select:not(:placeholder-shown) ~ label {
  top: 6px !important; /* Adjusted for compact inputs */
  transform: translateY(0) !important;
  font-size: 10px !important; /* Smaller for compact layout */
  color: rgba(24, 24, 24, 0.7) !important;
  font-weight: 500 !important;
  background-color: transparent !important;
}

/* For Ory Elements structure where label comes before input */
input:focus + label,
input:not(:placeholder-shown) + label {
  top: 6px !important; /* Adjusted for compact inputs */
  transform: translateY(0) !important;
  font-size: 10px !important; /* Smaller for compact layout */
  color: rgba(24, 24, 24, 0.7) !important;
  font-weight: 500 !important;
}

/* Floating class added by JavaScript */
label.floating {
  top: 8px !important; /* Moved higher from 12px to 8px */
  transform: translateY(0) !important;
  font-size: 11px !important; /* Slightly smaller for more space */
  color: rgba(24, 24, 24, 0.7) !important;
  font-weight: 500 !important;
  background-color: transparent !important;
}

/* Handle autofilled inputs - float label automatically */
input:-webkit-autofill ~ label,
input:-webkit-autofill + label,
input:autofill ~ label,
input:autofill + label {
  top: 6px !important;
  transform: translateY(0) !important;
  font-size: 10px !important;
  color: rgba(24, 24, 24, 0.7) !important;
  font-weight: 500 !important;
  background-color: transparent !important;
}

/* Ensure autofilled input background doesn't interfere with floating label */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: #a5a5a5 !important;
  -webkit-box-shadow: 0 0 0px 1000px #f7f7f7 inset !important;
  box-shadow: 0 0 0px 1000px #f7f7f7 inset !important;
  transition: background-color 5000s ease-in-out 0s !important;
  padding: 18px 16px 6px 16px !important; /* Match compact input with value */
}

/* Buttons - Compact matching input sizing */
button {
  height: 42px !important; /* Match compact input height */
  min-height: 42px !important;
  padding: 16px 20px !important; /* Specified: 16px top/bottom, 20px left/right */
  border-radius: 28px !important; /* Specified: 28px border-radius */
  font-weight: 400 !important; /* font-normal */
  font-size: 16px !important; /* Match input font size */
  line-height: 16px !important; /* Specified: 16px line height */
  transition: all 0.15s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-family: "Matter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  letter-spacing: 0.01em;
}

/* Primary button - Compact for first fold */
button[type="submit"],
.primary-button,
button[name="method"][value="password"],
button[value="password"] {
  background-color: #131313 !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 20px !important; /* Slightly smaller */
  padding: 10px 16px !important; /* More compact */
  height: 36px !important; /* Smaller height */
  min-height: 36px !important;
  font-size: 13px !important; /* Smaller font */
  font-weight: 400 !important;
  font-family: "Matter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  line-height: 1.2 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: none !important;
  text-align: left !important;
  margin-top: 12px !important; /* Reduced from 24px */
}

/* Button text/content should be left-aligned */
button[type="submit"] > *:first-child,
.primary-button > *:first-child,
button[name="method"][value="password"] > *:first-child,
button[value="password"] > *:first-child {
  flex: 1;
  text-align: left;
}

/* Add arrow icon to submit button - using ::after for all buttons */
button[type="submit"]::after,
.primary-button::after,
button[name="method"][value="password"]::after,
button[value="password"]::after {
  content: "";
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 12L10 8L6 4' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
  margin-left: auto; /* Push to the right */
}

/* Hide arrow if button already has an icon/svg */
button[type="submit"] svg + ::after,
.primary-button svg + ::after {
  display: none;
}

button[type="submit"]:hover,
.primary-button:hover {
  background-color: #1a1a1a !important; /* Slightly lighter on hover */
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

button[type="submit"]:active,
.primary-button:active {
  transform: translateY(0);
  box-shadow: none;
  background-color: #0f0f0f !important;
}

/* Section spacing */
.form-section {
  margin-bottom: 1.5rem; /* space-y-6 = 24px */
}

/* Links */
a {
  color: hsl(14, 70%, 50%); /* Brand orange color */
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.2s ease;
  font-family: "Matter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
}

a:hover {
  color: hsl(14, 80%, 45%); /* Darker orange on hover */
  text-decoration: underline;
}

/* ==============================================
   RESPONSIVE ADJUSTMENTS
   
   Mobile Strategy:
   - Portrait: 35vh image (~35%), flexible form space (~65%)
   - Landscape: 30vh image (~30%), maximize form space (~70%)
   - Very small screens: Reduce padding and font sizes
   - Tablet portrait: 40vh image for better visual balance
   - Desktop: 50/50 split maintained
   
   This approach ensures:
   - Forms never feel cramped on mobile
   - Content is always accessible without excessive scrolling
   - Visual brand presence maintained across all devices
   ============================================== */

/* Small mobile adjustments */
@media (max-width: 480px) {
  .auth-mobile-header {
    padding: 0.75rem 0.5rem 0.375rem 0.5rem;
  }

  .auth-brand {
    width: 110px !important; /* Smaller logo on very small screens */
    height: 28px !important;
  }

  .auth-subtitle {
    font-size: 0.875rem !important;
  }

  .auth-image-panel {
    height: 30vh; /* Even less image space on very small screens */
    min-height: 180px;
  }

  .auth-page-content {
    padding: 1rem 0.75rem;
  }

  [data-testid="ui/card"],
  .card,
  .auth-card {
    padding: 1.25rem;
    max-width: 100%; /* Full width on very small screens */
  }

  h1:not(.auth-brand),
  h2 {
    font-size: 1.25rem !important;
    margin-bottom: 1rem !important;
  }

  .auth-page-footer {
    padding: 0.5rem 1rem 0.75rem 1rem;
  }

  .auth-page-footer p {
    font-size: 0.8125rem; /* Slightly smaller text on very small screens */
  }
}

/* Landscape mode on mobile - optimize for limited vertical space */
@media (max-width: 767px) and (max-height: 600px) and (orientation: landscape) {
  .auth-image-panel {
    height: 30vh;
    min-height: 150px;
    max-height: 200px;
  }

  .auth-mobile-header {
    padding: 0.5rem;
  }

  .auth-brand {
    width: 100px !important; /* Even smaller on landscape mobile */
    height: 26px !important;
  }

  .auth-subtitle {
    font-size: 0.8125rem !important;
  }

  .auth-page-content {
    padding: 0.75rem;
  }

  [data-testid="ui/card"],
  .card,
  .auth-card {
    padding: 1rem;
  }

  h1:not(.auth-brand),
  h2 {
    font-size: 1.125rem !important;
    margin-bottom: 0.75rem !important;
  }

  .auth-page-footer {
    padding: 0.375rem 1rem 0.5rem 1rem;
  }

  form {
    gap: 0.75rem;
  }

  .form-section,
  [data-testid="node/group/oidc"],
  [data-testid="node/group/password"],
  [data-testid="node/group/default"] {
    margin-bottom: 1rem;
  }
}

/* Tablet portrait - ensure optimal spacing */
@media (min-width: 640px) and (max-width: 767px) {
  .auth-image-panel {
    height: 40vh; /* Slightly more space on tablets in portrait */
    max-height: 400px;
  }
}

/* Ensure proper spacing between sections */
.auth-card > div:not(:last-child),
[data-testid="ui/card"] > div:not(:last-child) {
  margin-bottom: 1.25rem; /* Compact on mobile: 20px */
}

@media (min-width: 640px) {
  .auth-card > div:not(:last-child),
  [data-testid="ui/card"] > div:not(:last-child) {
    margin-bottom: 1.5rem; /* More spacing on tablets: 24px */
  }
}

/* Center card headers */
[data-testid="card-header"],
.card-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
  [data-testid="card-header"],
  .card-header {
    margin-bottom: 1.5rem;
  }
}

/* ==============================================
   MESSAGES & ALERTS - Production-ready UX
   ============================================== */

/* Error container - compact for first fold */
.auth-error-container {
  margin-top: 12px;
  margin-bottom: 8px;
  min-height: 0;
  transition: min-height 0.2s ease-out;
  padding-top: 1px; /* Prevent margin collapse which can clip border-top */
}

/* When error container has messages */
.auth-error-container:not(:empty) {
  min-height: 2.5rem;
}

/* Message container - compact */
[data-testid="ui/message"],
[data-testid*="ui/message"],
.message,
.alert {
  padding: 0.5rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  margin-bottom: 0.5rem;
  font-size: 0.8125rem; /* 13px */
  line-height: 1.4;
  border-width: 1px !important;
  border-style: solid !important;
  border-color: currentColor;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  overflow: visible !important; /* Ensure borders aren't clipped */
}

/* Last message in container shouldn't have bottom margin */
.auth-error-container > [data-testid*="ui/message"]:last-child,
.auth-error-container > .message:last-child {
  margin-bottom: 0;
}

/* Success messages */
[data-testid="ui/message/success"],
.message-success,
.alert-success {
  background-color: hsl(142, 76%, 96%);
  border-color: hsl(142, 76%, 85%);
  color: hsl(142, 76%, 25%);
}

/* Error messages */
[data-testid="ui/message/error"],
.message-error,
.alert-error,
.error-message {
  background-color: hsl(0, 93%, 97%);
  border-color: hsl(0, 93%, 88%);
  color: hsl(0, 72%, 38%);
}

/* Info/Warning messages */
[data-testid="ui/message/info"],
.message-info,
.alert-info {
  background-color: hsl(199, 89%, 96%);
  border-color: hsl(199, 89%, 85%);
  color: hsl(199, 89%, 30%);
}

/* Warning messages */
[data-testid="ui/message/warning"],
.message-warning,
.alert-warning {
  background-color: hsl(45, 100%, 96%);
  border-color: hsl(45, 100%, 85%);
  color: hsl(35, 90%, 32%);
}

/* Message text */
[data-testid="ui/message/text"],
.message-text {
  flex: 1;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Helpful hints and descriptions */
.auth-hint,
.form-hint,
[data-testid="field-hint"] {
  font-size: 0.8125rem; /* 13px */
  color: hsl(0, 0%, 20%, 0.6);
  margin-top: 0.375rem;
  line-height: 1.4;
  display: block;
}

/* Loading states */
.loading-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid hsl(0, 0%, 20%, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Disabled state feedback */
button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Required field indicator */
label abbr[title="required"],
label .required {
  color: hsl(4, 90%, 58%); /* Red-orange for required indicator */
  text-decoration: none;
  margin-left: 0.125rem;
}

/* Field validation feedback */
input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: hsl(4, 90%, 58%); /* Red-orange for errors */
}

input[aria-invalid="true"]:focus,
textarea[aria-invalid="true"]:focus,
select[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px hsla(4, 90%, 58%, 0.1);
}
