:root {
  --bg: #e0e0e0;
  --text: #333;
  --card: #e0e0e0;
  --input-bg: #f0f0f0;
  --btn-bg: #007bff;
  --border: rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
  --bg: #121212;
  --text: #f5f5f5;
  --card: #1e1e1e;
  --input-bg: #2a2a2a;
  --btn-bg: #0d6efd;
  --border: rgba(255, 255, 255, 0.15);
}

html {
  background-color: #121c26;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #16232f 0%, #121c26 55%, #0e1620 100%);
  background-color: #121c26;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--text);
}

.overlay {
  position: fixed;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.28);
  top: 0;
  left: 0;
  z-index: 0;
}

.auth-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  width: 100vw;
  min-height: 100vh;
  min-height: 100svh;
  background: url("../img/login-bg.jpg") center/cover no-repeat;
  background-color: var(--card);
  overflow: hidden;
}

.auth-form {
  flex: 0 1 480px;
  max-width: 100%;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  min-width: 0;
  background: transparent;
}

.auth-art {
  display: none;
}

.login-card {
  width: min(360px, 100%);
  text-align: center;
  background: #2E497A;
  border-radius: 18px;
  padding: 30px 34px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  color: #fff;
}

.login-card .role-table {
  color: #fff;
}

.login-card input,
.login-card select {
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  box-shadow: none;
}

.login-card .lang-switch {
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  box-shadow: none;
}

input, select {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border-radius: 10px;
  border: none;
  outline: none;
  background: var(--input-bg);
  color: var(--text);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] input, [data-theme="dark"] select {
  box-shadow: inset 5px 5px 10px #0a0a0a, inset -5px -5px 10px #242424;
}

button {
  padding: 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  background: var(--btn-bg);
  color: white;
  width: 100%;
  margin-top: 8px;
}

.theme-toggle {
  margin-top: 15px;
  cursor: pointer;
  font-size: 14px;
  color: var(--btn-bg);
}

.lang-bar {
  text-align: right;
  margin-bottom: 6px;
}

.lang-bar .lang-switch {
  width: auto;
  display: inline-block;
  margin: 0;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
  box-shadow: none;
  cursor: pointer;
}

.login-error {
  background-color: #f8d7da;
  color: #842029;
  padding: 12px 15px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  opacity: 0;
  transform: translateY(-20px);
  animation: fadeSlideIn 0.5s forwards;
}

.login-error.fade-out {
  animation: fadeSlideOut 0.5s forwards;
}

@keyframes fadeSlideIn {
  to { opacity: 1; transform: translateY(0); }
}

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

h2 {
  margin-bottom: 20px;
}

.role-table {
  width: 100%;
  margin: 20px 0 0 0;
  border-collapse: collapse;
}

.role-table {
  color: var(--text);
}
.role-table th {
  border: 1px solid #ccc;
  padding: 6px;
  text-align: center;
  background: var(--btn-bg);
  color: #fff;
  font-size: 13px;
}
.role-table td {
  border: 1px solid #ccc;
  padding: 6px;
  text-align: center;
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
}

[data-theme="dark"] .role-table th {
  border-color: #444;
}
[data-theme="dark"] .role-table td {
  border-color: #444;
  background: #2a2a2a;
}

.password-wrapper {
  position: relative;
}
.password-wrapper i {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: #666;
}
[data-theme="dark"] .password-wrapper i {
  color: #ccc;
}
[dir="rtl"] .password-wrapper i {
  right: auto;
  left: 15px;
}
.login-brand {
  margin-bottom: 18px;
  text-align: center;
}

.login-brand .brand-mikhmon {
  display: block;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.15;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ffe9ab 0%, #ffd56b 45%, #fff6d8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.login-brand .brand-mikhmon b {
  font-weight: 900;
}

.login-brand .brand-sub {
  display: inline-block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: #cfe0ff;
}

.login-logo {
  margin-bottom: 16px;
  text-align: center;
}

.login-logo img {
  width: 150px;
  height: auto;
  filter: drop-shadow(0 0 12px rgba(0,0,0,0.4));
}

.forgot-link {
  margin-top: 15px;
}
.forgot-link a {
  color: #0d6efd;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.forgot-link a:hover {
  text-decoration: underline;
}
[data-theme="dark"] .forgot-link a {
  color: #60a5fa;
}

@media (max-width: 768px) {
  .auth-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100vw;
    min-height: 100vh;
    min-height: 100svh;
  }
  .auth-form {
    flex: 1 0 auto;
    margin-left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 24px 18px;
  }
  .auth-art {
    display: none;
  }
  .login-card {
    width: min(360px, 100%);
    max-width: 100%;
  }
  .login-logo {
    margin-bottom: 10px;
  }
  .login-logo img {
    width: 110px;
  }
  .login-brand .brand-mikhmon {
    font-size: 27px;
    letter-spacing: 1.5px;
  }
  h2 {
    font-size: 20px;
    margin-bottom: 12px;
  }
  .login-card input,
  .login-card select {
    padding: 12px;
    margin: 8px 0;
    font-size: 16px;
  }
  .login-card button {
    padding: 12px;
  }
  .role-table {
    display: none;
  }
}

@media (max-height: 760px) {
  .login-card {
    padding: 18px 28px;
    border-radius: 16px;
  }
  .login-logo {
    margin-bottom: 10px;
  }
  .login-logo img {
    width: 110px;
  }
  h2 {
    margin-bottom: 10px;
    font-size: 20px;
  }
  input, select {
    padding: 10px;
    margin: 7px 0;
  }
  button {
    padding: 10px;
    margin-top: 6px;
  }
  .role-table {
    margin-top: 10px;
  }
  .role-table th,
  .role-table td {
    padding: 4px;
    font-size: 12px;
  }
}
