:root {
  --primary-color: #24aae0;
  --primary-hover: #1d8ab3;
  --secondary-color: #5e5e62;
  --light-gray: #f5f5f5;
  --border-color: #e2e2e2;
  --error-color: #d84433;
  --error-hover: #c13b2b;
  --text-color: #333333;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --card-bg: #ffffff;
  --accent-color: #4285F4;
  --footer-bg: #2c3e50;
  --footer-text: #ecf0f1;
}

body {
  font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-color);
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

.page-container {
  min-height: 100vh;
  background: linear-gradient(to bottom, #e6f7ff 0%, #ffffff 100%);
  padding: 2rem 0 0 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-border {
  width: 100%;
  max-width: 450px;
  height: auto;
  margin: 5vh auto;
  text-align: center;
  position: relative;
  background-color: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 2.5rem;
  transition: all 0.3s ease;
  overflow: hidden;
}

.login-border::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

@media (max-width: 576px) {
  .login-border {
    width: 90%;
    margin: 3vh auto;
    padding: 1.5rem;
  }
}

.login-container {
  width: 100%;
  position: relative;
}

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2.5rem;
  animation: fadeInDown 0.8s ease-out;
}

.logo-container img {
  max-height: 80px;
  margin-bottom: 1.5rem;
  transition: transform 0.3s ease;
}

.logo-container img:hover {
  transform: scale(1.05);
}

.login-title h1 {
  font-size: 28px;
  font-weight: 500;
  color: var(--secondary-color);
  margin: 0;
  position: relative;
  display: inline-block;
}

.login-title h1::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background-color: var(--primary-color);
  border-radius: 3px;
}

.otplogin-border .login-title h1::after {
  display: none;
}

.login_buttons_container {
  margin-bottom: 2rem;
  animation: fadeInUp 0.8s ease-out;
}

.button_icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.2rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.9rem 1.2rem;
  transition: all 0.3s ease;
  background-color: var(--card-bg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.button_icon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(36, 170, 224, 0.1), rgba(66, 133, 244, 0.1));
  transform: translateX(-100%);
  transition: transform 0.5s ease;
  z-index: 0;
}

.button_icon:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.button_icon:hover::before {
  transform: translateX(0);
}

.button_icon:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.login-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: var(--text-color);
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  user-select: none;
  padding: 0.5rem;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.login-svg {
  width: 24px;
  height: 24px;
  margin-inline-start: 12px;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
  min-width: 24px;
}

.button_icon:hover .login-svg {
  transform: scale(1.1);
}

.button_icon.google-btn {
  border-color: #4285F4;
}

.button_icon.google-btn:hover {
  background-color: rgba(66, 133, 244, 0.05);
}

.button_icon.otp-btn {
  border-color: var(--primary-color);
}

.button_icon.otp-btn:hover {
  background-color: rgba(36, 170, 224, 0.05);
}

.button_icon.passkey-btn {
  border-color: var(--primary-color);
}

.button_icon.passkey-btn:hover {
  background-color: rgba(36, 170, 224, 0.05);
}

.login-button.text-only {
  justify-content: center;
}

.otp-button-container {
  display: flex;
  align-items: center;
  width: 100%;
  position: relative;
  min-height: 24px;
}

.otp-button-icon {
  position: absolute;
  inset-inline-start: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.otp-button-icon svg {
  width: 24px;
  height: 24px;
  min-width: 24px;
}

.otp-button-text {
  width: 100%;
  text-align: center;
}

.otplogin-border {
  width: 100%;
  max-width: 450px;
  margin: 5vh auto;
  background-color: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
  overflow: hidden;
  padding: 2.5rem;
}

.otplogin-border::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

@media (max-width: 576px) {
  .otplogin-border {
    width: 90%;
    margin: 3vh auto;
    padding: 1.5rem;
  }
}

.text-center,
.text-center:active,
.text-center:hover,
.form-control:active,
.form-control:hover {
  border: none;
  border-bottom: 2px solid var(--secondary-color);
  border-radius: 0;
  background: transparent;
  font-size: 18px;
  margin-bottom: 2rem;
  padding: 0.75rem 0.5rem;
  width: 100%;
  transition: all 0.3s ease;
  text-align: center;
}

.text-center:focus {
  outline: none;
  border-bottom: 2px solid var(--primary-color);
  box-shadow: 0 4px 6px rgba(36, 170, 224, 0.1);
}

.user-data-entry {
  font-weight: 500;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes highlight {
  0%, 100% { border-bottom-color: var(--secondary-color); }
  50% { border-bottom-color: var(--error-color); box-shadow: 0 4px 8px rgba(216, 68, 51, 0.3); }
}

.input-error {
  animation: shake 0.6s ease-in-out, highlight 0.8s ease-in-out;
  border-bottom-color: var(--error-color) !important;
  background-color: rgba(216, 68, 51, 0.05) !important;
  box-shadow: 0 4px 8px rgba(216, 68, 51, 0.2) !important;
}

.cancel-button-container {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

.cancel-button {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  color: var(--secondary-color);
  background-color: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cancel-button:hover {
  background-color: var(--light-gray);
  color: var(--text-color);
  transform: translateY(-2px);
}

.cancel-button:active {
  transform: translateY(0);
}

.waitmsg {
  font-size: 16px;
  color: var(--secondary-color);
  margin: 1rem 0;
  padding: 0.75rem;
  background-color: rgba(94, 94, 98, 0.1);
  border-radius: 8px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.msg {
  font-size: 16px;
  color: var(--error-color);
  margin: 1rem 0;
  padding: 0.75rem;
  background-color: rgba(216, 68, 51, 0.1);
  border-radius: 8px;
  animation: fadeIn 0.5s ease-out;
}

#fb {
  padding: 0.75rem;
  margin: 1rem 0;
  border-radius: 8px;
  font-weight: 500;
  animation: fadeIn 0.5s ease-out;
}

.footer-container {
  background-color: var(--footer-bg);
  color: var(--footer-text);
  padding: 1rem 0;
  margin-top: auto;
  width: 100%;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.footer-container a {
  color: var(--footer-text);
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  font-weight: 500;
}

.footer-container a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--footer-text);
  transition: width 0.3s ease;
}

.footer-container a:hover {
  color: var(--primary-color);
}

.footer-container a:hover::after {
  width: 100%;
}

@media (max-width: 576px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .footer-content div {
    margin-bottom: 0.5rem;
  }
}

.header-brand {
  text-align: center;
  padding: 1rem 0;
  animation: fadeInDown 0.8s ease-out;
}

.header-brand img {
  max-height: 50px;
  transition: transform 0.3s ease;
}

.header-brand img:hover {
  transform: scale(1.05);
}

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

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

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

.hidden {
  display: none;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-hover);
}

.main-content {
  flex: 1;
}

/* The language picker is fixed to the physical right in both text directions. */
.login-topbar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1040;
  padding: 0.75rem 1rem;
}

.login-topbar .language-dropdown {
  margin: 0;
}

/* Keep both login stages clear of the fixed picker on short or narrow screens. */
@media (max-height: 480px), (max-width: 576px) {
  .login-border,
  .otplogin-border {
    margin-top: 4.5rem;
  }
}
