/* כלל עזר טוב (מונע גלישה לא צפויה) */
* { box-sizing: border-box; }

/* גלובל — הוורפר שמרכז את התוכן */
.form-wrapper {
  width: 100%;
  max-width: 420px; /* מניעת גלישה במסכים קטנים */
  margin: 0 auto;   /* מרכז אופקי */
  display: flex;
  flex-direction: column;
  justify-content: center; 
  align-items: center;
  padding: 12px;
}

/* כרטיס אחד למחשבון */
.option-box {
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  width: 100%;
  max-width: 400px;
  max-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px; /* רווח בין כל חלק במחשבון */
}

/* Period Selection (חודשי / שנתי) */
.period-selection {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 10px;
}

.period-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.period-buttons button {
  padding: 10px 20px;
  border: 1px solid #3498db;
  border-radius: 8px;
  background-color: #fff;
  color: #3498db;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.period-buttons button.active {
  background-color: #3498db;
  color: #fff;
}

.period-buttons button:hover {
  background-color: #2980b9;
  color: #fff;
}

/* השורה עם בחירת שנה ומגדר */
.controls-row {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 400px;
  padding: 10px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* טקסט הסבר למשתמש */
.form-hint {
  display: block;
  width: 100%;
  text-align: center !important;
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
  margin: 0;
}

/* Year + gender internal layout */
.year-select, .gender-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.year-select label {
  font-weight: 600;
  margin-inline-start: 6px;
}

.year-select select {
  padding: 8px 10px;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  background: #f8fafc;
  min-width: 140px;
  max-width: 100%;
}

.gender-buttons button {
  padding: 10px 20px;
  border: 1px solid #3498db;
  border-radius: 8px;
  background-color: #fff;
  color: #3498db;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.gender-buttons button.active {
  background-color: #3498db;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.gender-buttons button:hover {
  background-color: #2980b9;
  color: #fff;
}

/* קרן השתלמות */
.hishtalmut-section {
  display: flex;
  flex-direction: row; /* עכשיו בשורה */
  align-items: center;
  gap: 10px;
  width: auto;
  padding: 5px 0;
}


.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #3498db;
}

input:checked + .slider:before {
  transform: translateX(24px);
}

.label-text {
  margin-top: 8px;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
}

#hishtalmutInputWrapper {
  display: none;
  margin-top: 10px;
}

#hishtalmutInputWrapper label {
  font-weight: 500;
}

#hishtalmutInputWrapper input {
  width: 60px;
  padding: 5px;
  text-align: center;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 1rem;
  font-weight: 500;
}

/* ילדים */
.children-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.children-picker .buttons-row {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.children-picker button {
  padding: 6px 12px;
  border: 1px solid #3498db;
  border-radius: 6px;
  background-color: #fff;
  color: #3498db;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.children-picker button:hover {
  background-color: #3498db;
  color: #fff;
}

.children-picker p {
  width: 100%;
  max-width: 400px;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
}

#childrenAgesContainer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.child-age {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100px;
  min-width: 80px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background-color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  gap: 8px;
  font-size: 14px;
}

.child-age input {
  width: 50px;
  text-align: center;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-weight: 600;
}

.child-age button {
  padding: 4px 8px;
  font-size: 14px;
  border: 1px solid #3498db;
  border-radius: 6px;
  background-color: #fff;
  color: #3498db;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.child-age button:hover {
  background-color: #3498db;
  color: #fff;
}

/* שכר ברוטו ונקודות זיכוי */
.inputs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  width: 100%;
}

.inputs label {
  font-size: 1.2rem;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  text-align: center;
}

.inputs input {
  font-size: 1.2rem;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  text-align: center;
  max-width: 100%;
}

.error-message {
  color: red;
  font-size: 14px;
  margin-top: 4px;
}

/* כפתורי חישוב וניקוי */
.buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 20px 0;
}

.buttons button {
  padding: 12px 25px;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

#calculate {
  background-color: #3498db;
  color: #fff;
}

#calculate:hover {
  background-color: #2980b9;
  box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}

#clear {
  background-color: #e74c3c;
  color: #fff;
}

#clear:hover {
  background-color: #c0392b;
  box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}

/* רספונסיבי */
@media (max-width: 600px) {
  .controls-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
  }

  .child-age {
    width: 80%;
  }

  .child-age input,
  .child-age button {
    width: auto;
  }

  .child-age .buttons-row {
    display: flex;
    justify-content: center;
    gap: 5px;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .hishtalmut-section, #hishtalmutInputWrapper {
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
  }
}
