:root {
  --primary-color: #2ecc71;
  --bg-light: #f5f7fa;
  --bg-dark: #1e1e2f;
  --text-light: #333;
  --text-dark: #f0f0f0;
  --border-light: #ddd;
  --border-dark: #444;
  --error-color: #e74c3c;
  --success-color: #2ecc71;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --radius: 8px;
}

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

body {
  font-family: "Vazir", "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  font-size: 16px;
  transition: background-color 0.3s, color 0.3s;
  min-height: 100vh;
  padding: 20px;
}

body.light-theme {
  background-color: var(--bg-light);
  color: var(--text-light);
}

body.dark-theme {
  background-color: var(--bg-dark);
  color: var(--text-dark);
}

.container {
  max-width: 800px;
  margin: auto;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
  direction: rtl;
  text-align: right;
}

body.dark-theme .container {
  background: #2d2d42;
}

header {
  margin-bottom: 30px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 10px;
}

.left-section {
  display: flex;
  align-self: flex-start;
}

.right-section {
  display: flex;
  align-self: flex-start;
}

.title-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.title-only {
  text-align: center;
}

#main-title {
  text-align: center;
}

.subtitle-section {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

#subtitle {
  font-size: 0.95rem;
  color: #e74c3c;
  font-weight: 500;
  padding: 8px;
  background-color: #ffebee;
  border-radius: 6px;
  border: 1px solid #f19c9c;
  max-width: 600px;
  text-align: center;
}

body[dir="ltr"] #subtitle {
  text-align: left !important;
}

body[dir="rtl"] #subtitle {
  text-align: right !important;
}

body.dark-theme #subtitle {
  color: #ff9d9d;
  background-color: #4a2c2c;
  border: 1px solid #7a4a4a;
}

#subtitle strong {
  font-weight: bold;
  color: #c0392b;
}

body.dark-theme #subtitle strong {
  color: #ff7b72;
}

.logo {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  cursor: pointer;
}

h1 {
  font-size: 1.8rem;
  color: var(--primary-color);
}

body[dir="ltr"] h1 {
  text-align: left;
  direction: ltr;
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border 0.3s;
}

body.dark-theme input {
  background: #3a3a4d;
  color: var(--text-dark);
  border-color: var(--border-dark);
}

input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.3);
}

.caption {
  font-size: 0.8rem;
  color: #777;
  margin-top: 4px;
}

body.dark-theme .caption {
  color: #aaa;
}

