/*
 * SokOffice Casdoor theme — Ant Design login (not MUI).
 * Loaded after main.css via docker/casdoor/Dockerfile.
 *
 * IMPORTANT: login layout rules MUST stay under .sok-auth-page /
 * #root:has(.sok-auth-page). Global .ant-layout / #root flex resets
 * break the Casdoor admin console (menus stack, charts collapse).
 */

/* ------- Login-only full-viewport shell ------- */
html:has(.sok-auth-page),
body:has(.sok-auth-page),
#root:has(.sok-auth-page) {
  height: 100%;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
}

#root:has(.sok-auth-page) {
  display: flex;
  align-items: center;
  justify-content: center;
}

#root:has(.sok-auth-page) > div,
#root:has(.sok-auth-page) #parent-area,
#root:has(.sok-auth-page) .ant-layout,
#root:has(.sok-auth-page) .ant-layout-content,
#root:has(.sok-auth-page) .loginBackground,
.sok-auth-page .ant-layout,
.sok-auth-page .ant-layout-content,
.sok-auth-page .loginBackground {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  min-height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  background: transparent !important;
  box-sizing: border-box !important;
}

/* Hide Casdoor chrome on login only (do not touch admin layout) */
#root:has(.sok-auth-page) .github-corner,
#root:has(.sok-auth-page) .show-github-corner,
#root:has(.sok-auth-page) .language-box,
#root:has(.sok-auth-page) .language-select,
#root:has(.sok-auth-page) .footer,
#root:has(.sok-auth-page) #footer,
#root:has(.sok-auth-page) .ant-layout-footer,
#root:has(.sok-auth-page) .login-powered-by,
#root:has(.sok-auth-page) .back-inner-button,
#root:has(.sok-auth-page) .signin-methods,
#root:has(.sok-auth-page) .ant-tabs.signin-methods,
#root:has(.sok-auth-page) .login-panel-logo,
#root:has(.sok-auth-page) .login-logo,
#root:has(.sok-auth-page) .side-image {
  display: none !important;
}

