/* ==========================================================================
   1. الهيكل العام والحاوية الرئيسية (Main App Container)
   ========================================================================== */
.bulk-app {
  max-width: 720px;
  margin: 35px auto;
  font-family: inherit;
}

.bulk-card {
  position: relative;
  background: var(--color-bg);
  border: 1px solid #eee;
  border-radius: var(--border-radius);
  padding: 26px;
  box-shadow: 0 5px 10px var(--box-shadow-strong);
}

/* ==========================================================================
   2. الجزء العلوي والأيقونات (Header & Icons)
   ========================================================================== */
.bulk-top {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
  padding-inline-start: 50px;
}

.bulk-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--navbar-color);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.bulk-icon svg {
  width: 30px;
  height: 30px;
  fill: #fff;
}

.bulk-top h2 {
  margin: 0;
  font-size: 24px;
}

.bulk-top p {
  margin: 6px 0 0;
  color: #666;
  font-size: 14px;
  line-height: 1.7;
}

/* زر الإغلاق العلوي للمودال */
.bulk-close-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(0,0,0,.25);
}

/* ==========================================================================
   3. نظام الخلفية الثابتة والمودال (Modal & Overlay)
   ========================================================================== */
.cut-app-shadow {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  z-index: 99998;
}

.cut-app-shadow.is-hidden {
  display: none;
}

.bulk-app.bulk-fixed {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 99999;
  width: min(95vw, 720px);
  max-height: 90vh;
  overflow-y: auto;
  transform: translate(-50%, -50%);
  margin: 0;
}

body.bulk-modal-open {
  overflow: hidden;
}

/* ==========================================================================
   4. أشرطة التقدم والخطوات المتعددة (Progress Bar & Steps)
   ========================================================================== */
.bulk-progress {
  height: 8px;
  background: var(--color-bg-light);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 28px;
}

/* توحيد أشرطة التقدم لكافة التطبيقات بما فيها حاسبة الدهون الجديدة */
.bulk-progress span,
#cutProgressBar,
#carbProgressBar,
#proteinProgressBar,
#fatProgressBar {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  border-radius: 99px;
  transition: .3s;
}

.bulk-step {
  display: none;
  animation: bulkFade .3s ease;
}

.bulk-step.active {
  display: block;
}

@keyframes bulkFade {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bulk-step h3 {
  margin: 0 0 18px;
  font-size: 23px;
}

/* ==========================================================================
   5. حقول الإدخال والخيارات الذكية (Inputs & Option Buttons)
   ========================================================================== */
.bulk-step input,
.bulk-step select {
  width: 100%;
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 16px;
  font-size: 16px;
  box-sizing: border-box;
  outline: none;
  background: #fff;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 145px;
  gap: 10px;
}

.option-grid,
.option-list {
  display: grid;
  gap: 12px;
}

.option-grid {
  grid-template-columns: repeat(2, 1fr);
}

.option-btn {
  border: 1px solid var(--navbar-color);
  background: #fff;
  color: var(--navbar-color);
  border-radius: 16px;
  padding: 15px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 900;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: .25s;
}

.option-btn small {
  display: block;
  margin-top: 6px;
  font-weight: 400;
  line-height: 1.6;
  color: inherit;
  opacity: 0.85;
}

.option-btn:hover,
.option-btn.active,
.option-btn.selected {
  border-color: var(--navbar-color);
  background: var(--navbar-color);
  color: #fff;
}

/* ==========================================================================
   6. أزرار التحكم السفلي (Action Buttons)
   ========================================================================== */
.bulk-actions {
  display: flex;
  gap: 12px;
  margin-top: 26px;
}

.bulk-actions button {
  flex: 1;
  padding: 15px;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  transition: opacity 0.2s;
}

.bulk-actions button:hover {
  opacity: 0.9;
}

/* توحيد ألوان الأزرار لجميع حواسب الموقع (التنشيف، الكربوهيدرات، البروتين، والدهون) */
#cutNextBtn, #cutPrevBtn,
#carbNextBtn, #carbPrevBtn,
#proteinNextBtn, #proteinPrevBtn,
#fatNextBtn, #fatPrevBtn {
  background: var(--navbar-color);
  color: #fff;
}

/* ==========================================================================
   7. صناديق عرض النتائج النهائية (Results Cards)
   ========================================================================== */
#cutResult,
#carbResult,
#proteinResult,
#fatResult {
  display: grid;
  gap: 14px;
}

.cut-result-main {
  text-align: center;
  margin-bottom: 10px;
  padding: 22px;
  background: #f5f5f5;
  border-radius: 22px;
}

.cut-result-main small {
  display: block;
  color: #666;
  margin-bottom: 6px;
}

.cut-result-main span {
  display: block;
  font-size: 44px;
  font-weight: 900;
  color: var(--navbar-color);
}

.cut-result-card {
  background: #f5f5f5;
  border-radius: 18px;
  padding: 18px;
  line-height: 1.9;
}

.cut-result-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--navbar-color);
}

.cut-result-card b {
  color: var(--navbar-color);
}

.cut-alert {
  background: #fff7e6;
  border: 1px solid #f0d9a8;
  color: #6b4b00;
  padding: 12px 14px;
  border-radius: 14px;
  line-height: 1.8;
}

/* ==========================================================================
   8. التوافق مع شاشات الهواتف (Responsive Media Query)
   ========================================================================== */
@media(max-width: 560px) {
  .bulk-app {
    max-width: none;
    margin: 15px;
  }

  .bulk-app.bulk-fixed {
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: calc(100vh - 20px);
    transform: none;
  }

  .bulk-card {
    padding: 20px;
  }

  .bulk-top {
    align-items: flex-start;
    padding-inline-start: 45px;
  }

  .bulk-top h2 {
    font-size: 20px;
  }

  .option-grid,
  .input-row {
    grid-template-columns: 1fr;
  }

  .cut-result-main span {
    font-size: 36px;
  }
}