/* =================== متغیرهای تم =================== */
:root,
[theme='light'] {
  --bg-color: #f4f6f9;
  --text-color: #1e1e2d;
  --card-bg: #ffffff;
  --navbar-bg: #661fff;
  --navbar-hover: #5815e3;
  --navbar-link-color: #ffffff;
  --menu-hover-bg: rgba(255, 255, 255, 0.15);
  --border-color: #e2e8f0;
  --accent-purple: #661fff;
  --hero-gradient: linear-gradient(145deg, #7a22ff 0%, #5300e8 100%);
  --subtext-color: #64748b;
  --item-border: #f1f5f9;
  --input-border: #cbd5e1;
  --error-color: #ef4444;
}

[theme='dark'] {
  --bg-color: #121218;
  --text-color: #f1f1f1;
  --card-bg: #1e1e2a;
  --navbar-bg: #1e1538;
  --navbar-hover: #261b46;
  --navbar-link-color: #ffffff;
  --menu-hover-bg: rgba(255, 255, 255, 0.1);
  --border-color: #333346;
  --accent-purple: #8b5cf6;
  --hero-gradient: linear-gradient(145deg, #4f14b8 0%, #2f0676 100%);
  --subtext-color: #94a3b8;
  --item-border: #29293a;
  --input-border: #475569;
  --error-color: #f87171;
}

/* =================== تنظیمات پایه =================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Vazirmatn', sans-serif;
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease;
}

html {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* =================== کانتینر و کارت ورود =================== */
.auth-container {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px 50px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 36px 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.auth-title {
  font-size: 1.85rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 26px;
  color: var(--text-color);
}

/* =================== المان‌های فرم =================== */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  position: relative;
}

.form-label {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 7px;
  display: block;
  color: var(--text-color);
}

.input-with-icon {
  position: relative;
  width: 100%;
}

.form-input {
  width: 100%;
  height: 50px;
  background: var(--card-bg);
  border: 1.5px solid var(--input-border);
  border-radius: 12px;
  color: var(--text-color);
  font-size: 0.95rem;
  padding: 0 46px 0 16px;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

[dir='ltr'] .form-input {
  padding: 0 16px 0 46px;
}

.form-input:focus {
  border-color: var(--accent-purple);
}

.input-with-icon .field-icon {
  position: absolute;
  top: 25px;
  transform: translateY(-50%);
  right: 14px;
  color: var(--subtext-color);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

[dir='ltr'] .input-with-icon .field-icon {
  right: auto;
  left: 14px;
}

.password-group .form-input {
  padding-left: 46px;
  padding-right: 46px;
}

[dir='ltr'] .password-group .form-input {
  padding-left: 46px;
  padding-right: 46px;
}

.toggle-password {
  position: absolute;
  top: 25px;
  transform: translateY(-50%);
  left: 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--subtext-color);
  opacity: 0.8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
}

[dir='ltr'] .toggle-password {
  left: auto;
  right: 14px;
}

.eye-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.input-error {
  border-color: var(--error-color) !important;
}

.error-message {
  color: var(--error-color);
  font-size: 0.8rem;
  margin-top: 5px;
  min-height: 16px;
  font-weight: 500;
  display: block;
}

/* =================== دکمه و لینک‌ها =================== */
.auth-submit-btn {
  width: 100%;
  height: 50px;
  background: var(--accent-purple);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  margin-top: 6px;
  transition: opacity 0.2s ease;
}

.auth-submit-btn:hover {
  opacity: 0.9;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.95rem;
  color: var(--subtext-color);
}

.auth-switch-link {
  color: var(--accent-purple);
  text-decoration: none;
  font-weight: 800;
  margin-right: 6px;
}

[dir='ltr'] .auth-switch-link {
  margin-right: 0;
  margin-left: 6px;
}

.auth-switch-link:hover {
  text-decoration: underline;
}

/* =================== فوتر =================== */
.footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  text-align: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px)) 20px;
  flex-shrink: 0;
  width: 100%;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-text {
  font-size: 0.88rem;
  color: var(--subtext-color);
}

/* =================== ریسپانسیو =================== */
@media screen and (max-width: 600px) {
  .auth-container {
    padding: 20px 14px 30px;
  }

  .auth-card {
    border-radius: 20px;
    padding: 28px 18px;
  }

  .auth-title {
    font-size: 1.6rem;
  }

  .form-input,
  .auth-submit-btn {
    height: 46px;
  }

  .input-with-icon .field-icon,
  .toggle-password {
    top: 23px;
  }
}
