/* --------- Modal Container & Layout --------- */

#ie-form-modal,
#submissionModal {
  display: none;
}

.IEFormContainer {
  width: 100%;
  max-width: 1200px;
  margin: auto;
  background: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* height: 100vh; */
  max-height: 780px;
}

.modal-footer {
  display: flex;
  align-items: center;
  z-index: 10;
  gap: 10px;
  height: 72px;
}
.IEFormHeader {
  display: flex;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px !important;
  height: 72px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px !important;
  height: 40px;
}

.IEFormBody {
  display: flex;
  flex-grow: 1;
  overflow: hidden;
  min-height: 0;
  padding: 0;
}

.IEFormLayout {
  display: flex;
  width: 100%;
  height: 636px;
  /* gap: 32px; */
  padding: 0 24px 20px 16px;
}

/* --------- Sidebar --------- */

.sidebar {
  overflow-y: auto;
  background: #fff;
  scrollbar-width: thin;
  scrollbar-color: #130101 transparent;
  width: 23%;
}

.sidebar ul {
  list-style: none;
  padding: 0;
}

.sidebar-link {
  display: block;
  margin-bottom: 18px;
  color: #757575;
  font-weight: 500;
  font-size: 13px;
  font-family: "Roboto", sans-serif;
  line-height: 22px;
  letter-spacing: 0.46px;
  text-decoration: none;
}

.sidebar-link.active {
  color: #3276cf;
}
.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 23.5%;
  width: 1px;
  height: 4%;
  background-color: #1976d2; /* same blue as text */
  border-radius: 2px;
}

/* --------- Form Content --------- */

.form-content {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  overflow-x: auto;
  background: #fefefe;
  padding-left: 24px;
  border-left: 1px solid #e0e0e0;
  max-height: calc(100vh - 144px);
}

/* .form-content::-webkit-scrollbar {
  display: none;
} */
.form-content::-webkit-scrollbar {
  display: initial;
  height: 6px;
}

/* --------- Grid Table Layout --------- */

.grid-table {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  overflow: hidden;
  background: #fff;
  gap: 0;
}

.grid-4-col {
  grid-template-columns: 2.5fr 2.5fr 2.5fr 1fr;
  /* grid-template-columns: 2.5fr 2.5fr 2.5fr minmax(90px, 1fr); */
  /* grid-template-columns: repeat(4, minmax(80px, 1fr)); */
}

.grid-5-col {
  /* grid-template-columns: repeat(5, 1fr); or your fixed widths */
  grid-template-columns: 2.2fr 2.2fr 2.2fr 2.2fr 1.15fr;
}

.grid-header {
  font-weight: 500;
  letter-spacing: 0.17px;
  padding: 6px 16px;
  border-bottom: 1px solid #e0e0e0;
  font-family: "Roboto", sans-serif;
  font-size: 14px;
  height: 36px;
}

.grid-cell {
  padding: 6px 16px;
  height: 64px;
  border: none;
  display: flex;
  align-items: center;
  font-family: "Roboto", sans-serif;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
}
.frequency-cell {
  display: flex;
  flex-direction: column;
  justify-content: center; /* Align dropdown vertically in cell */
  position: relative;
}

.grid-footer {
  padding: 0.75rem; /* Reduce vertical padding */
  background-color: #fafafa;
  font-weight: bold;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  border-top: 1px solid #e0e0e0; /* optional */
  align-self: center;
}

/* Align the total label under column 1 and span 3 columns */
.grid-footer.text-start {
  grid-column: 1 / span 3;
  text-align: left;
}

/* Align the actual total value under column 4 */
.grid-footer:last-child {
  grid-column: 4 / 5;
}
.grid-footer.combined-footer {
  display: grid;
  /* justify-content: space-between; */
  grid-template-columns: 2.5fr 2.5fr 2.5fr 1fr;
  align-items: center;
  grid-column: 1 / -1;
  padding: 1rem 0 1rem 1rem;
  background-color: #fafafa;
  border-top: 1px solid #e0e0e0;
  font-weight: 600;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  border-radius: 0 0 8px 8px; /* Match container */
  line-height: 1.5;
  box-sizing: border-box;
}

