/* --- فونت‌ها --- */
@font-face {
  font-family: 'Baloo Bhaijaan 2';
  src: url('https://quamtex.ir/fonts/webfonts/baloo-bhaijaan-2-arabic-500-normal.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

/* --- متغیرهای رنگی و استایل مدرن --- */
:root {
  --primary: #112548;
  --primary-hover: #1e3a6e;
  --bg-input: #f8fafc;
  --border-light: #e2e8f0;
  --shadow-soft: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --accent: #bae6fd;
}

body {
    background-color: #dae0e2;
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    margin: 0;
    color: var(--primary);
    text-align: center;
}

.rtl { direction: rtl; }

/* --- کانتینر اصلی --- */
.main-container {
  display: flex;
  flex-direction: row;
}

.main-content {
  padding: clamp(1rem, 2vw, 2rem);
  margin: clamp(0.5rem, 1.5vw, 1.5rem);
  background-color: #ffffff;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: var(--primary);
  width: 100%;
  box-shadow: var(--shadow-soft);
  font-size: clamp(0.938rem, 0.842rem + 0.426vw, 1.188rem);
}

h1 {
  font-size: 24px;
  margin-bottom: 25px;
  text-align: center;
}

/* --- باکس اصلی میانگین‌گیر --- */
.bmi {
  display: flex;
  flex-direction: column;
  margin: 20px 0;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  background: #ffffff;
  border: 2px solid var(--border-light);
  border-radius: 24px;
  box-sizing: border-box;
  width: 100%;
}

/* گرید داینامیک برای اعداد */
.inputs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    width: 100%;
    margin: 20px 0;
}

.input-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* --- استایل فیلدها --- */
input, select {
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 16px;
  border: 2px solid var(--border-light);
  background-color: var(--bg-input);
  outline: none;
  height: 52px;
  border-radius: 16px;
  width: 100%;
  margin-top: 10px;
  text-align: center;
  color: var(--primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.02);
}

input:focus, select:focus {
  border-color: var(--primary);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(17, 37, 72, 0.1);
  transform: translateY(-2px);
}

h3 {
  font-size: 16px;
  margin: 0;
  color: #64748b;
  font-weight: normal;
}

/* --- دکمه‌ها --- */
.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.pop {
  width: 40%;
  min-width: 180px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary) 0%, #2c4a85 100%);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 1.1rem;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(17, 37, 72, 0.2);
  transition: all 0.3s;
}

.pop:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(17, 37, 72, 0.3);
  background: linear-gradient(135deg, #1e3a6e 0%, #3b5d9c 100%);
}

.reset-style {
    background: #f1f5f9 !important;
    color: #64748b !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: none !important;
}

/* --- بخش نتایج مدرن --- */
.results {
  background-color: #f0f9ff; /* آبی خیلی کمرنگ */
  border: 1px dashed #bae6fd; /* حاشیه خط‌چین مدرن */
  border-radius: 16px;
  font-size: clamp(1rem, 1.1vw, 1.3rem);
  font-weight: bold;
  text-align: center;
  box-shadow: none; /* حذف سایه اضافه */
  color: var(--primary);
  min-height: 50px;
  padding: 15px;
  grid-column: 1/3;
  margin-top: 40px;
  align-content: center;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

/* افکت هاور برای بخش نتیجه */
.results:hover {
    background-color: #e0f2fe;
    border-color: var(--primary);
    transform: scale(1.02);
}

.results:active {
    transform: scale(0.98);
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(186, 230, 253, 0.5);
}

.result-item:last-of-type { border-bottom: none; }

.result-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--primary);
}

.copy-btn {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  position: absolute;
  left: 15px;
  top: 15px;
  transition: 0.2s;
}

.copy-btn:hover { background: var(--bg-input); transform: scale(1.1); }

/* --- توضیحات و FAQ --- */
.description {
  background-color: #ffffff;
  padding: 30px;
  border-radius: 24px;
  margin-top: 25px;
  border: 2px solid var(--border-light);
  text-align: right;
  line-height: 1.8;
  font-size: clamp(0.875rem, 0.731rem + 0.638vw, 1.25rem);

}

.description-title {
  font-size: clamp(1rem, 0.809rem + 0.851vw, 1.5rem);
  color: var(--primary);
  margin-bottom: 10px;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 10px;
  display: inline-block;
}

.description h3 {
    color: #0056b3;
    margin-top: 20px;
    font-weight: bold;
}

/* --- نوتیفیکیشن --- */
.notification {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(-180%);
  background-color: #fffbeb;
  border: 1px solid #fcd34d;
  padding: 12px 25px;
  border-radius: 15px;
  box-shadow: var(--shadow-soft);
  z-index: 1000;
  color: #92400e;
  text-align: center;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.show6 { opacity: 1; transform: translateY(25px) translateX(-50%); }

/* --- ریسپانسیو --- */
@media (max-width: 675px) {
  .bmi { padding: 1.2rem; }
  .pop { width: 100%; }

}

@media (max-width: 400px) {
    .inputs-grid { grid-template-columns: 1fr; }
}







/* --- باکس اصلی میانگین‌گیر --- */
.bmi {
  display: grid;
  /* ایجاد ستون‌های منعطف: هر ستون حداقل 180 پیکسل */
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  margin: 20px 0;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  background: #ffffff;
  border: 2px solid var(--border-light);
  border-radius: 24px;
  box-sizing: border-box;
  text-align: center;
}

/* المان‌هایی که باید تمام‌عرض باشند (مثل عنوان و دکمه و نتیجه) */
.total, .pop, .results, h1 {
  grid-column: 1 / -1; 
}

/* استایل کادرهای ورودی برای نمایش مرتب */
.input-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  padding: 7px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
}

.input-row:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-soft);
  border-color: var(--accent);
}

/* تنظیم اندازه اینپوت‌ها برای جا شدن در باکس‌ها */
.input-row input {
  width: 100%;
  height: 45px;
  margin-top: 8px;
}

.input-row h3 {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 5px;
}

/* دکمه محاسبه */
.pop {
  width: 250px; /* اندازه ثابت برای دکمه در وسط */
  margin: 20px auto;
}

/* ریسپانسیو موبایل */
@media (max-width: 500px) {
  .bmi {
    /* در موبایل‌های خیلی کوچک، دو ستونه یا تک ستونه شود */
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    padding: 1rem;
  }
  
  .pop {
    width: 100%;
  }
}