.error {
  color: var(--error-color);
  font-size: 0.85rem;
  margin-top: 5px;
  display: none;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.btn-bmi {
  font-family: "Vazir", "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  text-align: center;
  display: inline-block;
  flex-grow: 1;
  max-width: 48%;
  background: #3498db;
  color: white;
}

.btn-submit {
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.1rem;
  text-decoration: none;
  text-align: center;
  background: var(--primary-color);
  color: white;
  display: inline-block;
  flex-grow: 1;
  max-width: 48%;
}

.bmi-page-form .btn-submit,
.bmi-page-form .btn-bmi {
  width: 100%;
  max-width: none;
  margin-top: 15px;
  display: block;
}

.btn-bmi:hover,
.btn-submit:hover {
  opacity: 0.9;
}

body[dir="ltr"] {
  direction: ltr;
  text-align: left;

  font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body[dir="ltr"] .container {
  direction: ltr;
  text-align: left;
}

@media (max-width: 768px) {
  .form-actions {
    flex-direction: column;
    gap: 10px;
  }

  .btn-bmi,
  .btn-submit {
    max-width: 100%;
  }
}

.result-box {
  padding: 20px;
  border-radius: var(--radius);
  transition: background-color 0.3s;
  border: 2px solid transparent;
  margin-bottom: 20px;
}

.result-positive {
  color: var(--error-color);
  font-weight: bold;
  text-align: center;
}

.result-negative {
  color: var(--success-color);
  font-weight: bold;
  text-align: center;
}

.result-positive-bg {
  background-color: #fadbd8;
  border-color: var(--error-color);
}

.result-negative-bg {
  background-color: #d5f4e6;
  border-color: var(--success-color);
}

.result-uncertain-bg {
  background-color: #fdf2e9;
  border-color: #f39c12;
}

body.dark-theme .result-positive-bg {
  background-color: #552a2a;
  border-color: #ff7b72;
}

body.dark-theme .result-negative-bg {
  background-color: #2a554a;
  border-color: #58d68d;
}

body.dark-theme .result-uncertain-bg {
  background-color: #5a4a2a;
  border-color: #ffbb69;
}

.user-data-table {
  margin-bottom: 20px;
}

.user-data-table table {
  width: 100%;
  border-collapse: collapse;
}

body[dir="rtl"] .user-data-table table {
  direction: rtl;
}

body[dir="ltr"] .user-data-table table {
  direction: ltr;
}

.user-data-table table,
.user-data-table th,
.user-data-table td {
  border: 1px solid var(--border-light);
}

body.dark-theme .user-data-table table,
body.dark-theme .user-data-table th,
body.dark-theme .user-data-table td {
  border-color: var(--border-dark);
}

.user-data-table th,
.user-data-table td {
  padding: 8px;
  text-align: right;
}

body[dir="ltr"] .user-data-table th,
body[dir="ltr"] .user-data-table td {
  text-align: left;
}

.user-data-table th {
  background-color: #f1f1f1;
}

body.dark-theme .user-data-table th {
  background-color: #444;
}

.lang-flags {
  display: flex;
  gap: 10px;
  margin-left: 10px;
}

.flag {
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.3s, transform 0.2s ease;
}

.flag.active {
  opacity: 1;
  transform: scale(1.1);
}

.flag:hover {
  opacity: 1;
  transform: scale(1.2);
}

.btn-lang {
  padding: 8px 15px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  background: var(--primary-color);
  color: white;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-theme {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  background: #2ecc71;
  color: white;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-lang:hover,
.btn-theme:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  background: #27ae60;
  position: relative;
  z-index: 10;
}

.btn-submit,
.btn-bmi {
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    box-shadow 0.3s ease-out, background 0.3s ease-out;
}

.btn-submit:hover,
.btn-bmi:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.footer {
  margin-top: 40px;
  padding: 20px;
  background-color: #f9f9f9;
  border-top: 1px solid #eee;
  text-align: center;
  font-size: 0.85rem;
  color: #666;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
}

body.dark-theme .footer {
  background-color: #2a2a3c;
  border-top: 1px solid #444;
  color: #aaa;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.2);
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.footer-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: bold;
}

.footer-link:hover {
  text-decoration: underline;
}

.github-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.github-link {
  display: inline-block;
  margin: 5px 0;
  transition: transform 0.2s ease;
}

.github-link:hover {
  transform: scale(1.1);
}

.github-logo {
  filter: invert(20%) sepia(0%) saturate(100%) hue-rotate(0deg) brightness(100%)
    contrast(100%);
}

body.dark-theme .github-logo {
  filter: invert(90%) sepia(10%) saturate(100%) hue-rotate(180deg)
    brightness(105%) contrast(95%);
}

.github-tag {
  font-size: 0.75rem;
  color: #777;
  margin: 0;
  text-align: center;
}

body.dark-theme .github-tag {
  color: #aaa;
}

.bmi-formula-img {
  width: 200px;
  height: auto;
  display: block;
  margin: 10px auto;
}

.logo-click-message {
  font-size: 0.85rem;
  color: #777;
  text-align: center;
  margin-top: 10px;
}

body.dark-theme .logo-click-message {
  color: #aaa;
}

.tooltip-icon {
  font-size: 0.8rem;
  color: #777;
  margin-left: 5px;
  cursor: help;
  display: inline-block;
  width: 16px;
  height: 16px;
  text-align: center;
  line-height: 16px;
  border-radius: 50%;
  background-color: #e0e0e0;
  transition: background-color 0.2s ease;
}

body.dark-theme .tooltip-icon {
  background-color: #555;
  color: #aaa;
}

.tooltip-icon:hover {
  background-color: #ccc;
}

.result-actions {
  margin-top: 30px;
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.result-actions a {
  min-width: 180px;
  text-align: center;
  flex-grow: 1;
  max-width: 45%;
}

@media (max-width: 500px) {
  .result-actions a {
    max-width: 100%;
  }
}

.btn-secondary {
  background-color: transparent !important;
  color: var(--primary-color) !important;
  border: 2px solid var(--primary-color) !important;
  box-shadow: none !important;
}

.btn-secondary:hover {
  background-color: rgba(46, 204, 113, 0.1) !important;
}

.result-actions .btn-submit:not(.btn-secondary):hover {
  box-shadow: 0 6px 10px rgba(46, 204, 113, 0.4);
  transform: translateY(-2px);
}

#accuracy-info,
#annual-checkup {
  text-align: center;
  font-size: 0.9rem;
  color: #666;
  margin-top: 15px;
}

body.dark-theme #accuracy-info,
body.dark-theme #annual-checkup {
  color: #aaa;
}

.thanks-content {
  text-align: center;
  padding: 20px;
}

.thanks-content h2 {
  color: var(--primary-color);
  margin-bottom: 20px;
}

.thanks-content p {
  font-size: 1.1rem;
  margin-bottom: 30px;
}
body {
  line-height: 1.6;
  font-size: 16px;
}

body.lang-fa {
  font-family: "Vazir", "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.attention-note {
  font-size: 0.95rem;
  color: #e74c3c;
  font-weight: 500;
  padding: 8px 12px;
  background-color: #ffebee;
  border-radius: 6px;
  border: 1px solid #f19c9c;
  max-width: 600px;
  text-align: center;
  margin: 10px auto 0 auto;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  line-height: 1.45;
}

.attention-note strong {
  font-weight: 700;
  color: #c0392b;
}

.attention-note em {
  font-style: normal;
  font-weight: 600;
  color: #c0392b;
}

body.dark-theme .attention-note {
  color: #ff9d9d;
  background-color: #4a2c2c;
  border: 1px solid #7a4a4a;
  box-shadow: none;
}

body.dark-theme .attention-note strong {
  color: #ff7b72;
}

body.dark-theme .attention-note em {
  color: #ff7b72;
}

body[dir="ltr"] .attention-note {
  text-align: left;
}

.tooltip {
  display: inline-block;
  margin-inline-start: 8px;
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1;
  background: #3498db;
  color: #fff;
  border-radius: 6px;
  vertical-align: middle;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.15s;
}

body[dir="rtl"] .tooltip {
  margin-inline-start: 8px;
  margin-inline-end: 0;
}

body[dir="ltr"] .tooltip {
  margin-inline-start: 0;
  margin-inline-end: 8px;
}

.tooltip.icon {
  background: transparent;
  color: #777;
  padding: 0;
  font-weight: 600;
}

.field-note {
  display: block;
  font-size: 0.95rem;
  color: #e74c3c;
  font-weight: 500;
  padding: 8px 12px;
  background-color: #ffebee;
  border-radius: 6px;
  border: 1px solid #f19c9c;
  max-width: 600px;
  width: 100%;
  text-align: center;
  margin: 8px 0 0 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  line-height: 1.45;
}

.field-note.inline {
  display: inline-block;
  vertical-align: middle;
  width: auto;
  padding: 4px 8px;
  font-size: 0.82rem;
  margin-inline-start: 0.6rem;
  margin-inline-end: 0;
  color: #e74c3c;
  font-weight: 500;
  background-color: #ffebee;
  border-radius: 6px;
  border: 1px solid #f19c9c;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  line-height: 1;
  white-space: nowrap;
  text-align: center;
}

body.dark-theme .field-note.inline {
  color: #ff9d9d;
  background-color: #4a2c2c;
  border: 1px solid #7a4a4a;
  box-shadow: none;
}

body.dark-theme .field-note {
  color: #ff9d9d;
  background-color: #4a2c2c;
  border: 1px solid #7a4a4a;
  box-shadow: none;
}
body.dark-theme .field-note strong,
body.dark-theme .field-note em {
  color: #ff7b72;
}

.field-note strong {
  font-weight: 700;
  color: #c0392b;
}

.field-note em {
  font-style: normal;
  font-weight: 600;
  color: #c0392b;
}

@media (max-width: 520px) {
  .field-note.inline {
    display: block;
    width: 100%;
    margin: 6px 0 0 0;
    font-size: 0.9rem;
    text-align: center;
    white-space: normal;
  }
}

.lang-flags {
  display: flex;
  gap: 10px;
  align-items: center;
}

.lang-flags .flag {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.lang-flags .flag img {
  display: block;
  width: 28px;
  height: auto;
  line-height: 1;
  vertical-align: middle;
  user-select: none;
  -webkit-user-drag: none;
}

.lang-flags .flag.active {
  transform: scale(1.05);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  outline: 2px solid rgba(0, 0, 0, 0.06);
}

.theme-toggle-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.theme-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.theme-track {
  width: 68px;
  height: 34px;
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.01));
  border: 1px solid rgba(0, 0, 0, 0.06);
  position: relative;
  transition: background 220ms ease, border-color 220ms ease,
    box-shadow 220ms ease;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
  display: inline-block;
}

.theme-knob {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 260ms cubic-bezier(0.22, 0.9, 0.3, 1), box-shadow 260ms;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #2ecc71;
}

.theme-checkbox:checked + .theme-track {
  background: linear-gradient(180deg, #30db87, #27ae60);
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 20px rgba(39, 174, 96, 0.12);
}

.theme-checkbox:checked + .theme-track .theme-knob {
  transform: translateX(34px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  color: #ffffff;
}

.theme-knob .icon {
  font-size: 14px;
  line-height: 1;
}

.theme-toggle-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-light);
  white-space: nowrap;
  min-width: 40px;
  text-align: left;
}

body.dark-theme .theme-toggle-label {
  color: var(--text-dark);
}

.theme-checkbox:focus + .theme-track {
  outline: 3px solid rgba(46, 204, 113, 0.16);
  outline-offset: 4px;
}

body[dir="rtl"] .theme-toggle {
  flex-direction: row-reverse;
}

body[dir="rtl"] .theme-toggle-label {
  text-align: right;
}

@media (max-width: 480px) {
  .theme-track {
    width: 56px;
    height: 30px;
  }
  
  .theme-checkbox:checked + .theme-track .theme-knob {
    transform: translateX(26px);
  }
  
  .theme-knob {
    width: 24px;
    height: 24px;
    top: 3px;
    left: 3px;
  }
  
  .theme-toggle-label {
    font-size: 0.9rem;
    min-width: 50px;
  }
  
}

.btn-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary-color);
  color: #fff;
  cursor: pointer;
  transition: transform 120ms ease, background 200ms ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.btn-theme img#theme-icon {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

body.dark-theme .btn-theme {
  background: #2b2b3a;
}

.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

.btn-bmi,
.btn-submit {
  font-family: "Vazir", "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  cursor: pointer;
  display: inline-block;
  text-align: center;
  padding: 12px 20px;
  border-radius: var(--radius);
  transition: transform 0.3s ease, box-shadow 0.2s ease, background 0.2s ease;
}

body.lang-fa input[type="text"],
body.lang-fa input[type="number"],
body.lang-fa textarea,
body.lang-fa select {
  font-family: "Vazir", "Tahoma", "Segoe UI", "Inter", sans-serif;
  font-size: 18px;
  line-height: 1.4;
  direction: rtl;
}

body.lang-fa input::placeholder,
body.lang-fa textarea::placeholder {
  font-family: "Vazir", "Inter", sans-serif;
  font-size: 0.95rem;
}
