// Variables
$border-radius: 8px;
$shadow: 0 0 10px rgba(0, 0, 0, 0.1);
$font-size: 14px;
$header-text-font-size: 16px;
$header-btn-font-size: 24px;
$spacing-md: 12px;
$button-padding: 6px 12px;

.cart-dropdown-container {
  position: relative;
  display: inline-block;

  &.push_right {
    margin-left: auto;
  }

  .trigger {
    // background: none;
    // border: none;
    // color: $primary-color;
    // cursor: pointer;
    // font-weight: 500;
    // padding: $spacing-sm;
    white-space: nowrap;
    color: var(
      --_ctm-mob-dn-pt-as-ss-cr,
      var(--_ctm-tab-dn-pt-as-ss-cr, var(--_ctm-dn-pt-as-ss-cr))
    );
    font-family: var(
      --_sf-hr-ff,
      var(
        --_ctm-mob-dn-pt-as-ss-ft-fy,
        var(--_ctm-tab-dn-pt-as-ss-ft-fy, var(--_ctm-dn-pt-as-ss-ft-fy))
      )
    );
    text-transform: var(
      --_sf-hr-tt-tm,
      var(
        --_ctm-mob-dn-pt-as-ss-tt-tm,
        var(--_ctm-tab-dn-pt-as-ss-tt-tm, var(--_ctm-dn-pt-as-ss-tt-tm))
      )
    );
    word-wrap: var(
      --_sf-hr-wd-wp,
      var(
        --_ctm-mob-dn-pt-as-ss-wd-wp,
        var(--_ctm-tab-dn-pt-as-ss-wd-wp, var(--_ctm-dn-pt-as-ss-wd-wp))
      )
    );
    word-break: var(
      --_sf-hr-wd-bk,
      var(
        --_ctm-mob-dn-pt-as-ss-wd-bk,
        var(--_ctm-tab-dn-pt-as-ss-wd-bk, var(--_ctm-dn-pt-as-ss-wd-bk))
      )
    );
    font-size: var(
      --_ctm-mob-dn-pt-as-ss-ft-se,
      var(--_ctm-tab-dn-pt-as-ss-ft-se, var(--_ctm-dn-pt-as-ss-ft-se))
    );
    font-weight: var(
      --_ctm-mob-dn-pt-as-ss-ft-wt,
      var(--_ctm-tab-dn-pt-as-ss-ft-wt, var(--_ctm-dn-pt-as-ss-ft-wt))
    );
    font-style: var(
      --_ctm-mob-dn-pt-as-ss-ft-se-ic,
      var(--_ctm-tab-dn-pt-as-ss-ft-se-ic, var(--_ctm-dn-pt-as-ss-ft-se-ic))
    );
    text-align: var(
      --_ctm-mob-dn-pt-as-ss-tt-an,
      var(--_ctm-tab-dn-pt-as-ss-tt-an, var(--_ctm-dn-pt-as-ss-tt-an))
    );
    letter-spacing: var(
      --_ctm-mob-dn-pt-as-ss-lr-sg,
      var(--_ctm-tab-dn-pt-as-ss-lr-sg, var(--_ctm-dn-pt-as-ss-lr-sg))
    );
    line-height: var(
      --_ctm-mob-dn-pt-as-ss-le-ht,
      var(--_ctm-tab-dn-pt-as-ss-le-ht, var(--_ctm-dn-pt-as-ss-le-ht))
    );
    text-decoration: var(
      --_ctm-mob-dn-pt-as-ss-ue,
      var(--_ctm-tab-dn-pt-as-ss-ue, var(--_ctm-dn-pt-as-ss-ue))
    );
  }

  // .overlay-panel {
  //   position: fixed;
  //   // right: 0px;
  //   // top: 100%;
  //   // left: -160px;
  //   background: var(--_base-white);
  //   box-shadow: $shadow;
  //   border-radius: $border-radius;
  //   // padding: $spacing-sm;
  //   z-index: 1000;
  //   display: flex;
  //   flex-direction: column;
  //   width: 260px;

  //   // width: 220px;
  //   .header-template {
  //     display: flex;
  //     align-items: center;
  //     justify-content: space-between;
  //     padding: 14px;
  //     border-bottom: 1px solid #eee;

  //     span {
  //       font-size: $header-text-font-size;
  //       font-weight: 600;
  //       color: var(--_gray-700);
  //     }

  //     button {
  //       color: $primary-color;
  //       font-size: $header-btn-font-size;
  //       background: none;
  //       border: 1px solid transparent;
  //       cursor: pointer;
  //       transition: color 0.2s ease-in-out;

  //       &:hover {
  //         // color: darken($primary-color, 5%);
  //         color: color-mix(in srgb, var(--_primary-400) 95%, var(--_base-black));
  //       }

  //       &:focus {
  //         outline: none;
  //       }
  //     }
  //   }

  //   .options-container,
  //   .menu-container {
  //     min-height: 200px;
  //     max-height: 200px;
  //     padding: 4px;
  //     overflow-y: auto;
  //     display: flex;
  //     flex-direction: column;
  //     gap: 2px;
  //     .empty_message {
  //       height: 200px;
  //       display: flex;
  //       justify-content: center;
  //       align-items: center;
  //       // padding: 24px;
  //       font-size: 16px;
  //       font-weight: 500;
  //       text-align: center;
  //       .dots {
  //         display: inline-flex;
  //         width: 20px; /* fixed space so text doesn’t shift */
  //         justify-content: space-between;
  //         align-items: flex-end;
  //         margin-left: 6px;
  //         margin-bottom: -9px;
  //       }

  //       .dots span {
  //         animation: blink 1.5s infinite;
  //         opacity: 0;
  //         width: 2px;
  //         height: 2px;
  //         border-radius: 50%;
  //         background-color: var(--_gray-700);
  //       }

  //       .dots span:nth-child(1) {
  //         animation-delay: 0s;
  //       }
  //       .dots span:nth-child(2) {
  //         animation-delay: 0.3s;
  //       }
  //       .dots span:nth-child(3) {
  //         animation-delay: 0.6s;
  //       }

  //       @keyframes blink {
  //         0% {
  //           opacity: 0;
  //         }
  //         50% {
  //           opacity: 1;
  //         }
  //         100% {
  //           opacity: 0;
  //         }
  //       }
  //     }

  //     .option {
  //       display: flex;
  //       align-items: start;
  //       gap: 6px;
  //       padding: 12px;
  //       cursor: pointer;
  //       font-size: $font-size;
  //       // min-height: 48px;
  //       border-radius: 4px;

  //       // .checkbox_container {
  //       //   top: 4px;
  //       // }

  //       &.disabled {
  //         .label-content {
  //           width: 100%;
  //           align-items: center;
  //           cursor: auto;
  //         }
  //       }

  //       .label-content {
  //         display: flex;
  //         flex-direction: column;
  //         font-weight: 400;
  //         // margin-top: -3px;
  //         &.selected {
  //           color: var(--_thm-cs-tt-ls-as);
  //         }

  //         .option-description {
  //           & > div {
  //             max-width: 204px;
  //             white-space: nowrap;
  //             overflow: hidden;
  //             text-overflow: ellipsis;
  //             display: flex;
  //             gap: 4px;
  //             flex-wrap: wrap;
  //             margin-top: 4px;
  //           }
  //         }
  //       }

  //       &:hover {
  //         background-color: var(--_gray-100);
  //       }

  //       input {
  //         margin-right: 8px;
  //         width: auto;
  //         cursor: pointer;
  //         accent-color: var(--_primary-400);
  //         margin-top: 5px;
  //       }

  //       input[type="radio"] {
  //         margin-right: 8px;
  //         accent-color: var(--_primary-400);
  //       }

  //       &:has(input[type="radio"]:checked) {
  //         background-color: var(--_gray-200);
  //       }
  //     }

  //     .menu_dropdown_option {
  //       a {
  //         display: block;
  //         text-decoration: none;
  //         width: 100%;
  //         &:hover {
  //           color: var(--_primary-400);
  //         }
  //       }
  //       button {
  //         display: block;
  //         padding: 12px;
  //         text-align: left;
  //         width: 100%;
  //         &:hover {
  //           background-color: var(--_gray-100);
  //           color: var(--_primary-400);
  //         }
  //       }
  //     }
  //   }
  //   .menu-container {
  //     min-height: fit-content;
  //   }

  //   .footer {
  //     display: flex;
  //     justify-content: space-between;
  //     padding: 0px $spacing-md;
  //     gap: $spacing-md;
  //     border-top: 1px solid var(--_gray-200);

  //     .dropdown_overlay_secondary_button {
  //       background: transparent;
  //       border: 1px solid transparent;
  //       color: var(--_gray-600);
  //       cursor: pointer;
  //       display: flex;
  //       align-items: center;
  //       justify-content: center;
  //       flex: 1 0 0;
  //       margin: $spacing-md 0px;
  //       border-radius: 4px;

  //       &:hover {
  //         color: var(--_gray-900);
  //         background-color: var(--_gray-100);
  //       }
  //     }

  //     .dropdown_overlay_primary_button {
  //       background-color: $primary-color;
  //       color: $background-color;
  //       border: none;
  //       padding: $button-padding;
  //       border-radius: 4px;
  //       cursor: pointer;
  //       font-weight: 500;
  //       display: flex;
  //       align-items: center;
  //       justify-content: center;
  //       flex: 1 0 0;
  //       margin: $spacing-md 0px;
  //       &.disabled {
  //         opacity: 0.5;
  //         pointer-events: none !important;
  //       }

  //       &:hover {
  //         // background-color: lighten($primary-color, $amount: 5%);
  //         background-color: color-mix(in srgb, var(--_primary-400) 95%, var(--_base-white));
  //       }
  //     }

  //     button {
  //       width: 116px;
  //       height: 36px;
  //     }
  //   }
  // }

  .position-bottom {
    top: 80%;
    margin-top: 8px;
    left: 0;
    width: max-content;
  }

  .position-top {
    top: -192px;
    /* shows above the button */
    margin-bottom: 8px;
  }

  @keyframes slideUp {
    from {
      transform: translateY(10px);
      opacity: 1;
      visibility: visible;
    }
    to {
      transform: translateY(0px);
      opacity: 0;
      visibility: hidden;
    }
  }
  @keyframes slideDown {
    from {
      transform: translateY(10px);
      opacity: 1;
      visibility: visible;
    }
    to {
      transform: translateY(0px);
      opacity: 0;
      visibility: hidden;
    }
  }
}

