/* =====================================================
   ComboSmart CMS — Auth pages stylesheet (v3 redesign)
   Used by: src/views/auth/login.ejs
   ===================================================== */

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

html,
body {
  height: 100%;
}

body.auth-page {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
    "Oxygen", "Ubuntu", "Cantarell", sans-serif;
  background: linear-gradient(135deg, #f8f9fa 0%, #f0f4ff 100%);
  color: #1a1a1a;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-shell {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Login Card (split-screen) ---------- */
.login-container {
  width: 100%;
  max-width: 1100px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  background: white;
  min-height: 600px;
  animation: authFadeInUp 0.6s ease-out 0s both;
}

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

@media (max-width: 768px) {
  .login-container {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-side {
    display: none !important;
  }
}

/* ---------- Hero Side (deep navy with brand spotlight) ---------- */
.hero-side {
  background: linear-gradient(160deg, #0a1532 0%, #1a2d5e 50%, #0d1a3a 100%);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: white;
  position: relative;
  overflow: hidden;
}

/* Brand-blue spotlight (top right) */
.hero-side::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(
    circle,
    rgba(0, 102, 255, 0.15) 0%,
    transparent 60%
  );
  border-radius: 50%;
  animation: meshBreathe 40s ease-in-out infinite;
  pointer-events: none;
}

/* Soft green accent (bottom left — echoes logo green) */
.hero-side::after {
  content: "";
  position: absolute;
  bottom: -30%;
  left: -15%;
  width: 300px;
  height: 300px;
  background: radial-gradient(
    circle,
    rgba(34, 197, 94, 0.1) 0%,
    transparent 70%
  );
  border-radius: 50%;
  animation: meshBreathe 45s ease-in-out infinite 2s;
  pointer-events: none;
}

@keyframes meshBreathe {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(8px, -12px) scale(1.05);
  }
}

.hero-content {
  position: relative;
  z-index: 2;
  animation: authFadeInUp 0.6s ease-out 0.1s both;
}

.hero-logo-wrapper {
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Logo with glassmorphic halo */
.hero-logo {
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: logoBreathing 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
  position: relative;
  flex-shrink: 0;
}

.hero-logo::before {
  content: "";
  position: absolute;
  inset: -16px;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.08) 0%,
    transparent 70%
  );
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
}

.hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes logoBreathing {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

.hero-wordmark {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-wordmark-subtitle {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
  margin-bottom: 2px;
}

.hero-wordmark-brand {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.hero-headline {
  display: flex;
  flex-direction: column;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.hero-subtitle {
  font-size: 15px;
  opacity: 0.75;
  line-height: 1.5;
  margin-bottom: 0;
}

/* ---------- Form Side ---------- */
.form-side {
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: authFadeInUp 0.6s ease-out 0.2s both;
}

.form-header {
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-header-logo {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.form-header-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.form-header-content {
  flex: 1;
}

.form-title {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
  line-height: 1.2;
}

.form-subtitle {
  font-size: 14px;
  color: #6c757d;
  margin-bottom: 0;
}

/* ---------- Alert ---------- */
.alert-error {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  color: #c53030;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 24px;
  display: none;
  animation: slideDown 0.3s ease-out;
}

.alert-error.show {
  display: block;
}

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

/* ---------- Form Groups ---------- */
.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.2s ease;
}

.form-group:focus-within .form-label {
  color: #0066ff;
}

.form-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input-icon {
  position: absolute;
  left: 14px;
  color: #6c757d;
  font-size: 18px;
  pointer-events: none;
  transition: color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    filter 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}

.form-input-wrapper:focus-within .form-input-icon {
  color: #0066ff;
  filter: drop-shadow(0 0 6px rgba(0, 102, 255, 0.4));
}

.form-input {
  width: 100%;
  padding: 12px 12px 12px 44px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  font-size: 15px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  background: white;
  color: #1a1a1a;
  min-height: 44px;
}

.form-input::placeholder {
  color: #adb5bd;
}

/* Autofill subtle tint */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #f8faff inset !important;
  -webkit-text-fill-color: #1a1a1a !important;
  caret-color: #1a1a1a;
}

.form-input:focus {
  outline: none;
  border-color: #0066ff;
  background: white;
  box-shadow: 0 0 0 2px #0066ff, 0 0 0 4px rgba(0, 102, 255, 0.12),
    0 0 24px rgba(0, 102, 255, 0.08);
}

.form-input:hover:not(:focus) {
  border-color: #c0c0c0;
}

/* Password field has the toggle button — leave room on the right */
.form-input.has-toggle {
  padding-right: 44px;
}

/* ---------- Password toggle button ---------- */
.btn-toggle-password {
  position: absolute;
  right: 4px;
  background: none;
  border: none;
  color: #6c757d;
  cursor: pointer;
  padding: 8px 10px;
  font-size: 16px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  z-index: 2;
}

.btn-toggle-password:hover {
  color: #0066ff;
  transform: rotateZ(-8deg);
}

.btn-toggle-password:active {
  transform: rotateZ(-8deg) scale(0.95);
}

.btn-toggle-password:focus-visible {
  outline: 2px solid #0066ff;
  outline-offset: 2px;
}

/* ---------- Primary submit button ---------- */
.btn-submit {
  width: 100%;
  padding: 14px 24px;
  background: #0066ff;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
  min-height: 48px;
}

.btn-submit::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0s;
  pointer-events: none;
}

.btn-submit:hover:not(:disabled)::before {
  left: 100%;
  transition: left 1.2s ease-in-out;
}

.btn-submit:hover:not(:disabled) {
  background: #0052cc;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.25),
    0 10px 32px rgba(0, 102, 255, 0.15);
}

.btn-submit:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.2);
}

.btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-submit-icon {
  font-size: 18px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-submit:hover:not(:disabled) .btn-submit-icon {
  transform: translateX(4px);
}

/* ---------- Divider ---------- */
.divider {
  display: flex;
  align-items: center;
  margin: 28px 0;
  color: #adb5bd;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    #dee2e6 50%,
    transparent
  );
}

.divider-text {
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: #6c757d;
  text-transform: lowercase;
}

/* ---------- SSO button with Microsoft logo ---------- */
.btn-sso {
  width: 100%;
  padding: 12px 24px;
  background: white;
  color: #1a1a1a;
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  position: relative;
  text-decoration: none;
}

.sso-microsoft-logo {
  width: 20px;
  height: 20px;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1.5px;
  flex-shrink: 0;
}

.sso-microsoft-logo span {
  width: 100%;
  height: 100%;
  border-radius: 1px;
}

.sso-ms-red {
  background: #f25022;
}
.sso-ms-green {
  background: #7fba00;
}
.sso-ms-blue {
  background: #00a4ef;
}
.sso-ms-yellow {
  background: #ffc000;
}

.btn-sso:hover {
  border-color: #0066ff;
  color: #0066ff;
  background: #f8faff;
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.1);
}

.btn-sso:active {
  transform: scale(0.98);
}

.btn-sso:focus-visible {
  outline: 2px solid #0066ff;
  outline-offset: 2px;
}

/* ---------- Footer ---------- */
.form-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #e0e0e0;
}

.form-footer-text {
  font-size: 13px;
  color: #6c757d;
  margin: 0;
}

.form-footer-link {
  color: #0066ff;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.form-footer-link:hover {
  color: #0052cc;
  text-decoration: underline;
}

/* ---------- Loading spinner (for submit button) ---------- */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero-side::before,
  .hero-side::after,
  .hero-logo,
  .login-container,
  .hero-content,
  .form-side,
  .alert-error {
    animation: none !important;
  }

  .btn-submit::before,
  .btn-submit:hover,
  .btn-toggle-password:hover {
    transition: none !important;
    transform: none !important;
  }
}

/* ---------- Responsive form padding for small screens ---------- */
@media (max-width: 480px) {
  body.auth-page {
    padding: 0;
  }

  .login-container {
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
  }

  .form-side {
    padding: 32px 24px;
  }
}
