.Detailbtn {
    background-color: var(--action-primary-default);
    padding: 3px 4px 3px 22px;
    height: 30px;
    width: 100px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    display: inline-block;
    border-radius: 5px;
    margin-top: 20px;
    margin-left: 20px;
}

.BackButton {
    background-color: var(--action-primary-default);
    padding: 3px 4px 3px 22px;
    height: 30px;
    width: 100px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    display: inline-block;
    border-radius: 5px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 999;
    padding-top: 100px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    overflow-y: auto; /* ✅ Allow scrolling if content is too tall */
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    max-width: 90%; /* ✅ Changed from fixed 1000px to responsive */
    width: 1000px; /* ✅ Max width but will shrink on smaller screens */
    max-height: 80vh; /* ✅ Limit height to viewport */
    border-radius: 10px;
    overflow-y: auto; /* ✅ Add scrolling inside modal if needed */
    box-sizing: border-box; /* ✅ Include padding in width calculation */
}

.closeicon {
    width: 100%; /* ✅ Changed from fixed 935px */
    display: flex;
    justify-content: flex-end; /* ✅ Changed from 'right' to 'flex-end' */
    cursor: pointer;
    margin-bottom: 20px;
    margin-top: -10px; /* ✅ Adjusted from -35px */
}

.thirdcontainer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.fourthcontainer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px; /* ✅ Added gap for consistency */
}


@media (max-width: 768px) {

  .FormOverView {
    padding: 8px;
    overflow-x: hidden;
  }

  gb-newpicklist,
  gb-input,
  gb-combobox,
  gb-radiobutton,
  gb-date {
    display: block !important;
    width: 100% !important;
    margin-bottom: 8px;
    margin-left: 0 !important;
  }

  gb-newpicklist.adjacentField,
  gb-input.adjacentField {
    display: block !important;
    width: 100% !important;
    margin-bottom: 8px;
  }


  .mat-mdc-tab-body-content,
  .mat-tab-body-content,
  .mat-mdc-tab-body-active .mat-mdc-tab-body-content {

    div[style*="display: flex"],
    div[style*="display:flex"] {
      display: flex !important;
      flex-direction: column !important;
      flex-wrap: nowrap !important;
      width: 100% !important;
      gap: 0 !important;

      > div {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
        margin-top: 0 !important;
        flex: none !important;
        box-sizing: border-box;
      }
    }
  }

  .FormsTabGroup {

    .mat-mdc-tab-body,
    .mat-tab-body {
      .mat-mdc-tab-body-content,
      .mat-tab-body-content {

        div[style*="display: flex"],
        div[style*="display:flex"] {
          flex-direction: column !important;
          width: 100% !important;

          > div {
            width: 100% !important;
            margin-right: 0 !important;
            margin-left: 0 !important;
            margin-top: 0 !important;
            flex: none !important;
            min-width: 0 !important;
          }
        }
      }
    }

    gb-input,
    gb-combobox,
    gb-newpicklist,
    gb-date,
    gb-radiobutton {
      display: block !important;
      width: 100% !important;
      margin-bottom: 10px;
      box-sizing: border-box;
    }
  }

  .FormOverView {
    div[style*="display: flex"],
    div[style*="display:flex"] {
      flex-direction: column !important;

      > div {
        width: 100% !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
        margin-top: 0 !important;
      }
    }
  }

  .Detailbtn {
    display: inline-block;
    margin-left: 0;
    margin-top: 8px;
    width: auto;
    text-align: center;
    padding: 6px 16px;
  }

  .modal {
    padding-top: 0;
    display: flex;
    align-items: flex-start;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100dvh;
    border-radius: 0;
    margin: 0;
    padding: 12px;
    border-left: none;
    border-right: none;
    box-sizing: border-box;

    div[style*="display: flex"],
    div[style*="display:flex"] {
      flex-direction: column !important;

      gb-input {
        width: 100% !important;
        margin-left: 0 !important;
        margin-bottom: 8px;
        display: block;
      }
    }
  }

  gb-formgrid {
    display: block !important;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .thirdcontainer {
    flex-direction: column !important;
    align-items: flex-start;
    gap: 8px;

    gb-input {
      width: 100% !important;
    }
  }

  .fourthcontainer {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
  }

  .BackButton {
    width: auto;
    height: auto;
    padding: 6px 16px;
    border-radius: 5px;

    button {
      background: none;
      border: none;
      color: #fff;
      font-weight: 700;
      cursor: pointer;
      padding: 0;
      font-size: 14px;
    }
  }

  .closeicon {
    width: 100%;
    margin-bottom: 12px;
    margin-top: 0;
    display: flex;
    justify-content: flex-end;
  }

  .FormsTabGroup {
    margin-top: 8px;
  }
}


@media (max-width: 1024px) and (min-width: 769px) {

  .FormOverView {
    padding: 8px;
  }

  gb-newpicklist.adjacentField,
  gb-input.adjacentField {
    display: block;
    width: 100%;
    margin-bottom: 8px;
  }

  .FormsTabGroup {
    .mat-mdc-tab-body-content,
    .mat-tab-body-content {
      div[style*="display: flex"],
      div[style*="display:flex"] {
        flex-wrap: wrap !important;
        gap: 12px;

        > div {
          flex: 1 1 45% !important;
          margin-right: 0 !important;
          margin-top: 0 !important;
          margin-left: 0 !important;
          min-width: 0;
        }
      }
    }
  }

  .modal-content {
    width: 90%;
    max-width: 90%;
    padding: 16px;
  }

  .thirdcontainer {
    justify-content: flex-start;
  }

  .fourthcontainer {
    justify-content: flex-start;
  }

  .BackButton {
    width: auto;
    padding: 3px 12px;
  }
}