/* Torbatyar — تم ورود Keycloak (هم‌سبک با frontend) */
:root {
  --ty-primary: #0284c7;
  --ty-secondary: #0f172a;
  --ty-primary-soft: rgba(2, 132, 199, 0.08);
  --ty-primary-muted: rgba(2, 132, 199, 0.12);
  --ty-radius: 0.75rem;
  --ty-radius-lg: 1rem;
}

html,
body,
.login-pf,
.login-pf body {
  direction: rtl !important;
  text-align: right !important;
  font-family: "Yekan Bakh FaNum", Tahoma, sans-serif !important;
}

body {
  background: linear-gradient(180deg, var(--ty-primary-soft) 0%, #ffffff 45%) !important;
  min-height: 100vh;
}

.login-pf-page {
  background: transparent !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 100vh !important;
  padding: 1.5rem 1rem !important;
}

#kc-header {
  margin-bottom: 1rem;
  width: 100%;
  max-width: 420px;
}

#kc-header-wrapper {
  font-size: 0 !important;
  text-align: center !important;
  padding: 0 !important;
}

#kc-header-wrapper::before {
  content: "Torbatyar";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--ty-radius-lg);
  background: var(--ty-primary);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.25);
  margin-bottom: 0.75rem;
}

#kc-header-wrapper::after {
  content: "Torbatyar";
  display: block;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ty-secondary);
  line-height: 1.6;
}

/* ---- Auth panel header ---- */
.ty-auth-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.ty-auth-title {
  font-size: 1.375rem !important;
  font-weight: 800 !important;
  color: var(--ty-secondary) !important;
  margin: 0 0 0.35rem !important;
}

.ty-auth-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
}

.ty-form-group {
  margin-bottom: 0.85rem !important;
}

.ty-form-group label {
  display: block;
  margin-bottom: 0.35rem;
}

.ty-input-ltr {
  direction: ltr !important;
  text-align: left !important;
}

.card-pf {
  background: #fff !important;
  border: 1px solid #f3f4f6 !important;
  border-radius: 1rem !important;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.06) !important;
  padding: 1.75rem !important;
  width: 100% !important;
  max-width: 420px !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
}

#kc-form,
#kc-form-wrapper,
#kc-form-login,
#kc-register-form,
#kc-passwd-update-form,
#kc-reset-password-form {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

#kc-page-title,
.login-pf-header h1,
#kc-form-wrapper h1 {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: var(--ty-secondary) !important;
  text-align: center !important;
  margin-bottom: 1.25rem !important;
}

.pf-c-form__label,
.login-pf-settings label,
label {
  font-weight: 600 !important;
  color: var(--ty-secondary) !important;
  font-size: 0.875rem !important;
}

.pf-c-form-control,
input[type="text"],
input[type="password"],
input[type="email"] {
  direction: rtl !important;
  text-align: right !important;
  border-radius: var(--ty-radius) !important;
  border: 1px solid #e5e7eb !important;
  padding: 0.65rem 0.85rem !important;
  font-family: "Yekan Bakh FaNum", Tahoma, sans-serif !important;
  font-size: 0.95rem !important;
  box-shadow: none !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.pf-c-form-control:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
  border-color: var(--ty-primary) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px var(--ty-primary-muted) !important;
}

#kc-login,
input[type="submit"].pf-m-primary,
#kc-form-buttons input[type="submit"] {
  width: 100% !important;
  max-width: 100% !important;
  border-radius: var(--ty-radius-lg) !important;
  background: var(--ty-primary) !important;
  border: none !important;
  color: #fff !important;
  font-family: "Yekan Bakh FaNum", Tahoma, sans-serif !important;
  font-weight: 700 !important;
  font-size: 0.95rem !important;
  padding: 0.75rem 1rem !important;
  margin-top: 0.5rem !important;
  transition: opacity 0.2s ease !important;
  box-sizing: border-box !important;
}

#kc-login:hover,
input[type="submit"].pf-m-primary:hover,
#kc-form-buttons input[type="submit"]:hover {
  opacity: 0.92 !important;
  background: var(--ty-primary) !important;
}

#kc-form-options {
  text-align: right !important;
}

#kc-form-options a,
#kc-registration a {
  color: var(--ty-primary) !important;
  font-weight: 600 !important;
}

#kc-form-options a:hover,
#kc-registration a:hover {
  text-decoration: underline !important;
}

.ty-mobile-login {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid #f3f4f6;
  text-align: center;
}

.ty-mobile-login-divider {
  margin-bottom: 0.75rem;
  color: #9ca3af;
  font-size: 0.875rem;
}

.ty-mobile-login-link {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--ty-radius-lg);
  border: 1px solid #e5e7eb !important;
  background: #fff !important;
  color: var(--ty-secondary) !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  box-sizing: border-box !important;
}