.grid-footer.combined-footer .footer-label {
  grid-column: 1 / span 3;
  text-align: left;
}
.grid-footer.combined-footer .footer-amount {
  grid-column: 4 / 5;
  text-align: start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grid-footer .footer-label {
  color: #212121;
}

.grid-footer .footer-amount {
  color: #252627;
  font-weight: 700;
  font-family: Roboto;
  font-size: 14px;
  line-height: 143%;
  letter-spacing: 0.17px;
}

.footer-amount {
  grid-column: 4;
}
.grid-footer.combined-footer .last-col {
  padding-left: 13px;
}
.grid-cell input,
.grid-cell select {
  /* width: 100%; */
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  font-size: 14px;
  outline: none;
}
.grid-cell .currency-input {
  flex: 1;
  box-sizing: border-box;
}

/* --------- Currency Input --------- */

.currency-input {
  display: flex;
  align-items: center;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  width: 100%;
  height: 39px;
  position: relative;
}

.currency-input::before {
  content: "\00A3";
  margin-right: 4px;
  color: #555;
  position: absolute;
  font-weight: 500;
  left: 8px;
}

.currency-input input {
  border: none;
  outline: none;
  padding: 6px 13px;
  background: transparent;
  width: 100%;
  padding-left: 1.5rem;
  /* padding-left: 40px !important; */
}

/* --------- Note Input (for state/extra details) --------- */

.note-input {
  height: 38px !important;
  border: 1px solid #e0e0e0 !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  font-family: "Roboto", sans-serif;
  line-height: 24px !important;
  letter-spacing: 0.15px !important;
  font-weight: 400 !important;
  width: 100% !important;
}
.note-input-withfifty {
  height: 38px !important;
  border: 1px solid #e0e0e0 !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  font-family: "Roboto", sans-serif;
  line-height: 24px !important;
  letter-spacing: 0.15px !important;
  font-weight: 400 !important;
}

.note-input::placeholder {
  color: #bdbdbd;
}
/* Chrome, Safari, Edge, Opera */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type="number"] {
  -moz-appearance: textfield;
}

/* --------- Frequency Dropdown --------- */

select.form-select,
select.frequency-select {
  appearance: none;
  -webkit-appearance: none; /* Safari/Chrome */
  -moz-appearance: none; /* Firefox */
  padding: 8px 12px;
  border: 1px solid #e0e0e0 !important;
  border-radius: 8px;
  font-size: 16px;
  width: 100%;
  background-image: url("/assets/img/dropdown_icon_Vulnerability_Self_Referral_Form.svg");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 5px;
  background-color: white;
  line-height: 24px;
  letter-spacing: 0.15px;
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  color: #bdbdbd;
  height: 40px;
}
/* Style all options */
select.frequency-select option,
select.form-select option {
  color: #000; /* Black text for dropdown items */
  font-family: "Roboto", sans-serif !important;
  font-size: 16px;
}

/* Style the placeholder option */
select.frequency-select option[disabled],
select.form-select option[disabled] {
  color: #bdbdbd; /* Grey for the placeholder */
}

.select.frequency-select option {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.frequency-error {
  color: #dc3545;
  position: absolute;
  top: 72%;
  left: 8%;
  font-size: 0.7rem;
}
.amount-error {
  color: #dc3545;
  position: absolute;
  top: 89%;
  left: 1%;
  font-size: 0.7rem;
}
.vrm-error {
  color: #dc3545;
  position: absolute;
  top: 10%;
  left: 1%;
  font-size: 0.7rem;
}
.name-error {
  position: absolute;
  bottom: -18px;
  left: 1px;
  color: #dc3545;
  font-size: 0.7rem;
}
.creditor-input-wrapper {
  position: relative;
  width: 100%;
}

.is-invalid {
  border: 1px solid !important;
  border-color: #dc3545 !important;
  /* box-shadow: 0 0 0 0.2rem rgba(255, 0, 25, 0.25); */
}

/* --------- Titles --------- */

.IEFormTitle {
  font-family: "Roboto", sans-serif;
  font-weight: 500;
  font-size: 20px;
  color: #212121;
  line-height: 160%;
  letter-spacing: 0.15px;
}

.sectiontitle {
  font-family: "Roboto", sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: #212121;
  line-height: 150%;
  letter-spacing: 0.15px;
  margin-bottom: 24px;
}

/* --------- Totals --------- */

.total-display,
.grand-total-Item,
span[id^="total-"],
span[id^="grand-total-"] {
  font-weight: 700;
  font-size: 14px;
  color: #000;
  font-family: "Roboto", sans-serif;
  color: #252627;
  line-height: 143%;
  letter-spacing: 0.17px;
  margin-left: 8%;
}

.grid-cell[data-label="Total"],
.footer-amount,
span[id^="total-"],
span[id^="grand-total-"] {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%; /* important for grid column size */
}
.grid-cell[data-label="Total"] span,
.footer-amount span {
  max-width: 100%;
  white-space: nowrap;
  overflow: clip;
  text-overflow: ellipsis;
}

/* --------- vehicle and other section --------- */
#vehicle-section-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.vehicle-block {
  position: relative;
  border-radius: 10px;
  background-color: #fff;
}

