/* 
   קובץ תיקונים לתצוגה מימין לשמאל (RTL)
   מתמקד בתיקון בעיות רווח ומיקום של תוויות בשדות טקסט
*/

/* יישור כללי לתוויות שדות בעברית */
.MuiFormLabel-root,
.MuiInputLabel-root {
  right: 0 !important;
  left: auto !important;
  transform-origin: right !important;
  margin-right: 14px !important;
}

/* תיקון למרווח בתוויות כאשר הן במצב ממוקד */
.MuiInputLabel-shrink {
  transform-origin: right top !important;
  margin-right: 0 !important;
}

/* תיקון ליישור טקסט בתוך תוויות */
.MuiFormLabel-root {
  text-align: right !important;
}

/* מיקום אייקונים בשדות טקסט */
.MuiInputAdornment-root {
  margin-left: 0 !important;
  margin-right: 8px !important;
}

/* תיקון למיקום ה-placeholder בשדות טקסט */
.MuiInputBase-input::placeholder {
  text-align: right !important;
}

/* תיקון לכיוון טקסט בשדות קלט */
.MuiInputBase-input {
  text-align: right !important;
  direction: rtl !important;
}

/* תיקון למרווח בקצה השמאלי של שדות הקלט */
.MuiOutlinedInput-root {
  padding-right: 14px !important;
}

/* תיקון ספציפי לתווית "שם עיר (עברית)" ודומים */
.MuiFormLabel-root[data-shrink=false] {
  transform: translate(0, 20px) !important;
  right: 14px !important;
}

/* תיקון למצב מוקטן של התווית */
.MuiFormLabel-root[data-shrink=true] {
  transform: translate(0, -6px) scale(0.75) !important;
  right: 14px !important;
}

/* תיקון ליישור טקסט ב-notchedOutline (מסגרת השדה) */
.muirtl-1puv6kp-MuiOutlinedInput-notchedOutline {
  text-align: right !important;
}

/* תיקון כללי יותר לכל ה-notchedOutline variants */
.MuiOutlinedInput-notchedOutline {
  text-align: right !important;
}

/* תיקונים ספציפיים לרכיבי Select */
.MuiSelect-select {
  padding-right: 14px !important;
  padding-left: 32px !important;
  text-align: right !important;
  direction: rtl !important;
}

/* תיקון לאייקון הירידה של Select */
.MuiSelect-icon {
  right: auto !important;
  left: 7px !important;
}

/* תיקון למיקום הטקסט ב-Select כדי שלא ידחף למטה */
.MuiSelect-select.MuiSelect-outlined {
  display: flex !important;
  align-items: center !important;
  min-height: auto !important;
  padding-top: 8.5px !important;
  padding-bottom: 8.5px !important;
}

/* תיקון נוסף למניעת דחיפת טקסט למטה */
.MuiInputBase-root.MuiOutlinedInput-root .MuiSelect-select {
  line-height: 1.4375em !important;
}

/* תיקון לגובה השדה */
.MuiFormControl-root .MuiInputBase-root {
  min-height: 40px !important;
}

/* מניעת overflow והבטחת מרכוז אנכי */
.MuiSelect-select:focus {
  background-color: transparent !important;
}

/* תיקון לאלמנטים נסתרים שעלולים לדחוף טקסט */
.MuiSelect-select::before,
.MuiSelect-select::after {
  display: none !important;
}

/* תיקון לעמדת ה-placeholder או טקסט ריק */
.MuiSelect-select[aria-expanded="false"] {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
}