.ty-mobile-login-link:hover {
  border-color: var(--ty-primary) !important;
  color: var(--ty-primary) !important;
}

#input-error,
.pf-c-alert,
.alert-error,
.kc-feedback-text {
  border-radius: var(--ty-radius) !important;
  direction: rtl !important;
  text-align: right !important;
  font-family: "Yekan Bakh FaNum", Tahoma, sans-serif !important;
}

#kc-info-wrapper {
  background: var(--ty-primary-soft) !important;
  border: none !important;
  border-radius: var(--ty-radius) !important;
  direction: rtl !important;
}

#kc-locale {
  position: relative;
  direction: ltr;
  text-align: left;
  margin-bottom: 0.75rem;
  align-self: flex-start;
  width: 100%;
  max-width: 420px;
}

#kc-locale-dropdown,
#kc-locale-wrapper {
  position: relative;
}

#kc-locale .pf-c-dropdown__menu,
#language-switch1 {
  display: none !important;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: auto;
  z-index: 100;
  min-width: 9rem;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: var(--ty-radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}

#kc-locale.ty-locale-open .pf-c-dropdown__menu,
#kc-locale.ty-locale-open #language-switch1 {
  display: block !important;
}

#kc-locale .pf-c-dropdown__menu-item {
  display: block;
  padding: 0.5rem 0.85rem;
  color: var(--ty-secondary) !important;
  text-decoration: none !important;
  font-size: 0.875rem;
  font-weight: 600;
}

#kc-locale .pf-c-dropdown__menu-item:hover {
  background: var(--ty-primary-soft);
  color: var(--ty-primary) !important;
}

#kc-current-locale-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: var(--ty-radius);
  background: #fff;
  cursor: pointer;
  font-family: "Yekan Bakh FaNum", Tahoma, sans-serif !important;
  font-weight: 600 !important;
  font-size: 0.875rem;
  color: var(--ty-secondary);
}

#kc-current-locale-link::after {
  content: "▾";
  font-size: 0.75rem;
  opacity: 0.7;
}

.login-pf-header {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.checkbox label,
#rememberMe {
  font-size: 0.875rem !important;
}

.login-pf-footer {
  text-align: center !important;
  color: #6b7280 !important;
  font-size: 0.8rem !important;
}

#kc-content,
#kc-content-wrapper {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

@media (max-width: 767px) {
  .card-pf {
    margin: 0 !important;
  }
}

/* ---- Unified auth tabs (password | mobile) ---- */
.ty-auth-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: #f9fafb;
  border-radius: var(--ty-radius-lg);
  margin-bottom: 1.25rem;
}

.ty-auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.5rem 0.75rem;
  border-radius: var(--ty-radius);
  font-family: "Yekan Bakh FaNum", Tahoma, sans-serif !important;
  font-weight: 700;
  font-size: 0.875rem;
  color: #6b7280;
  cursor: pointer;
}

.ty-auth-tab--active {
  background: #fff;
  color: var(--ty-primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.ty-auth-panel {
  display: none;
}

.ty-auth-panel.ty-auth-panel--active {
  display: block !important;
}

.ty-auth-panel[hidden] {
  display: none !important;
}

.ty-mobile-hint {
  font-size: 0.8125rem;
  color: #6b7280;
  text-align: center;
  margin-bottom: 1rem;
}

.ty-mobile-error {
  background: #fef2f2;
  color: #dc2626;
  border-radius: var(--ty-radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.ty-signup-fields {
  margin: 0.75rem 0 1rem;
  padding: 1rem;
  border: 1px solid #f3f4f6;
  border-radius: var(--ty-radius-lg);
  background: rgba(249, 250, 251, 0.85);
  animation: ty-fade-in 0.25s ease;
}

@keyframes ty-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.ty-signup-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ty-secondary);
  margin-bottom: 0.5rem;
}

.ty-btn-primary {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--ty-radius-lg);
  background: var(--ty-primary);
  color: #fff;
  font-family: "Yekan Bakh FaNum", Tahoma, sans-serif !important;
  font-weight: 700;
  cursor: pointer;
}

.ty-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ty-link-btn {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  border: none;
  background: none;
  color: var(--ty-primary);
  font-family: "Yekan Bakh FaNum", Tahoma, sans-serif !important;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-align: center;
}

.ty-otp-input {
  text-align: center !important;
  letter-spacing: 0.35em;
  font-family: monospace !important;
  font-size: 1.125rem !important;
}

.ty-otp-sent,
.ty-countdown {
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
}

.ty-countdown {
  color: var(--ty-primary);
}

input[type="tel"] {
  direction: ltr !important;
  text-align: left !important;
}