.vrm-input {
  width: 49%;
  height: 40px;
  padding: 6px 10px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-family: "Roboto", sans-serif;
}
/* .vrm-input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
} */

.vehicle-block .form-label {
  display: none;
}

#add-vehicle-btn,
.add-other-expense-btn {
  font-size: 14px;
  font-weight: 500;
  color: #3276cf;
  background: transparent;
  border: none;
  font-family: "Roboto", sans-serif;
  line-height: 24px;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  cursor: pointer;
  text-transform: uppercase;
}

#add-vehicle-btn:hover,
.add-other-expense-btn:hover {
  color: #1a4fa0;
}

.add-other-expense-btn img,
.add-vehicle-button .icon-left {
  height: 20px;
}

/* Remove button inside vehicle block */
.remove-vehicle-btn {
  position: absolute;
  top: 7px;
  right: 10px;
  color: #757575;
  width: 24px;
  border: none;
  height: 24px;
  cursor: pointer;
}
.vrm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* --------- Add Button --------- */

.add-btn,
.add-other-expense-btn,
.add-vehicle-button {
  color: #3276cf;
  padding: 0 0.4rem 0.75rem;
  font-size: 14px;
  font-weight: 500;
  font-family: "Roboto", sans-serif;
  line-height: 24px;
  letter-spacing: 0.4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.creditor-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.responsive-income {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.income-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0.5rem;
  align-items: center;
  border-bottom: 1px solid #e0e0e0;
  padding: 0.5rem 0;
}
.header-row {
  font-weight: bold;
  border-bottom: 2px solid #e0e0e0;
}
.footer-row {
  font-weight: bold;
  border-top: 2px solid #e0e0e0;
  margin-top: 0.5rem;
}
.sub-header {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  display: none;
  font-family: "Roboto";
  line-height: 24px;
  letter-spacing: 0.17px;
}

.btn-cancel-IEForm {
  font-family: "Roboto";
  font-weight: 500;
  font-size: 14px !important;
  line-height: 24px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #3276cf;
  border: 1px solid #a2c1ea !important;
  gap: 8px;
  opacity: 1;
  padding-top: 8px !important;
  padding-right: 16px !important;
  padding-bottom: 8px !important;
  padding-left: 16px !important;
  border-radius: 8px !important;
  /* width: 100px !important; */
}
.btn-submit-IEForm {
  font-family: "Roboto", sans-serif;
  font-weight: 500 !important;
  font-size: 14px !important;
  line-height: 24px !important;
  letter-spacing: 0.4px !important;
  text-transform: uppercase;
  color: #ffffff;
  border: 1px solid #3276cf !important;
  background-color: #3276cf !important;
  gap: 8px;
  opacity: 1 !important;
  padding-top: 8px !important;
  padding-right: 16px !important;
  padding-bottom: 8px !important;
  padding-left: 16px !important;
  border-radius: 8px !important;
  width: 100px !important;
  margin-right: 22px;
}

.btn-submit-IEForm:hover {
  background-color: #22497d !important;
  color: #ffffff !important;
}

.btn-cancel-IEForm:hover {
  color: #22497d !important;
  border-color: #b7d1f5 !important;
}

.close-btn {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #757575;
  transition: color 0.2s, background-color 0.2s;
  padding: 9px 0px;
  border-radius: 999px;
}

.close-btn:hover {
  color: #162b488f;
  background-color: rgba(192, 194, 196, 0.1);
}

/* --------- Responsive Design --------- */

@media (max-width: 768px) {
  .IEFormContainer {
    max-width: 100%;
    height: 100vh;
    border-radius: 0;
  }

  .IEFormLayout {
    flex-direction: column;
    width: 100%;
    padding: 0 12px;
  }

  .sidebar {
    display: none;
  }

  .form-content {
    width: 100%;
    padding: 0 12px;
    height: auto;
    border: none;
  }

  .custom-table {
    grid-template-columns: 1fr;
  }

  .table-header .cell,
  .table-footer .cell,
  .grid-header {
    display: none;
  }

  .table-row .cell,
  .grid-cell.label {
    display: block;
    font-weight: 500;
    font-size: 14px;
    padding: 1rem;
    font-family: "Roboto", sans-serif;
    text-align: left;
    width: 100%;
    height: auto;
    border-top: 1px solid #e0e0e0;
  }

  .grid-table {
    display: flex;
    flex-direction: column;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
  }

  .grid-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    position: relative;
    width: 100%;
    height: auto;
  }
  .frequency-cell {
    flex-direction: row;
  }
  .frequency-error {
    top: 81%;
    left: 50%;
    font-size: 0.75rem;
  }

  .name-error {
    bottom: -20px;
    left: 1px;
    font-size: 0.7rem;
  }
  .vrm-error {
    top: 4%;
    left: 1%;
    font-size: 0.7rem;
  }

  .grid-cell::before {
    content: attr(data-label);
    font-family: "Roboto", sans-serif;
    font-weight: 500;
    color: #555;
    flex: 1;
    text-align: left;
    margin-bottom: 4px;
  }
  .grid-cell[data-label="Total"] {
    justify-content: center !important;
    font-weight: 600;
    font-size: 15px;
  }

  .grid-cell input,
  .grid-cell select {
    width: 50%;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
  }

  .currency-input {
    width: 100%;
    display: flex;
    position: relative;
    box-sizing: border-box;
  }

  .currency-input::before {
    content: "\00A3";
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #555;
    font-weight: 500;
  }

  .currency-input input {
    padding-left: 20px;
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
  }

  .grid-footer {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: #fafafa;
    border-top: 1px solid #e0e0e0;
    font-weight: bold;
    font-size: 15px;
  }

  .grid-footer.combined-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    font-size: 14px;
    font-weight: 700;
    color: #252627;
    width: 100%;
    box-sizing: border-box;
    background: #fafafa;
    border-top: 1px solid #e0e0e0;
  }
  .grid-footer.combined-footer .footer-label,
  .grid-footer.combined-footer .footer-amount {
    flex: 1;
    text-align: left;
  }

  .grid-footer.combined-footer .footer-amount {
    text-align: left;
  }
  .grid-footer.combined-footer .last-col {
    padding-left: 0;
  }

  .grid-footer.text-start {
    text-align: left;
  }

  .grid-footer.footer-amount {
    text-align: right;
  }

  .total-display,
  .grand-total-Item,
  span[id^="total-"],
  span[id^="grand-total-"] {
    text-align: left;
    font-family: "Roboto", sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 143%;
    letter-spacing: 0.17px;
    margin-left: 5px;
    min-width: 45%;
  }

  .sub-header.mobile-only {
    display: block;
    height: 36px;
    padding: 0.375rem 1rem;
  }
  .vrm-row {
    flex-direction: row;
  }

  .remove-vehicle-btn {
    flex-shrink: 0;
  }
  .creditor-row {
    flex-direction: row-reverse;
    justify-content: space-between;
    width: -webkit-fill-available;
  }
  .vrm-input {
    width: 80%;
  }
  /* .select2-container--default .select2-selection--single {
    height: 40px;
    font-size: 14px;
    padding-left: 1.5rem;
  } */

  .grid-cell .select2-container {
    width: 50% !important; /* Match your input size */
  }

  .select2-container--default .select2-selection--single {
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
  }

  .select2-container--default
    .select2-selection--single
    .select2-selection__arrow {
    height: 26px;
    top: 50% !important;
    transform: translateY(-50%);
    right: 8px;
    width: 20px;
  }

  .frequency-cell {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
  }

  /* .frequency-cell::before {
    content: "Frequency";
    flex: 1;
    font-weight: 500;
    color: #555;
    margin-right: 1rem;
    font-family: "Roboto", sans-serif;
  } */
}