/* תיקון לגבולות וpadding נוספים שעלולים להפריע */
.MuiInputBase-root .MuiSelect-select {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* תיקון ל-FormControl כדי להבטיח יישור נכון */
.MuiFormControl-root {
  direction: rtl !important;
}

/* תיקון למצבי hover ו-focus */
.MuiSelect-select:hover {
  background-color: transparent !important;
}

/* תיקון נוסף לאנכיות הטקסט */
.MuiSelect-root .MuiSelect-select {
  vertical-align: middle !important;
}

/* תיקון חזק לבעיית דחיפת טקסט למטה על ידי אלמנטים נסתרים */
.MuiSelect-select,
.MuiSelect-select * {
  position: static !important;
}

/* מניעת pseudo-elements שעלולים לדחוף את הטקסט */
.MuiSelect-select::before,
.MuiSelect-select::after,
.MuiInputBase-root::before,
.MuiInputBase-root::after,
.MuiOutlinedInput-root::before,
.MuiOutlinedInput-root::after {
  content: none !important;
  display: none !important;
}

/* הבטחת מיקום נכון של הטקסט */
.MuiSelect-select {
  position: relative !important;
  top: 0 !important;
  bottom: 0 !important;
  margin: 0 !important;
}

/* תיקון לגובה הקו (line-height) שעלול לגרום לבעיות */
.MuiSelect-select,
.MuiSelect-select * {
  line-height: 1.4375em !important;
  vertical-align: baseline !important;
}

/* מניעת אלמנטים עם position absolute שעלולים להפריע */
.MuiFormControl-root *[style*="position: absolute"],
.MuiInputBase-root *[style*="position: absolute"] {
  position: static !important;
}

/* אילוץ מרכוז אנכי */
.MuiSelect-select {
  display: flex !important;
  align-items: center !important;
  box-sizing: border-box !important;
}

/* תיקונים חזקים יותר למניעת דחיפת טקסט למטה */
.MuiInputBase-root .MuiSelect-select.MuiSelect-outlined {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  height: auto !important;
  min-height: 1.4375em !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
}

/* תיקון ספציפי לפתרון בעיית המרכוז */
.MuiFormControl-root .MuiInputBase-root.MuiOutlinedInput-root {
  align-items: center !important;
}

/* מניעת margin או padding נוספים שעלולים לדחוף */
.MuiSelect-select * {
  margin: 0 !important;
  padding: 0 !important;
}

/* תיקון לגובה המדויק של השדה */
.MuiFormControl-root.MuiFormControl-marginNormal .MuiInputBase-root {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* הבטחת יישור טקסט נכון */
.MuiSelect-select {
  text-align: right !important;
  direction: rtl !important;
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
}

/* תיקון לבעיות overflow שעלולות לגרום לדחיפה */
.MuiInputBase-root,
.MuiOutlinedInput-root {
  overflow: visible !important;
}

/* תיקון ישיר לבעיית הdropdown - ריספונסיבי */
.MuiInputLabel-root {
  transform: translate(1rem, calc(50% - 0.2em)) scale(1) !important;
  right: 0 !important;
  left: auto !important;
  transform-origin: right center !important;
}

.MuiInputLabel-shrink {
  transform: translate(1rem, -0.6rem) scale(0.75) !important;
  transform-origin: right top !important;
}

.MuiSelect-select.MuiSelect-outlined {
  padding: 0.75rem 2rem 0.75rem 1rem !important;
  text-align: right !important;
  direction: rtl !important;
  min-height: 1.4375em !important;
}

/* מניעת כל transform שדוחף למטה - ריספונסיבי */
.MuiFormControl-root .MuiInputLabel-root {
  transform: translate(1rem, calc(50% - 0.2em)) scale(1) !important;
}

.MuiFormControl-root .MuiInputLabel-shrink {
  transform: translate(1rem, -0.6rem) scale(0.75) !important;
}

/* התאמה למסכים קטנים */
@media (max-width: 768px) {
  .MuiInputLabel-root {
    transform: translate(0.8rem, calc(50% - 0.2em)) scale(1) !important;
  }
  
  .MuiInputLabel-shrink {
    transform: translate(0.8rem, -0.5rem) scale(0.75) !important;
  }
  
  .MuiSelect-select.MuiSelect-outlined {
    padding: 0.6rem 1.5rem 0.6rem 0.8rem !important;
  }
}

/* תיקונים לresponsive layout */
@media (max-width: 600px) {
  /* הבטחת שהcontainer יתפוס את כל הרוחב */
  .MuiContainer-root {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  
  /* תיקון לטבלאות במסכים קטנים */
  .MuiTableContainer-root {
    width: 100% !important;
    overflow-x: auto !important;
  }
  
  /* הקטנת padding במסכים קטנים */
  .MuiBox-root[data-testid="main-content"] {
    padding: 8px !important;
  }
  
  /* תיקון לheader */
  .MuiAppBar-root {
    width: 100% !important;
    left: 0 !important;
    margin-left: 0 !important;
  }
  
  /* הבטחת שהcontainer הראשי יתפוס את כל המסך */
  body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }
  
  /* תיקון למסכי mobile */
  #root, #acb-app-root {
    width: 100% !important;
    min-width: 100% !important;
  }
  
  /* תיקון לכותרות במסכים קטנים */
  .MuiTypography-h4 {
    font-size: 1.5rem !important;
  }
  
  /* תיקון לכפתורים במסכים קטנים */
  .MuiButton-root {
    font-size: 0.8rem !important;
    padding: 8px 16px !important;
    min-width: auto !important;
    white-space: nowrap !important;
  }
  
  /* תיקון לכפתורים קטנים */
  .MuiButton-sizeSmall {
    font-size: 0.75rem !important;
    padding: 6px 12px !important;
  }
  
  /* תיקון לאייקונים בכפתורים */
  .MuiButton-startIcon {
    margin-left: 4px !important;
    margin-right: 0 !important;
  }
  
  /* תיקון ל-Box עם כפתורים */
  .MuiBox-root .MuiButton-root {
    margin: 2px !important;
  }
  
  /* תיקון ל-Paper components */
  .MuiPaper-root {
    margin: 0 !important;
  }
}

/* הסרת ה-nativeInput */
.MuiSelect-nativeInput {
  display: none !important;
}

/* אילוץ גובה קבוע לכל FormControl */
.MuiFormControl-root .MuiInputBase-root {
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
}

/* חריגה לטופס תגובות - נותנים לו לגדול באופן טבעי */
.MuiFormControl-root .MuiInputBase-root.MuiInputBase-multiline {
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
}

/* מניעת כל אלמנט שעלול לדחוף את הטקסט */
.MuiSelect-select *,
.MuiInputBase-input * {
  display: inline !important;
  vertical-align: baseline !important;
  margin: 0 !important;
  padding: 0 !important;
  position: static !important;
}

/* תיקון לכל pseudo-elements אפשריים */
.MuiSelect-select::before,
.MuiSelect-select::after,
.MuiInputBase-input::before,
.MuiInputBase-input::after,
.MuiFormControl-root::before,
.MuiFormControl-root::after,
.MuiFormControl-root *::before,
.MuiFormControl-root *::after {
  display: none !important;
  content: none !important;
}

/* תיקון לכל אלמנט עם position absolute בתוך הForm */
.MuiFormControl-root [style*="position: absolute"],
.MuiFormControl-root [style*="position: fixed"],
.MuiInputBase-root [style*="position: absolute"],
.MuiInputBase-root [style*="position: fixed"] {
  position: static !important;
  top: auto !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
}