.overlay-panel.v2 {
  position: fixed;
  // right: 0px;
  // top: 100%;
  // left: -160px;
  background: var(--_base-white);
  box-shadow: $shadow;
  border-radius: $border-radius;
  // padding: $spacing-sm;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  width: 260px;

  // width: 220px;
  .header-template {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    border-bottom: 1px solid #eee;

    span {
      font-size: $header-text-font-size;
      font-weight: 600;
      color: var(--_gray-700);
    }

    button {
      color: var(--_thm-py-bs-dt-se-tt-cr);
      font-size: $header-btn-font-size;
      background: none;
      border: 1px solid transparent;
      cursor: pointer;
      transition: color 0.2s ease-in-out;

      &:hover {
        // color: darken($primary-color, 5%);
        // color: color-mix(in srgb, var(--_primary-400) 95%, var(--_base-black));
        color: var(--_thm-py-bs-hr-se-tt-cr);
      }

      &:focus {
        outline: none;
      }
    }
  }

  .options-container,
  .menu-container {
    padding: 4px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    .empty_message {
      height: 160px;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .loading_data {
      height: 160px;
      display: flex;
      justify-content: center;
      flex-direction: column;
      gap: 4px;
      // align-items: center;
      // padding: 24px;
      // font-size: 16px;
      // font-weight: 500;
      // text-align: center;
      // .dots {
      //   display: inline-flex;
      //   width: 20px; /* fixed space so text doesn’t shift */
      //   justify-content: space-between;
      //   align-items: flex-end;
      //   margin-left: 6px;
      //   margin-bottom: -9px;
      // }

      // .dots span {
      //   animation: blink 1.5s infinite;
      //   opacity: 0;
      //   width: 2px;
      //   height: 2px;
      //   border-radius: 50%;
      //   background-color: var(--_gray-700);
      // }

      // .dots span:nth-child(1) {
      //   animation-delay: 0s;
      // }
      // .dots span:nth-child(2) {
      //   animation-delay: 0.3s;
      // }
      // .dots span:nth-child(3) {
      //   animation-delay: 0.6s;
      // }

      // @keyframes blink {
      //   0% {
      //     opacity: 0;
      //   }
      //   50% {
      //     opacity: 1;
      //   }
      //   100% {
      //     opacity: 0;
      //   }
      // }
    }

    .option {
      display: flex;
      align-items: start;
      gap: 6px;
      padding: 12px;
      cursor: pointer;
      font-size: $font-size;
      // min-height: 48px;
      border-radius: 4px;

      // .checkbox_container {
      //   top: 4px;
      // }

      &.disabled {
        opacity: 0.3;
        cursor: not-allowed;
        background-color: var(--_gray-300);

        .label-content {
          width: 100%;
          // align-items: center;
          cursor: not-allowed;
        }
      }

      .label-content {
        display: flex;
        flex-direction: column;
        font-weight: 400;
        // margin-top: -3px;
        &.selected {
          color: var(--_thm-cs-tt-ls-as);
        }

        .option-description {
          & > div {
            max-width: 204px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            display: flex;
            gap: 4px;
            flex-wrap: wrap;
            margin-top: 4px;
          }
        }
      }

      &:hover {
        background-color: var(--_gray-100);
      }

      input {
        margin-right: 8px;
        width: auto;
        cursor: pointer;
        accent-color: var(--_thm-py-bs-dt-se-tt-cr);
        margin-top: 5px;
      }

      input[type="radio"] {
        margin-right: 8px;
        accent-color: var(--_thm-py-bs-dt-se-tt-cr);
      }

      &:has(input[type="radio"]:checked) {
        background-color: var(--_gray-200);
      }
    }

    .menu_dropdown_option {
      a {
        display: block;
        text-decoration: none;
        width: 100%;
        &:hover {
          color: var(--_thm-py-bs-dt-se-tt-cr);
        }
      }
      button {
        display: block;
        padding: 12px;
        text-align: left;
        width: 100%;
        color: var(--_thm-cs-be-se-1);
        &:hover {
          background-color: var(--_gray-100);
          color: var(--_thm-cs-be-se-1);
        }
        &.disabled {
          opacity: 0.3;
          cursor: not-allowed;
          background-color: var(--_gray-300);
        }
      }
    }
  }
  .menu-container {
    min-height: fit-content;
  }

  .footer {
    display: flex;
    justify-content: space-between;
    padding: 0px $spacing-md;
    gap: $spacing-md;
    border-top: 1px solid var(--_gray-200);

    .dropdown_overlay_secondary_button {
      background-color: var(--_thm-sy-bs-dt-se-bd-cr);
      color: var(--_thm-sy-bs-dt-se-tt-cr);
      border: 1px solid var(--_thm-sy-bs-dt-se-br-cr);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      flex: 1 0 0;
      margin: $spacing-md 0px;
      border-radius: 4px;

      &:hover {
        background-color: var(--_thm-sy-bs-hr-se-bd-cr);
        color: var(--_thm-sy-bs-hr-se-tt-cr);
        border: 1px solid var(--_thm-sy-bs-hr-se-br-cr);
      }
    }

    .dropdown_overlay_primary_button {
      background-color: var(--_thm-py-bs-dt-se-bd-cr);
      color: var(--_thm-py-bs-dt-se-tt-cr);
      border: 1px solid var(--_thm-py-bs-dt-se-br-cr);
      padding: $button-padding;
      border-radius: 4px;
      cursor: pointer;
      font-weight: 500;
      display: flex;
      align-items: center;
      justify-content: center;
      flex: 1 0 0;
      margin: $spacing-md 0px;
      &.disabled {
        opacity: 0.5;
        pointer-events: none !important;
      }

      &:hover {
        background-color: var(--_thm-py-bs-hr-se-bd-cr);
        color: var(--_thm-py-bs-hr-se-tt-cr);
        border: 1px solid var(--_thm-py-bs-hr-se-br-cr);
      }
    }

    button {
      width: 116px;
      height: 36px;
    }
  }
}
