/* Cart Popup Overlay */
.sunfolia-smart-cart-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease;

    &.active {
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 1;

        .sunfolia-cart-popup-container {
            transform: scale(1);
        }
    }

  /* Popup Container */
  .sunfolia-cart-popup-container {
    position: relative;
    background: #fff;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: scale(0.8);
    transition: transform 0.3s ease;
  }

  /* Popup Header */
  .sunfolia-cart-popup-header {
    padding: 20px 30px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;

    @media (max-width: 480px) {
      padding: 20px 0;
    }

    .sunfolia-cart-success-message {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      color: #2e7d32;
      font-size: 18px;
      font-weight: 500;
      margin: 0;

      @media (max-width: 480px) {
        font-size: 14px;
        padding: 0 15px;
      }
    }

    /* Close Button */
    .sunfolia-cart-popup-close {
      position: absolute;
      top: 15px;
      right: 15px;
      width: 40px;
      height: 40px;
      border: none;
      border-radius: 50%;
      font-size: 28px;
      line-height: 1;
      cursor: pointer;
      z-index: 10;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.3s ease;
      color: #333;
      background-color: transparent;
      outline: none;
      padding: 0;

      &:hover {
        background-color: transparent;
      }

      @media (max-width: 480px) {
        width: 35px;
        height: 35px;
      }

    }
  }

  /* Popup Content */
  .sunfolia-cart-popup-content {
    overflow-y: auto;
    max-height: calc(100vh - 70px);
    padding: 20px 25px 30px;
  }

  /* Loading Spinner */
  .sunfolia-cart-popup-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;

    .sunfolia-spinner {
      width: 50px;
      height: 50px;
      border: 4px solid #f3f3f3;
      border-top: 4px solid #3498db;
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }
  }

  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

  /* Popup Body */
  .sunfolia-cart-popup-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }

  .sunfolia-cart-popup-items {
    position: relative;

    .cart-popup-item-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 15px;
      background: #f9f9f9;
      border-radius: 8px;
      margin: 0 10px 15px 0;

      .cart-popup-item-txt {
        text-transform: uppercase;
      }
    }

    h3 {
      margin: 0 0 20px;
      font-size: 20px;
      color: #333;
      font-weight: 600;
    }

    .sunfolia-cart-items-list {
      margin-bottom: 20px;
      max-height: calc(80vh - 350px);
      overflow-y: auto;
      padding-right: 10px;

      &::-webkit-scrollbar {
        width: 2px;
      }

      &::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
      }

      &::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 10px;
      }

      &::-webkit-scrollbar-thumb:hover {
        background: #555;
      }
    }
  }

  .sunfolia-related-products-list {
    &::-webkit-scrollbar {
      width: 2px;
    }

    &::-webkit-scrollbar-track {
      background: #f1f1f1;
      border-radius: 10px;
    }

    &::-webkit-scrollbar-thumb {
      background: #888;
      border-radius: 10px;
    }

    &::-webkit-scrollbar-thumb:hover {
      background: #555;
    }
  }

  /* Cart Item */
  .sunfolia-cart-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    align-items: center;

    &:hover {
      background: #f0f0f0;
      transform: translateX(5px);
    }

    .cart-item-info {
      display: flex;
      gap: 15px;
      width: 100%;
      flex: 1;
      align-items: center;
    }

    .cart-item-image {
      flex-shrink: 0;
      width: 70px;
      height: 70px;

      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 6px;
      }
    }

    .cart-item-details {
      flex: 1;

      .sunfolia-product-quantity-price {
        font-size: 14px;
      }

      .sunfolia-regular-price {
        margin: 0;
      }

      .sunfolia-product-title {
        margin: 0;
        font-size: 15px;
        font-weight: 600;

        a {
          color: #333;
          text-decoration: none;
          transition: color 0.3s ease;

          &:hover {
            color: #3498db;
          }
        }
      }

      .cart-item-meta {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 14px;
        color: #666;

        .price {
          font-weight: 600;
          color: #2e7d32;
        }
      }
    }
  }

  /* Cart Totals */
  .sunfolia-cart-totals {
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 20px;

    .sunfolia-cart-subtotal {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 18px;

      .sunfolia-sub-total {
        color: #2e7d32;
        font-size: 20px;
      }
    }
    .sunfolia-sub-total-txt {
      text-transform: uppercase;
    }
  }

  /* Cart Actions */
  .sunfolia-cart-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;

    @media (max-width: 768px) {
      position: relative;
    }

    .sunfolia-button {
      flex: 1;
      padding: 12px 20px;
      text-align: center;
      text-decoration: none;
      border-radius: 6px;
      font-weight: 600;
      transition: all 0.3s ease;
      border: none;
      cursor: pointer;
      font-size: 14px;
      line-height: 1;
      text-transform: uppercase;
    }

    .view-cart-btn {
      background: #fff;
      color: #333;
      border: 1px solid #ddd;

      &:hover {
        background: #ddd;
      }
    }

    .checkout-btn {
      background: #2e7d32;
      color: #fff;

      &:hover {
        background: #1b5e20;
      }
    }
  }

  /* Related Products Section */
  .sunfolia-cart-popup-related {
    .sunfolia-related-product-title {
      margin: 0 0 20px;
      font-size: 20px;
      color: #333;
      font-weight: 600;
    }

    .sunfolia-related-products-list {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 15px;
      height: calc(100vh - 300px);
      overflow-y: auto;

      @media (max-width: 768px) {
        height: auto;
        overflow-y: auto;
        grid-template-columns: repeat(3, 1fr);
        margin-bottom: 50px;
      }

      @media (max-width: 575px) {
        grid-template-columns: repeat(2, 1fr);
        margin-bottom: 25px;
      }

      .sunfolia-related-product-item {
        .sunfolia-related-product-item-container {
          background-color: #f9f9f9;
          padding: 15px;
          text-align: center;
          border-radius: 8px;
          transition: all 0.3s ease;

          &:hover {
            background-color: #f0f0f0;
            transform: translateY(-5px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
          }
        }

        .attachment-thumbnail {
          width: 100%;
          height: 120px;
          object-fit: cover;
          border-radius: 6px;
          margin-bottom: 10px;
        }

        .sunfolia-product-title {
          margin: 0 0 8px;
          font-size: 14px;
          font-weight: 600;
          line-height: 1.3;

          .sunfolia-product-link {
            color: #333;
            text-decoration: none;
            transition: color 0.3s ease;

            &:hover {
              color: #3498db;
            }
          }
        }

        .sunfolia-product-price {
          display: block;
          margin-bottom: 10px;
          font-size: 16px;
          font-weight: 600;
          color: #2e7d32;
        }

        .sunfolia-add-to-cart-btn {
          display: block;
          width: 100%;
          padding: 8px 15px;
          background: #3498db;
          color: #fff;
          text-decoration: none;
          border-radius: 4px;
          font-size: 13px;
          font-weight: 600;
          transition: all 0.3s ease;
          text-align: center;
          border: none;
          cursor: pointer;

          &:hover {
            background: #2980b9;
            color: #fff;
          }
        }

        .sunfolia-view-details-btn {
          display: block;
          width: 100%;
          padding: 8px 15px;
          text-decoration: none;
          border-radius: 4px;
          font-size: 13px;
          font-weight: 600;
          transition: all 0.3s ease;
          text-align: center;
          border: none;
          cursor: pointer;
          outline: none;

          &:hover {
          }
        }
      }
    }
  }

  /* Cart Item Selection */

  .cart-header-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;

    input[type="checkbox"] {
      width: 16px;
      height: 16px;
      cursor: pointer;
      outline: none;
    }

    label {
      font-size: 14px;
      font-weight: 600;
      color: #333;
      cursor: pointer;
      margin: 0;
    }
  }

  .sunfolia-remove-selected-btn {
    padding: 8px 16px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;

    &:hover {
      background: #c82333;
    }

    &:disabled {
      background: #ccc;
      cursor: not-allowed;
    }
  }

  /* Cart Item with Checkbox - styles merged with existing .sunfolia-cart-item */
  .cart-item-checkbox {
    flex-shrink: 0;
    display: flex;
    align-items: center;

    input[type="checkbox"] {
      width: 16px;
      height: 16px;
      cursor: pointer;
      margin: 0;
      outline: none;
    }

    label {
      display: none;
    }
  }


  /* Responsive Design */
  @media (max-width: 768px) {
    .sunfolia-cart-popup-container {
      width: 95%;
      max-height: 95vh;
    }

    .sunfolia-cart-popup-content {
      padding: 20px;
    }

    .sunfolia-cart-popup-body {
      grid-template-columns: 1fr;
      gap: 20px;
    }

    .sunfolia-related-products-list {
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
    }

    .cart-actions {
      flex-direction: column;
    }

    .cart-item-image {
      width: 60px;
      height: 60px;
    }
  }

  @media (max-width: 480px) {
    .sunfolia-cart-popup-content {
      padding: 15px;
    }

    .sunfolia-related-products-list {
      grid-template-columns: 1fr;
    }
  }
}