@media (min-width: 769px) and (max-width: 1024px) {
  .IEFormLayout {
    flex-direction: row;
    padding: 0 16px;
  }

  .sidebar {
    width: 23%;
  }
  .sidebar-link.active::before {
    left: 23.9%;
  }

  .form-content {
    padding-left: 16px;
    overflow-x: auto;
  }

  .grid-table.grid-4-col {
    grid-template-columns: repeat(4, minmax(80px, 1fr));
  }
  .grid-footer.combined-footer {
    grid-template-columns: repeat(4, minmax(80px, 1fr));
  }

  .grid-cell input,
  .grid-cell select {
    font-size: 13px;
    padding: 6px 8px;
  }

  /* .currency-input {
    height: 36px;
  } */

  .currency-input input {
    padding-left: 20px;
  }
  .frequency-error {
    top: 74%;
    left: 13%;
    font-size: 0.65rem;
  }
  .name-error {
    bottom: -15px;
    left: 1px;
    font-size: 0.57rem;
  }
  .vrm-error {
    top: 10%;
    left: 1%;
    font-size: 0.7rem;
  }
  .grid-cell .select2-container {
    width: 100% !important; /* Match your input size */
  }

  .select2-container--default .select2-selection--single {
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
  }

  .select2-container--default
    .select2-selection--single
    .select2-selection__arrow {
    height: 26px;
    top: 50% !important;
    transform: translateY(-50%);
    right: 8px;
    width: 20px;
  }

  .frequency-cell {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
  }
}