/* ------- Page background (matches SokOffice user-design-page) ------- */
html:has(.sok-auth-page),
body:has(.sok-auth-page),
#root:has(.sok-auth-page),
.sok-auth-page {
  background:
    radial-gradient(circle at 8% 89%, rgba(98, 175, 255, 0.3) 0, rgba(135, 196, 255, 0.15) 12%, rgba(255, 255, 255, 0) 24%),
    radial-gradient(circle at 93% 17%, rgba(114, 166, 255, 0.12) 0, rgba(255, 255, 255, 0) 35%),
    linear-gradient(112deg, #ffffff 0%, #fbfdff 44%, #f6f9ff 74%, #eef5ff 100%) !important;
  color: #07123b;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

.sok-auth-page::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(110, 150, 215, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 150, 215, 0.028) 1px, transparent 1px);
  background-size: 120px 120px;
  mask-image: radial-gradient(circle at 88% 12%, #000 0 16%, transparent 44%);
}

.sok-auth-page {
  width: 100% !important;
  max-width: 100% !important;
  position: relative;
  z-index: 1;
}

.sok-auth-shell {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  box-sizing: border-box;
}

.sok-auth-card {
  width: 100%;
  max-width: 440px;
  padding: 32px 28px 24px;
  border: 1px solid rgba(218, 226, 243, 0.88);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow:
    0 22px 50px rgba(77, 126, 214, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(18px);
  box-sizing: border-box;
}

/* ------- Brand mark (CSS, same as frontend user-brand) ------- */
.sok-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
  color: #07123b;
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1;
}

.sok-brand-mark {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.sok-brand-mark span {
  position: absolute;
  border-radius: 5px;
  box-shadow: 0 6px 14px rgba(19, 112, 255, 0.16);
}

.sok-brand-mark span:nth-child(1) {
  inset: 2px 9px 12px 2px;
  background: linear-gradient(135deg, #8fa7ff, #1f55ee);
  opacity: 0.72;
}

.sok-brand-mark span:nth-child(2) {
  inset: 9px 2px 2px 11px;
  background: linear-gradient(135deg, #28cdf5, #1a68ff);
  opacity: 0.84;
}

.sok-brand-mark span:nth-child(3) {
  inset: 6px 12px 6px 6px;
  background: linear-gradient(135deg, #3766ff, #39b6f4);
}

.sok-auth-title {
  margin: 0;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #07123b;
  line-height: 1.2;
}

.sok-auth-subtitle {
  margin: 12px 0 0;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  color: #65728a;
}

.sok-auth-form-wrap {
  margin-top: 24px;
}

.sok-auth-crosslink {
  margin: 20px 0 0;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: #65728a;
}

.sok-auth-home {
  margin-top: 10px;
}

.sok-auth-copyright {
  margin: 16px 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: #8a96ab;
}

.sok-secondary-link {
  border: none;
  background: none;
  padding: 0;
  color: #005add;
  font-weight: 700;
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}

.sok-secondary-link:hover {
  text-decoration: underline;
}

.sok-secondary-link:focus-visible {
  outline: 3px solid rgba(62, 132, 255, 0.38);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------- Hide upstream chrome inside our shell ------- */
.sok-auth-form-wrap .github-corner,
.sok-auth-form-wrap .show-github-corner,
.github-corner,
.sok-auth-form-wrap .login-signup-link,
.sok-auth-form-wrap .signup-link {
  display: none !important;
}

/* Collapse Casdoor outer layout when wrapped */
.sok-auth-page .login-content {
  margin: 0 !important;
  width: 100%;
}

.sok-auth-page .login-panel,
.sok-auth-page .login-panel-dark {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
  min-width: 0 !important;
}

.sok-auth-page .login-form {
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
}

.sok-auth-page .side-image {
  display: none !important;
}

/* ------- Ant Design form ------- */
.sok-auth-form-wrap .ant-form,
.sok-auth-form-wrap form[name="normal_login"] {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
}

.sok-auth-form-wrap .ant-form-item,
.sok-auth-form-wrap .ant-col,
.sok-auth-form-wrap .ant-row,
.sok-auth-form-wrap .login-username,
.sok-auth-form-wrap .login-password,
.sok-auth-form-wrap .login-button-box {
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  float: none !important;
}

.sok-auth-form-wrap .login-forget-password {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  width: 100% !important;
  max-width: 100% !important;
  float: none !important;
  clear: both !important;
  margin: 4px 0 16px !important;
  overflow: visible !important;
}

.sok-auth-form-wrap .login-forget-password .ant-checkbox-wrapper,
.sok-auth-form-wrap .login-forget-password a {
  float: none !important;
}

.sok-auth-form-wrap .login-button-box {
  clear: both !important;
  margin-top: 8px !important;
}

.sok-auth-form-wrap .ant-form-item-label > label {
  color: #65728a !important;
  font-weight: 600 !important;
}

.sok-auth-form-wrap .ant-input,
.sok-auth-form-wrap .ant-input-affix-wrapper,
.sok-auth-form-wrap .ant-input-password {
  border-radius: 10px !important;
  border-color: rgba(180, 200, 240, 0.85) !important;
}

.sok-auth-form-wrap .ant-input:focus,
.sok-auth-form-wrap .ant-input-affix-wrapper-focused,
.sok-auth-form-wrap .ant-input-password:focus-within {
  border-color: #007bff !important;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.12) !important;
}

.sok-auth-form-wrap .ant-btn-primary,
.sok-auth-form-wrap button.signup-button,
.sok-auth-form-wrap .login-button {
  width: 100% !important;
  height: auto !important;
  min-height: 44px;
  border-radius: 10px !important;
  border: none !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  text-transform: none !important;
  background: linear-gradient(180deg, #1773ff, #004ddc) !important;
  box-shadow:
    0 14px 34px rgba(0, 83, 221, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.26) !important;
}

.sok-auth-form-wrap .ant-btn-primary:hover,
.sok-auth-form-wrap button.signup-button:hover,
.sok-auth-form-wrap .login-button:hover {
  background: linear-gradient(180deg, #1a82ff, #0050e6) !important;
  box-shadow:
    0 18px 42px rgba(0, 83, 221, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

.sok-auth-form-wrap .ant-tabs-tab {
  font-weight: 600 !important;
}

.sok-auth-form-wrap .ant-tabs-tab-active .ant-tabs-tab-btn {
  color: #005add !important;
}

.sok-auth-form-wrap a {
  color: #1773ff !important;
  font-weight: 700;
}

/* Signup: vertical labels on all breakpoints inside shell */
.sok-auth-form-wrap form[name="signup"].ant-form-horizontal .ant-form-item-label {
  text-align: left !important;
}

.sok-auth-form-wrap form[name="signup"] .ant-form-item {
  margin-bottom: 16px;
}

@media (max-width: 760px) {
  .sok-auth-card {
    max-width: calc(100vw - 32px);
    padding: 24px 20px 20px;
  }
}
